diff options
| author | Lars Westermann <lwe@php.net> | 2007-11-15 00:10:38 +0000 |
|---|---|---|
| committer | Lars Westermann <lwe@php.net> | 2007-11-15 00:10:38 +0000 |
| commit | 9d4daba92977dabb940c187b7a8fd2051eed3eae (patch) | |
| tree | 64aa08754ecd5b567cce41947c7403e04aa7ff8a /ext/pdo_firebird/firebird_statement.c | |
| parent | 07a3423f179be42eba1649ff49c7ac6b23dd9e9b (diff) | |
| download | php-git-9d4daba92977dabb940c187b7a8fd2051eed3eae.tar.gz | |
- Fixed bug #43296 (Feature req: pdo_firebird: ATTR_FETCH_TABLE_NAMES support)
Diffstat (limited to 'ext/pdo_firebird/firebird_statement.c')
| -rw-r--r-- | ext/pdo_firebird/firebird_statement.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index f581e24b4a..2b44f87a03 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -162,15 +162,27 @@ static int firebird_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{ pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; struct pdo_column_data *col = &stmt->columns[colno]; XSQLVAR *var = &S->out_sqlda.sqlvar[colno]; + int colname_len; + char *cp; /* allocate storage for the column */ var->sqlind = (void*)emalloc(var->sqllen + 2*sizeof(short)); var->sqldata = &((char*)var->sqlind)[sizeof(short)]; + colname_len = (S->H->fetch_table_names && var->relname_length) + ? (var->aliasname_length + var->relname_length + 1) + : (var->aliasname_length); col->precision = -var->sqlscale; col->maxlen = var->sqllen; - col->namelen = var->aliasname_length; - col->name = estrndup(var->aliasname,var->aliasname_length); + col->namelen = colname_len; + col->name = cp = emalloc(colname_len + 1); + if (colname_len > var->aliasname_length) { + memmove(cp, var->relname, var->relname_length); + cp += var->relname_length; + *cp++ = '.'; + } + memmove(cp, var->aliasname, var->aliasname_length); + *(cp+var->aliasname_length) = '\0'; col->param_type = PDO_PARAM_STR; return 1; |
