Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34181 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48031 invoked by uid 1010); 20 Dec 2007 21:01:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 47997 invoked from network); 20 Dec 2007 21:01:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Dec 2007 21:01:52 -0000 Authentication-Results: pb1.pair.com header.from=iodbc@openlinksw.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=iodbc@openlinksw.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain openlinksw.com from 194.109.164.61 cause and error) X-PHP-List-Original-Sender: iodbc@openlinksw.com X-Host-Fingerprint: 194.109.164.61 roady.xs4all.nl Linux 2.4/2.6 Received: from [194.109.164.61] ([194.109.164.61:60056] helo=roady.xs4all.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E5/3B-18668-C38DA674 for ; Thu, 20 Dec 2007 16:01:51 -0500 Received: from scooby.pvk.private ([172.16.11.18]) by roady.xs4all.nl with esmtp (Exim 4.30) id 1J5SVd-0008OP-IN; Thu, 20 Dec 2007 22:00:49 +0100 Message-ID: <476AD553.3040103@openlinksw.com> Date: Thu, 20 Dec 2007 21:49:23 +0100 Organization: OpenLink Software User-Agent: Thunderbird 2.0.0.9 (X11/20071115) MIME-Version: 1.0 To: =?ISO-8859-15?Q?Johannes_Schl=FCter?= CC: php-dev References: <476AAC30.1080200@openlinksw.com> <1198182770.20516.29.camel@johannes.nop> In-Reply-To: <1198182770.20516.29.camel@johannes.nop> Content-Type: multipart/mixed; boundary="------------090202030800000101010107" Subject: Re: Fixed and enhancements for php odbc layer From: iodbc@openlinksw.com (iODBC Maintainer) --------------090202030800000101010107 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Hi Johannes, >> As maintainer of the iODBC driver manager project i have some fixed and >> enhancements for the php odbc layer that i would like to submit for >> review and inclusion into the code base. >> > [...] > >> Please let me know what the appropriate way of sending these patches to >> the relevant project members, or whether i should post them on this >> mailing list. >> > > You can either report it as a bug at bugs.php.net and provide a patch or > send the patch(es) as .txt file (the list will drop attachments of other > types) here. > > In general: The ODBC extension seems to be quite unmaintained, the > registered maintainer did his last commit in 2004 if I didn't miss a > thing in the log. So, we're happy with any help in that area :-) > > I have attached 3 diffs as txt files. Each of the files start with a short explanation of what the patch is supposed to do, so it is easier for anyone else to see what i did. All three diffs have been made against the PHP_5_2 branch of your CVS tree and should be applied within the ext/odbc directory. Since i cut them in pieces for easy reading, you can expect some warnings about lines, but i checked and all three patches combine fine. If there is any problem, please let me know as i am keen to get this to work properly. Additionally if there is a list of TODO items for this module, i will be happy to see if i or my team can be of assistance. Patrick --------------090202030800000101010107 Content-Type: text/plain; name="odbc-cursor.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="odbc-cursor.txt" This patch adds extra control for using ODBC cursors, allowing the user to select which cursor model to use for his installation. Index: php_odbc.c =================================================================== RCS file: /repository/php-src/ext/odbc/php_odbc.c,v retrieving revision 1.189.2.4.2.7 diff -u -r1.189.2.4.2.7 php_odbc.c --- php_odbc.c 13 Mar 2007 00:04:38 -0000 1.189.2.4.2.7 +++ php_odbc.c 20 Dec 2007 16:53:07 -0000 @@ -380,6 +380,50 @@ } /* }}} */ + +/* {{{ PHP_INI_DISP(display_cursortype) + */ +static PHP_INI_DISP(display_cursortype) +{ + char *value; + TSRMLS_FETCH(); + + if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) { + value = ini_entry->orig_value; + } else if (ini_entry->value) { + value = ini_entry->value; + } else { + value = NULL; + } + + if (value) { + switch (atoi (value)) + { + case SQL_CURSOR_FORWARD_ONLY: + PUTS ("Forward Only cursor"); + break; + + case SQL_CURSOR_STATIC: + PUTS ("Static cursor"); + break; + + case SQL_CURSOR_KEYSET_DRIVEN: + PUTS ("Keyset driven cursor"); + break; + + case SQL_CURSOR_DYNAMIC: + PUTS ("Dynamic cursor"); + break; + + default: + php_printf("Unknown cursor model %s", value); + break; + } + } +} + +/* }}} */ + /* {{{ PHP_INI_BEGIN */ PHP_INI_BEGIN() @@ -401,6 +445,8 @@ defaultbinmode, zend_odbc_globals, odbc_globals, display_binmode) STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, check_persistent, zend_odbc_globals, odbc_globals) + STD_PHP_INI_ENTRY_EX("odbc.default_cursortype", "3", PHP_INI_ALL, OnUpdateLong, + default_cursortype, zend_odbc_globals, odbc_globals, display_cursortype) PHP_INI_END() /* }}} */ @@ -879,7 +925,8 @@ /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other type if not possible. */ - if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) + int cursortype = ODBCG(default_cursortype); + if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, cursortype) == SQL_ERROR) { odbc_sql_error(conn, result->stmt, " SQLSetStmtOption"); SQLFreeStmt(result->stmt, SQL_DROP); @@ -1299,7 +1347,8 @@ /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other type if not possible. */ - if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) + int cursortype = ODBCG(default_cursortype); + if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, cursortype) == SQL_ERROR) { odbc_sql_error(conn, result->stmt, " SQLSetStmtOption"); SQLFreeStmt(result->stmt, SQL_DROP); Index: php_odbc_includes.h =================================================================== RCS file: /repository/php-src/ext/odbc/php_odbc_includes.h,v retrieving revision 1.12.2.1.2.4 diff -u -r1.12.2.1.2.4 php_odbc_includes.h --- php_odbc_includes.h 13 Mar 2007 00:04:38 -0000 1.12.2.1.2.4 +++ php_odbc_includes.h 20 Dec 2007 16:53:07 -0000 @@ -261,6 +265,7 @@ int defConn; long defaultlrl; long defaultbinmode; + long default_cursortype; char laststate[6]; char lasterrormsg[SQL_MAX_MESSAGE_LENGTH]; HashTable *resource_list; --------------090202030800000101010107 Content-Type: text/plain; name="odbc-iodbc.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="odbc-iodbc.txt" This patch updates the PHP ODBC layer to use the curent versions of iODBC. Index: php_odbc.c =================================================================== RCS file: /repository/php-src/ext/odbc/php_odbc.c,v retrieving revision 1.189.2.4.2.7 diff -u -r1.189.2.4.2.7 php_odbc.c --- php_odbc.c 13 Mar 2007 00:04:38 -0000 1.189.2.4.2.7 +++ php_odbc.c 20 Dec 2007 16:53:12 -0000 @@ -727,7 +773,7 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type) { odbc_result *result; -#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_OPENLINK) +#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) /* this seems to be necessary for Solid2.3 ( tested by * tammy@synchronis.com) and Solid 3.0 (tested by eric@terra.telemediair.nl) * Solid does not seem to declare a SQLINTEGER, but it does declare a @@ -2139,7 +2188,7 @@ } /* Possible fix for bug #10250 * Needs testing on UnixODBC < 2.0.5 though. */ -#if defined(HAVE_EMPRESS) || defined(HAVE_UNIXODBC) || defined(PHP_WIN32) +#if defined(HAVE_EMPRESS) || defined(HAVE_UNIXODBC) || defined(PHP_WIN32) || defined (HAVE_IODBC) /* * Uncomment the line above, and comment line below to fully test * #ifdef HAVE_EMPRESS */ { Index: php_odbc.h =================================================================== RCS file: /repository/php-src/ext/odbc/php_odbc.h,v retrieving revision 1.60.2.1.2.1 diff -u -r1.60.2.1.2.1 php_odbc.h --- php_odbc.h 1 Jan 2007 09:36:04 -0000 1.60.2.1.2.1 +++ php_odbc.h 20 Dec 2007 16:53:12 -0000 @@ -33,7 +33,7 @@ extern zend_module_entry odbc_module_entry; #define odbc_module_ptr &odbc_module_entry -#if defined(HAVE_DBMAKER) || defined(PHP_WIN32) || defined(HAVE_IBMDB2) || defined(HAVE_UNIXODBC) || defined(HAVE_BIRDSTEP) +#if defined(HAVE_DBMAKER) || defined(PHP_WIN32) || defined(HAVE_IBMDB2) || defined(HAVE_UNIXODBC) || defined(HAVE_BIRDSTEP) || defined(HAVE_IODBC) # define PHP_ODBC_HAVE_FETCH_HASH 1 #endif Index: php_odbc_includes.h =================================================================== RCS file: /repository/php-src/ext/odbc/php_odbc_includes.h,v retrieving revision 1.12.2.1.2.4 diff -u -r1.12.2.1.2.4 php_odbc_includes.h --- php_odbc_includes.h 13 Mar 2007 00:04:38 -0000 1.12.2.1.2.4 +++ php_odbc_includes.h 20 Dec 2007 16:53:12 -0000 @@ -90,19 +90,19 @@ #elif defined(HAVE_IODBC) /* iODBC library */ +#ifdef CHAR +#undef CHAR +#endif + +#ifdef SQLCHAR +#undef SQLCHAR +#endif + #define ODBC_TYPE "iODBC" -#include -#include +#include +#include +#include #define HAVE_SQL_EXTENDED_FETCH 1 -#define SQL_FD_FETCH_ABSOLUTE 0x00000010L -#define SQL_CURSOR_DYNAMIC 2UL -#define SQL_NO_TOTAL (-4) -#define SQL_SO_DYNAMIC 0x00000004L -#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100) -#define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET) -#ifndef SQL_SUCCEEDED -#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0) -#endif #elif defined(HAVE_UNIXODBC) /* unixODBC library */ @@ -148,8 +148,12 @@ #include #include #define HAVE_SQL_EXTENDED_FETCH 1 +#ifndef SQLSMALLINT #define SQLSMALLINT SWORD +#endif +#ifndef SQLUSMALLINT #define SQLUSMALLINT UWORD +#endif #elif defined(HAVE_BIRDSTEP) /* Raima Birdstep */ @@ -204,7 +208,7 @@ /* Common defines */ -#if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC ) +#if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC ) || defined (HAVE_IODBC) #define ODBC_SQL_ENV_T SQLHANDLE #define ODBC_SQL_CONN_T SQLHANDLE #define ODBC_SQL_STMT_T SQLHANDLE --------------090202030800000101010107 Content-Type: text/plain; name="odbc-types.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="odbc-types.txt" This patch changes old definitions for SWORD, UWORD that where used in ODBC 2.x and replaces them with new ODBC 3.x constructions which also enables ODBC64 support. This patch has been tested against iODBC on UNIX and Mac OS X and on both 32 and 64 bit Windows against the Microsoft Driver manager, but should not cause any problem for other ODBC driver managers, since all current driver managers support the ODBC 3.x specification. Index: php_odbc.c =================================================================== RCS file: /repository/php-src/ext/odbc/php_odbc.c,v retrieving revision 1.189.2.4.2.7 diff -u -r1.189.2.4.2.7 php_odbc.c --- php_odbc.c 13 Mar 2007 00:04:38 -0000 1.189.2.4.2.7 +++ php_odbc.c 20 Dec 2007 16:52:58 -0000 @@ -64,7 +64,7 @@ static int le_result, le_conn, le_pconn; -#define SAFE_SQL_NTS(n) ((SWORD) ((n)?(SQL_NTS):0)) +#define SAFE_SQL_NTS(n) ((SQLSMALLINT) ((n)?(SQL_NTS):0)) /* {{{ odbc_functions[] */ @@ -180,7 +180,7 @@ if (res->stmt) { #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc, - (UWORD)SQL_COMMIT); + (SQLUSMALLINT) SQL_COMMIT); #endif rc = SQLFreeStmt(res->stmt,SQL_DROP); /* We don't want the connection to be closed after the last statment has been closed @@ -565,9 +611,9 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS) { char state[6]; - SDWORD error; /* Not used */ + SQLINTEGER error; /* Not used */ char errormsg[SQL_MAX_MESSAGE_LENGTH]; - SWORD errormsgsize; /* Not used */ + SQLSMALLINT errormsgsize; /* Not used */ RETCODE rc; ODBC_SQL_ENV_T henv; ODBC_SQL_CONN_T conn; @@ -641,8 +687,8 @@ { RETCODE rc; int i; - SWORD colnamelen; /* Not used */ - SDWORD displaysize; + SQLSMALLINT colnamelen; /* Not used */ + SQLLEN displaysize; result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); @@ -650,9 +696,9 @@ result->binmode = ODBCG(defaultbinmode); for(i = 0; i < result->numcols; i++) { - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_NAME, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME, result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_TYPE, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, NULL, 0, NULL, &result->values[i].coltype); /* Don't bind LONG / BINARY columns, so that fetch behaviour can @@ -670,17 +716,17 @@ #ifdef HAVE_ADABAS case SQL_TIMESTAMP: result->values[i].value = (char *)emalloc(27); - SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value, + SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, 27, &result->values[i].vallen); break; #endif /* HAVE_ADABAS */ default: - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_DISPLAY_SIZE, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE, NULL, 0, NULL, &displaysize); displaysize = displaysize <= result->longreadlen ? displaysize : result->longreadlen; result->values[i].value = (char *)emalloc(displaysize + 1); - rc = SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value, + rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, displaysize + 1, &result->values[i].vallen); break; } @@ -702,7 +748,7 @@ ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); - rc = SQLTransact(conn->henv, conn->hdbc, (UWORD)((type)?SQL_COMMIT:SQL_ROLLBACK)); + rc = SQLTransact(conn->henv, conn->hdbc, (SQLUSMALLINT)((type)?SQL_COMMIT:SQL_ROLLBACK)); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTransact"); RETURN_FALSE; @@ -736,7 +782,7 @@ */ SDWORD len; #else - SQLINTEGER len; + SQLLEN len; #endif zval **pv_res, **pv_num; @@ -763,7 +809,7 @@ RETURN_FALSE; } - SQLColAttributes(result->stmt, (UWORD)Z_LVAL_PP(pv_num), + SQLColAttributes(result->stmt, (SQLUSMALLINT)Z_LVAL_PP(pv_num), (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len); @@ -841,7 +887,7 @@ odbc_connection *conn; RETCODE rc; #ifdef HAVE_SQL_EXTENDED_FETCH - UDWORD scrollopts; + SQLUINTEGER scrollopts; #endif if (zend_get_parameters_ex(2, &pv_conn, &pv_query) == FAILURE) { @@ -932,15 +979,15 @@ { zval **pv_res, **pv_param_arr, **tmp; typedef struct params_t { - SDWORD vallen; + SQLLEN vallen; int fp; } params_t; params_t *params = NULL; char *filename; unsigned char otype; - SWORD sqltype, ctype, scale; - SWORD nullable; - UDWORD precision; + SQLSMALLINT sqltype, ctype, scale; + SQLSMALLINT nullable; + SQLULEN precision; odbc_result *result; int numArgs, i, ne; RETCODE rc; @@ -997,7 +1044,7 @@ RETURN_FALSE; } - SQLDescribeParam(result->stmt, (UWORD)i, &sqltype, &precision, + SQLDescribeParam(result->stmt, (SQLUSMALLINT)i, &sqltype, &precision, &scale, &nullable); params[i-1].vallen = Z_STRLEN_PP(tmp); params[i-1].fp = -1; @@ -1044,7 +1091,7 @@ params[i-1].vallen = SQL_LEN_DATA_AT_EXEC(0); - rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT, + rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, ctype, sqltype, precision, scale, (void *)params[i-1].fp, 0, ¶ms[i-1].vallen); @@ -1056,7 +1103,7 @@ params[i-1].vallen = SQL_NULL_DATA; } - rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT, + rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT, ctype, sqltype, precision, scale, Z_STRVAL_PP(tmp), 0, ¶ms[i-1].vallen); @@ -1131,7 +1178,8 @@ PHP_FUNCTION(odbc_cursor) { zval **pv_res; - SWORD len, max_len; + SQLUSMALLINT max_len; + SQLSMALLINT len; char *cursorname; odbc_result *result; RETCODE rc; @@ -1150,12 +1198,12 @@ if (max_len > 0) { cursorname = emalloc(max_len + 1); - rc = SQLGetCursorName(result->stmt,cursorname,(SWORD)max_len,&len); + rc = SQLGetCursorName(result->stmt,cursorname,(SQLSMALLINT)max_len,&len); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { char state[6]; /* Not used */ - SDWORD error; /* Not used */ - char errormsg[255]; - SWORD errormsgsize; /* Not used */ + SQLINTEGER error; /* Not used */ + char errormsg[SQL_MAX_MESSAGE_LENGTH]; + SQLSMALLINT errormsgsize; /* Not used */ SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc, result->stmt, state, &error, errormsg, @@ -1257,7 +1305,7 @@ odbc_connection *conn; RETCODE rc; #ifdef HAVE_SQL_EXTENDED_FETCH - UDWORD scrollopts; + SQLUINTEGER scrollopts; #endif numArgs = ZEND_NUM_ARGS(); @@ -1351,12 +1400,12 @@ int i; odbc_result *result; RETCODE rc; - SWORD sql_c_type; + SQLSMALLINT sql_c_type; char *buf = NULL; #ifdef HAVE_SQL_EXTENDED_FETCH - UDWORD crow; - UWORD RowStatus[1]; - SDWORD rownum = -1; + SQLULEN crow; + SQLUSMALLINT RowStatus[1]; + SQLLEN rownum = -1; zval **pv_res, **pv_row, *tmp; switch(ZEND_NUM_ARGS()) { @@ -1435,7 +1484,7 @@ break; } if (buf == NULL) buf = emalloc(result->longreadlen + 1); - rc = SQLGetData(result->stmt, (UWORD)(i + 1), sql_c_type, + rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1), sql_c_type, buf, result->longreadlen + 1, &result->values[i].vallen); if (rc == SQL_ERROR) { @@ -1509,14 +1558,14 @@ int numArgs, i; odbc_result *result; RETCODE rc; - SWORD sql_c_type; + SQLSMALLINT sql_c_type; char *buf = NULL; zval **pv_res, **pv_res_arr, *tmp; #ifdef HAVE_SQL_EXTENDED_FETCH zval **pv_row; - UDWORD crow; - UWORD RowStatus[1]; - SDWORD rownum = -1; + SQLULEN crow; + SQLUSMALLINT RowStatus[1]; + SQLLEN rownum = -1; #endif /* HAVE_SQL_EXTENDED_FETCH */ numArgs = ZEND_NUM_ARGS(); @@ -1595,7 +1644,7 @@ } if (buf == NULL) buf = emalloc(result->longreadlen + 1); - rc = SQLGetData(result->stmt, (UWORD)(i + 1),sql_c_type, + rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen + 1, &result->values[i].vallen); if (rc == SQL_ERROR) { @@ -1666,13 +1715,13 @@ PHP_FUNCTION(odbc_fetch_row) { int numArgs; - SDWORD rownum = 1; + SQLLEN rownum = 1; odbc_result *result; RETCODE rc; zval **pv_res, **pv_row; #ifdef HAVE_SQL_EXTENDED_FETCH - UDWORD crow; - UWORD RowStatus[1]; + SQLULEN crow; + SQLUSMALLINT RowStatus[1]; #endif numArgs = ZEND_NUM_ARGS(); @@ -1728,15 +1777,15 @@ { char *field; int field_ind; - SWORD sql_c_type = SQL_C_CHAR; + SQLSMALLINT sql_c_type = SQL_C_CHAR; odbc_result *result; int i = 0; RETCODE rc; - SDWORD fieldsize; + SQLLEN fieldsize; zval **pv_res, **pv_field; #ifdef HAVE_SQL_EXTENDED_FETCH - UDWORD crow; - UWORD RowStatus[1]; + SQLULEN crow; + SQLUSMALLINT RowStatus[1]; #endif field_ind = -1; @@ -1814,8 +1863,8 @@ else fieldsize = result->longreadlen; } else { - SQLColAttributes(result->stmt, (UWORD)(field_ind + 1), - (UWORD)((sql_c_type == SQL_C_BINARY) ? SQL_COLUMN_LENGTH : + SQLColAttributes(result->stmt, (SQLUSMALLINT)(field_ind + 1), + (SQLUSMALLINT)((sql_c_type == SQL_C_BINARY) ? SQL_COLUMN_LENGTH : SQL_COLUMN_DISPLAY_SIZE), NULL, 0, NULL, &fieldsize); } @@ -1826,7 +1875,7 @@ /* SQLGetData will truncate CHAR data to fieldsize - 1 bytes and append \0. * For binary data it is truncated to fieldsize bytes. */ - rc = SQLGetData(result->stmt, (UWORD)(field_ind + 1), sql_c_type, + rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1), sql_c_type, field, fieldsize, &result->values[field_ind].vallen); if (rc == SQL_ERROR) { @@ -1869,7 +1918,7 @@ /* Call SQLGetData() until SQL_SUCCESS is returned */ while(1) { - rc = SQLGetData(result->stmt, (UWORD)(field_ind + 1),sql_c_type, + rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1),sql_c_type, field, fieldsize, &result->values[field_ind].vallen); if (rc == SQL_ERROR) { @@ -1904,10 +1953,10 @@ odbc_result *result; RETCODE rc; zval **pv_res, **pv_format; - SWORD sql_c_type; + SQLSMALLINT sql_c_type; #ifdef HAVE_SQL_EXTENDED_FETCH - UDWORD crow; - UWORD RowStatus[1]; + SQLULEN crow; + SQLUSMALLINT RowStatus[1]; #endif numArgs = ZEND_NUM_ARGS(); @@ -1973,7 +2022,7 @@ if (buf == NULL) buf = emalloc(result->longreadlen); - rc = SQLGetData(result->stmt, (UWORD)(i + 1),sql_c_type, + rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen, &result->values[i].vallen); php_printf(""); @@ -2315,7 +2364,7 @@ if(ODBCG(check_persistent)){ RETCODE ret; UCHAR d_name[32]; - SWORD len; + SQLSMALLINT len; ret = SQLGetInfo(db_conn->hdbc, SQL_DATA_SOURCE_READ_ONLY, @@ -2431,7 +2480,7 @@ PHP_FUNCTION(odbc_num_rows) { odbc_result *result; - SDWORD rows; + SQLLEN rows; zval **pv_res; if (zend_get_parameters_ex(1, &pv_res) == FAILURE) { @@ -2547,7 +2596,7 @@ { odbc_result *result; char tmp[32]; - SWORD tmplen; + SQLSMALLINT tmplen; zval **pv_res, **pv_num; if (zend_get_parameters_ex(2, &pv_res, &pv_num) == FAILURE) { @@ -2573,7 +2622,7 @@ RETURN_FALSE; } - SQLColAttributes(result->stmt, (UWORD)Z_LVAL_PP(pv_num), + SQLColAttributes(result->stmt, (SQLUSMALLINT)Z_LVAL_PP(pv_num), SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL); RETURN_STRING(tmp,1) } @@ -2667,7 +2716,7 @@ } RETVAL_TRUE; } else { - SDWORD status; + SQLINTEGER status; rc = SQLGetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, (PTR)&status); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { @@ -2898,7 +2947,7 @@ odbc_result *result = NULL; odbc_connection *conn; char *cat = NULL, *schema = NULL, *table = NULL, *column = NULL; - SWORD cat_len=0, schema_len=0, table_len=0, column_len=0; + SQLSMALLINT cat_len=0, schema_len=0, table_len=0, column_len=0; RETCODE rc; int argc; @@ -3157,7 +3206,7 @@ odbc_connection *conn; RETCODE rc; int argc; - SWORD data_type = SQL_ALL_TYPES; + SQLSMALLINT data_type = SQL_ALL_TYPES; argc = ZEND_NUM_ARGS(); if (argc == 1) { @@ -3169,7 +3218,7 @@ WRONG_PARAM_COUNT; } convert_to_long_ex(pv_data_type); - data_type = (SWORD) Z_LVAL_PP(pv_data_type); + data_type = (SQLSMALLINT) Z_LVAL_PP(pv_data_type); } else { WRONG_PARAM_COUNT; } @@ -3453,8 +3502,8 @@ odbc_result *result = NULL; odbc_connection *conn; char *cat = NULL, *schema = NULL, *name = NULL; - UWORD type; - UWORD scope, nullable; + SQLUSMALLINT type; + SQLUSMALLINT scope, nullable; RETCODE rc; int argc; @@ -3465,7 +3514,7 @@ WRONG_PARAM_COUNT; } convert_to_long_ex(pv_type); - type = (UWORD) Z_LVAL_PP(pv_type); + type = (SQLUSMALLINT) Z_LVAL_PP(pv_type); convert_to_string_ex(pv_cat); cat = Z_STRVAL_PP(pv_cat); convert_to_string_ex(pv_schema); @@ -3473,9 +3522,9 @@ convert_to_string_ex(pv_name); name = Z_STRVAL_PP(pv_name); convert_to_long_ex(pv_scope); - scope = (UWORD) Z_LVAL_PP(pv_scope); + scope = (SQLUSMALLINT) Z_LVAL_PP(pv_scope); convert_to_long_ex(pv_nullable); - nullable = (UWORD) Z_LVAL_PP(pv_nullable); + nullable = (SQLUSMALLINT) Z_LVAL_PP(pv_nullable); } else { WRONG_PARAM_COUNT; } @@ -3537,7 +3586,7 @@ odbc_result *result = NULL; odbc_connection *conn; char *cat = NULL, *schema = NULL, *name = NULL; - UWORD unique, reserved; + SQLUSMALLINT unique, reserved; RETCODE rc; int argc; @@ -3554,9 +3603,9 @@ convert_to_string_ex(pv_name); name = Z_STRVAL_PP(pv_name); convert_to_long_ex(pv_unique); - unique = (UWORD) Z_LVAL_PP(pv_unique); + unique = (SQLUSMALLINT) Z_LVAL_PP(pv_unique); convert_to_long_ex(pv_reserved); - reserved = (UWORD) Z_LVAL_PP(pv_reserved); + reserved = (SQLUSMALLINT) Z_LVAL_PP(pv_reserved); } else { WRONG_PARAM_COUNT; } Index: php_odbc_includes.h =================================================================== RCS file: /repository/php-src/ext/odbc/php_odbc_includes.h,v retrieving revision 1.12.2.1.2.4 diff -u -r1.12.2.1.2.4 php_odbc_includes.h --- php_odbc_includes.h 13 Mar 2007 00:04:38 -0000 1.12.2.1.2.4 +++ php_odbc_includes.h 20 Dec 2007 16:52:58 -0000 @@ -230,15 +234,15 @@ typedef struct odbc_result_value { char name[32]; char *value; - SDWORD vallen; - SDWORD coltype; + SQLLEN vallen; + SQLLEN coltype; } odbc_result_value; typedef struct odbc_result { ODBC_SQL_STMT_T stmt; odbc_result_value *values; - SWORD numcols; - SWORD numparams; + SQLSMALLINT numcols; + SQLSMALLINT numparams; # if HAVE_SQL_EXTENDED_FETCH int fetch_abs; # endif --------------090202030800000101010107--