Skip to content

Commit 172251c

Browse files
committed
ext/pdo_dblib: set PDO column's table field from describer
1 parent 79efa22 commit 172251c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎ext/pdo_dblib/dblib_stmt.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,19 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno)
247247
S->computed_column_name_count++;
248248
}
249249

250+
/*
251+
* dbtabsource isn't implemented by FreeTDS, must use this function
252+
* instead (which is also implemented by SQL Server?)
253+
*
254+
* XXX: SQL Server only returns table names with FOR BROWSE
255+
*/
256+
DBCOL dbcol;
257+
/* XXX: Expensive? Use the other data from this call? */
258+
RETCODE rc = dbcolinfo(H->link, CI_REGULAR, colno+1, 0, &dbcol);
259+
if (rc == SUCCEED && dbcol.TableName[0]) {
260+
col->table = zend_string_init(dbcol.TableName, strlen(dbcol.TableName), 0);
261+
}
262+
250263
col->maxlen = dbcollen(H->link, colno+1);
251264

252265
return 1;

0 commit comments

Comments
 (0)