cvs: php3 /functions unified_odbc.c

From: Date: Fri, 05 Jan 2001 21:56:16 +0000
Subject: cvs: php3 /functions unified_odbc.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-3394@lists.php.net to get a copy of this message
fmk Fri Jan 5 13:56:16 2001 EDT Modified files: /php3/functions unified_odbc.c Log: Adding hack to allow odbc_tables to work on Access databases Index: php3/functions/unified_odbc.c diff -u php3/functions/unified_odbc.c:1.115 php3/functions/unified_odbc.c:1.116 --- php3/functions/unified_odbc.c:1.115 Wed Oct 11 15:33:54 2000 +++ php3/functions/unified_odbc.c Fri Jan 5 13:56:15 2001 @@ -29,7 +29,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: unified_odbc.c,v 1.115 2000/10/11 22:33:54 fmk Exp $ */ +/* $Id: unified_odbc.c,v 1.116 2001/01/05 21:56:15 fmk Exp $ */ /* This file is based on the Adabas D extension. * Adabas D will no longer be supported as separate module. @@ -51,6 +51,8 @@ #if HAVE_UODBC +#define SAFE_SQL_NTS(n) ((SWORD) ((n)?(SQL_NTS):0)) + UODBC_MODULE PHP3_UODBC_MODULE; #define UODBC_GLOBAL(a) a #define UODBC_TLS_VARS @@ -544,7 +546,7 @@ } /* }}} */ -/* {{{ proto int odbc_tables(int connection_id [, string qualifier, string owner, string name, string table_types]) +/* {{{ proto int odbc_tables(int connection_id [, string qualifier [, string owner [, string name [, string table_types]]]]) Call the SQLTables function */ UODBC_FUNCTION(tables) { @@ -600,11 +602,14 @@ RETURN_FALSE; } + /* This hack is needed to access table information in Access databases (fmk) */ + if (table && strlen(table) && schema && !strlen(schema)) schema = NULL; + rc = SQLTables(result->stmt, - cat, (short int)strlen(cat), - schema, (short int)strlen(schema), - table, (short int)strlen(table), - type, (short int)strlen(type)); + cat, SAFE_SQL_NTS(cat), + schema, SAFE_SQL_NTS(schema), + table, SAFE_SQL_NTS(table), + type, SAFE_SQL_NTS(type)); if (rc == SQL_ERROR) { UODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLTables");

« previous php.cvs (#3394) next »