? lou_patch.diff Index: config.m4 =================================================================== RCS file: /repository/pecl/pdo_ibm/config.m4,v retrieving revision 1.5 diff -u -p -r1.5 config.m4 --- config.m4 2 Apr 2008 20:54:27 -0000 1.5 +++ config.m4 10 Jul 2008 11:47:25 -0000 @@ -72,14 +72,19 @@ if test "$PHP_PDO_IBM" != "no"; then PHP_ADD_INCLUDE($PDO_IBM_DIR/include) PHP_ADD_LIBPATH($LIB_DIR, PDO_IBM_SHARED_LIBADD) - PHP_ADD_LIBRARY(db2, 1, PDO_IBM_SHARED_LIBADD) + if test -r $LIB_DIR/libdb400.a ; then + PHP_ADD_LIBRARY(db400, 1, PDO_IBM_SHARED_LIBADD) + PHP_NEW_EXTENSION(pdo_ibm, $php_pdo_ibm_sources_core, $ext_shared,,-I$pdo_inc_path -DPASE) + else + PHP_ADD_LIBRARY(db2, 1, PDO_IBM_SHARED_LIBADD) + PHP_NEW_EXTENSION(pdo_ibm, $php_pdo_ibm_sources_core, $ext_shared,,-I$pdo_inc_path) + fi case "$host_alias" in *aix*) CPPFLAGS="$CPPFLAGS -D__H_LOCALEDEF";; esac - PHP_NEW_EXTENSION(pdo_ibm, $php_pdo_ibm_sources_core, $ext_shared,,-I$pdo_inc_path) ifdef([PHP_ADD_EXTENSION_DEP], [ Index: ibm_driver.c =================================================================== RCS file: /repository/pecl/pdo_ibm/ibm_driver.c,v retrieving revision 1.11 diff -u -p -r1.11 ibm_driver.c --- ibm_driver.c 18 Apr 2008 18:03:25 -0000 1.11 +++ ibm_driver.c 10 Jul 2008 11:47:25 -0000 @@ -61,7 +61,11 @@ static int dbh_prepare_stmt(pdo_dbh_t *d stmt_handle *stmt_res = (stmt_handle *) stmt->driver_data; int rc; SQLSMALLINT param_count; +#ifndef PASE UCHAR server_info[30]; +#else + unsigned char server_info[30]; +#endif SQLSMALLINT server_len = 0; /* in case we need to convert the statement for positional syntax */ @@ -151,7 +155,8 @@ static int dbh_prepare_stmt(pdo_dbh_t *d * 0r.01.0000 * where r is the major version */ - rc = SQLGetInfo(conn_res->hdbc, SQL_DBMS_VER, &server_info, + memset(server_info, 0, sizeof(server_info)); + rc = SQLGetInfo(conn_res->hdbc, SQL_DBMS_VER, (SQLPOINTER)server_info, sizeof(server_info), &server_len); /* making char numbers into integers eg. "10" --> 10 or "09" --> 9 */ stmt_res->server_ver = ((server_info[0] - '0')*100) + ((server_info[1] - '0')*10) + (server_info[3] - '0'); @@ -320,8 +325,14 @@ static long ibm_handle_doer( static int ibm_handle_begin( pdo_dbh_t *dbh TSRMLS_DC) { conn_handle *conn_res = (conn_handle *) dbh->driver_data; +#ifndef PASE int rc = SQLSetConnectAttr(conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_OFF, SQL_NTS); +#else + SQLINTEGER autocommit = SQL_AUTOCOMMIT_OFF; + int rc = SQLSetConnectAttr(conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, + (SQLPOINTER) &autocommit, SQL_NTS); +#endif check_dbh_error(rc, "SQLSetConnectAttr"); return TRUE; } @@ -335,8 +346,14 @@ static int ibm_handle_commit( int rc = SQLEndTran(SQL_HANDLE_DBC, conn_res->hdbc, SQL_COMMIT); check_dbh_error(rc, "SQLEndTran"); if (dbh->auto_commit != 0) { +#ifndef PASE rc = SQLSetConnectAttr(conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_ON, SQL_NTS); +#else + SQLINTEGER autocommit = SQL_AUTOCOMMIT_ON; + rc = SQLSetConnectAttr(conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, + (SQLPOINTER) &autocommit, SQL_NTS); +#endif check_dbh_error(rc, "SQLSetConnectAttr"); } return TRUE; @@ -351,8 +368,14 @@ static int ibm_handle_rollback( int rc = SQLEndTran(SQL_HANDLE_DBC, conn_res->hdbc, SQL_ROLLBACK); check_dbh_error(rc, "SQLEndTran"); if (dbh->auto_commit != 0) { +#ifndef PASE rc = SQLSetConnectAttr(conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_ON, SQL_NTS); +#else + SQLINTEGER autocommit = SQL_AUTOCOMMIT_ON; + rc = SQLSetConnectAttr(conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, + (SQLPOINTER) &autocommit, SQL_NTS); +#endif check_dbh_error(rc, "SQLSetConnectAttr"); } return TRUE; @@ -373,12 +396,24 @@ static int ibm_handle_set_attribute( if (dbh->auto_commit != Z_LVAL_P(return_value)) { dbh->auto_commit = Z_LVAL_P(return_value); if (dbh->auto_commit == TRUE) { +#ifndef PASE rc = SQLSetConnectAttr((SQLHDBC) conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_ON, SQL_NTS); +#else + SQLINTEGER autocommit = SQL_AUTOCOMMIT_ON; + rc = SQLSetConnectAttr((SQLHDBC) conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, + (SQLPOINTER) &autocommit, SQL_NTS); +#endif check_dbh_error(rc, "SQLSetConnectAttr"); } else { +#ifndef PASE rc = SQLSetConnectAttr((SQLHDBC) conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_OFF, SQL_NTS); +#else + SQLINTEGER autocommit = SQL_AUTOCOMMIT_OFF; + rc = SQLSetConnectAttr((SQLHDBC) conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, + (SQLPOINTER) &autocommit, SQL_NTS); +#endif check_dbh_error(rc, "SQLSetConnectAttr"); } } @@ -589,6 +624,7 @@ static int ibm_handle_get_attribute( return FALSE; } +#ifndef PASE static int ibm_handle_check_liveness( pdo_dbh_t *dbh TSRMLS_DC) @@ -609,6 +645,7 @@ static int ibm_handle_check_liveness( return dead_flag == SQL_CD_FALSE ? SUCCESS : FAILURE; } +#endif static struct pdo_dbh_methods ibm_dbh_methods = { ibm_handle_closer, @@ -622,7 +659,11 @@ static struct pdo_dbh_methods ibm_dbh_me ibm_handle_lastInsertID, ibm_handle_fetch_error, ibm_handle_get_attribute, +#ifndef PASE ibm_handle_check_liveness, +#else + NULL, +#endif NULL /* get_driver_methods */ }; @@ -644,14 +685,29 @@ static int dbh_connect(pdo_dbh_t *dbh, z memset((void *) conn_res, '\0', sizeof(conn_handle)); dbh->driver_data = conn_res; - /* we need an environment to use for a base */ - rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &conn_res->henv); +#ifndef PASE /* i5/OS difference */ + rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &(conn_res->henv)); check_dbh_error(rc, "SQLAllocHandle"); +#else /* PASE */ + { + rc = SQLAllocEnv(&(conn_res->henv)); + if ( rc == SQL_ERROR ) { + check_dbh_error(rc, "SQLAllocHandle"); + } + } +#endif /* PASE */ +#ifndef PASE /* and we're using the OBDC version 3 style interface */ rc = SQLSetEnvAttr((SQLHENV)conn_res->henv, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); check_dbh_error(rc, "SQLSetEnvAttr"); +#else + if (dbh->username != NULL) { + long attr = SQL_TRUE; + SQLSetEnvAttr((SQLHENV)conn_res->henv, SQL_ATTR_SERVER_MODE, &attr, 0); + } +#endif /* now an actual connection handle */ rc = SQLAllocHandle(SQL_HANDLE_DBC, conn_res->henv, &(conn_res->hdbc)); @@ -664,6 +720,7 @@ static int dbh_connect(pdo_dbh_t *dbh, z * reform var_dump($rows);atting the DSN string to include a userid and * password. */ +#ifndef PASE if (strchr(dbh->data_source, '=') != NULL) { /* first check to see if we have a user name */ if (dbh->username != NULL && dbh->password != NULL) { @@ -696,7 +753,12 @@ static int dbh_connect(pdo_dbh_t *dbh, z (SQLCHAR *) dbh->data_source, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT); check_dbh_error(rc, "SQLDriverConnect"); - } else { + } else +#endif + + + { + /* Make sure each of the connection parameters is not NULL */ if (dbh->data_source) { d_length = strlen(dbh->data_source); @@ -711,6 +773,7 @@ static int dbh_connect(pdo_dbh_t *dbh, z * No connection options specified, we can just connect with the name, * userid, and password as given. */ + rc = SQLConnect((SQLHDBC) conn_res->hdbc, (SQLCHAR *) dbh->data_source, (SQLSMALLINT) d_length, (SQLCHAR *) dbh->username, @@ -722,6 +785,7 @@ static int dbh_connect(pdo_dbh_t *dbh, z /* if we're in auto commit mode, set the connection attribute. */ +#ifndef PASE if (dbh->auto_commit != 0) { rc = SQLSetConnectAttr((SQLHDBC) conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_ON, SQL_NTS); @@ -731,6 +795,13 @@ static int dbh_connect(pdo_dbh_t *dbh, z (SQLPOINTER) SQL_AUTOCOMMIT_OFF, SQL_NTS); check_dbh_error(rc, "SQLSetConnectAttr"); } +#else + { + SQLINTEGER auto_commit; + auto_commit = dbh->auto_commit != 0 ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF; + rc = SQLSetConnectAttr((SQLHDBC)conn_res->hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER)(&auto_commit), SQL_NTS); + } +#endif /* set the desired case to be upper */ dbh->desired_case = PDO_CASE_UPPER; Index: ibm_statement.c =================================================================== RCS file: /repository/pecl/pdo_ibm/ibm_statement.c,v retrieving revision 1.10 diff -u -p -r1.10 ibm_statement.c --- ibm_statement.c 2 Apr 2008 20:50:32 -0000 1.10 +++ ibm_statement.c 10 Jul 2008 11:47:26 -0000 @@ -31,6 +31,15 @@ #include "php_pdo_ibm.h" #include "php_pdo_ibm_int.h" +#ifdef PASE +# define SQL_LEN_DATA_AT_EXEC(length) length +#else +# if !defined(SQL_LEN_DATA_AT_EXEC) && !defined(SQL_LEN_DATA_AT_EXEC_OFFSET) +# define SQL_LEN_DATA_AT_EXEC_OFFSET (-100) +# define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET) +# endif +#endif + struct lob_stream_data { stmt_handle *stmt_res; @@ -38,6 +47,31 @@ struct lob_stream_data int colno; }; +#ifdef PASE +static int get_lob_length(pdo_stmt_t *stmt, column_data *col_res,long *sLength ) +{ + SQLRETURN rc = 0; + SQLHANDLE new_hstmt; + conn_handle *conn_res = (conn_handle *)stmt->dbh->driver_data; + + rc = SQLAllocHandle(SQL_HANDLE_STMT, conn_res->hdbc, &new_hstmt); + if (rc != SQL_SUCCESS) { + return rc; + } + + rc = SQLGetLength((SQLHSTMT)new_hstmt, + col_res->loc_type, + col_res->lob_loc, + sLength, + &col_res->loc_ind); + + check_stmt_error(rc, "SQLGetLength"); + + SQLFreeHandle(SQL_HANDLE_STMT, new_hstmt); + return rc; +} +#endif + size_t lob_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) { SQLINTEGER readBytes = 0; @@ -47,25 +81,67 @@ size_t lob_stream_read(php_stream *strea pdo_stmt_t *stmt = data->stmt; int ctype = 0; SQLRETURN rc = 0; + long sLength; + int databuf_count = 0; switch (col_res->data_type) { default: +#ifndef PASE case SQL_LONGVARCHAR: +#endif ctype = SQL_C_CHAR; break; +#ifndef PASE case SQL_LONGVARBINARY: +#endif +#ifdef PASE +/* string type required for the ascii->ebcdic conversion */ + case SQL_CLOB: + ctype= SQL_CLOB; + break; +#endif case SQL_VARBINARY: case SQL_BINARY: case SQL_BLOB: +#ifndef PASE case SQL_CLOB: +#endif case SQL_XML: ctype = SQL_C_BINARY; break; } +#ifdef PASE + if (buf == NULL) { + rc = get_lob_length(stmt, col_res, &sLength); + if (rc != SQL_ERROR && sLength > 0) { + col_res->lob_data_length = sLength; + databuf_count = sizeof(char ) * sLength; + col_res->lob_data = emalloc(databuf_count); + + rc = SQLGetData(stmt_res->hstmt, data->colno + 1, ctype, col_res->lob_data, databuf_count, &readBytes); + check_stmt_error(rc, "SQLGetData"); + col_res->lob_data_offset = 0; + } + } else { + readBytes = MIN(count, col_res->lob_data_length - col_res->lob_data_offset); + if (readBytes > 0) { + memcpy( buf, col_res->lob_data + col_res->lob_data_offset, readBytes); + col_res->lob_data_offset +=readBytes; + } + } + + if (readBytes <= 0) { + readBytes = -1; + if (buf != NULL) { + /* EOF reached */ + stream->eof = 1; + } + } +#else rc = SQLGetData(stmt_res->hstmt, data->colno + 1, ctype, buf, count, &readBytes); + check_stmt_error(rc, "SQLGetData"); - if (readBytes == -1) { /*For NULL CLOB/BLOB values */ return (size_t) readBytes; } @@ -75,7 +151,9 @@ size_t lob_stream_read(php_stream *strea } else { readBytes = count; } + } +#endif return (size_t) readBytes; } @@ -147,6 +225,10 @@ static void stmt_free_column_descriptors if (stmt_res->columns[i].returned_type == PDO_PARAM_STR) { efree(stmt_res->columns[i].data.str_val); } + + if (stmt_res->columns[i].returned_type == PDO_PARAM_LOB) { + efree(stmt_res->columns[i].lob_data); + } } /* free the entire column list. */ @@ -225,7 +307,9 @@ static int stmt_get_parameter_info(pdo_s case SQL_CLOB: case SQL_XML: case SQL_VARBINARY: +#ifndef PASE case SQL_LONGVARBINARY: +#endif param_res->ctype = SQL_C_BINARY; break; @@ -258,6 +342,9 @@ int stmt_bind_parameter(pdo_stmt_t *stmt stmt_handle *stmt_res = (stmt_handle *) stmt->driver_data; param_node *param_res = NULL; SQLSMALLINT inputOutputType; +#ifdef PASE + char *data_buf = NULL; +#endif /* make sure we have current description information. */ if (stmt_get_parameter_info(stmt, curr TSRMLS_CC) == FALSE) { @@ -440,15 +527,35 @@ int stmt_bind_parameter(pdo_stmt_t *stmt /* transfer this as character data. */ param_res->ctype = SQL_C_CHAR; } +#ifndef PASE if (param_res->data_type == SQL_BLOB || - param_res->data_type == SQL_XML || - param_res->data_type == SQL_CLOB) { + param_res->data_type == SQL_XML || + param_res->data_type == SQL_CLOB) { /* transfer this as binary data. */ param_res->ctype = SQL_C_BINARY; } - +#else + if (param_res->data_type == SQL_CLOB) { + param_res->ctype = SQL_CLOB; + } else { + param_res->ctype = SQL_C_BINARY; + } +#endif /* indicate we're going to transfer the data at exec time. */ +#ifndef PASE param_res->transfer_length = SQL_DATA_AT_EXEC; +#else + if (Z_TYPE_P(curr->parameter) == IS_RESOURCE) { + param_res->transfer_length = SQL_DATA_AT_EXEC; + data_buf = (char *)curr; + } else { + param_res->transfer_length = SQL_LEN_DATA_AT_EXEC(Z_STRLEN_P(curr->parameter)); + /* get the pointer to the string data */ + data_buf = Z_STRVAL_P(curr->parameter); + /* to cause a conversion to ebcdic */ + } +#endif + /* * We can't bind LOBs at this point...we process all @@ -459,15 +566,20 @@ int stmt_bind_parameter(pdo_stmt_t *stmt * at that time by using SQLParamData(), and we can * then process the request. */ + rc = SQLBindParameter(stmt_res->hstmt, curr->paramno + 1, inputOutputType, param_res->ctype, param_res->data_type, param_res->param_size, param_res->scale, - (SQLPOINTER) curr, 4096, +#ifndef PASE + (SQLPOINTER) curr, +#else + (SQLPOINTER) data_buf, +#endif + 4096, ¶m_res->transfer_length); check_stmt_error(rc, "SQLBindParameter"); return TRUE; - /* this is an unknown type */ default: RAISE_IBM_STMT_ERROR( "IM001", "SQLBindParameter", "Unknown parameter type" ); @@ -515,12 +627,14 @@ static int stmt_parameter_pre_execute(pd * Yes, we're able to give the statement some * hints about the size. */ +#ifndef PASE param_res->transfer_length = SQL_LEN_DATA_AT_EXEC(sb.sb.st_size); +#endif } else { /* - * Still unknown...we'll have to do everything - * at execute size. - */ + * Still unknown...we'll have to do everything + * at execute size. + */ param_res->transfer_length = SQL_LEN_DATA_AT_EXEC(0); } } else { @@ -596,8 +710,10 @@ static int stmt_bind_column(pdo_stmt_t * col = &stmt->columns[colno]; switch (col_res->data_type) { +#ifndef PASE case SQL_LONGVARCHAR: case SQL_LONGVARBINARY: +#endif case SQL_VARBINARY: case SQL_BINARY: case SQL_BLOB: @@ -609,6 +725,23 @@ static int stmt_bind_column(pdo_stmt_t * /* and this is returned as a stream */ col_res->returned_type = PDO_PARAM_LOB; col->param_type = PDO_PARAM_LOB; + col_res->lob_loc = 0; + if(col_res->data_type == SQL_CLOB) { + col_res->loc_type = SQL_CLOB_LOCATOR; + } else { + col_res->loc_type = SQL_BLOB_LOCATOR; + } + + col_res->loc_ind = 0; + col_res->lob_data_length = 0; + col_res->lob_data_offset = 0; + col_res->lob_data = NULL; + rc = SQLBindCol( (SQLHSTMT) stmt_res->hstmt, + (SQLUSMALLINT) (colno + 1), + col_res->loc_type, + &col_res->lob_loc, + 4, + &col_res->loc_ind); } break; /* @@ -842,6 +975,14 @@ static int ibm_stmt_fetcher( SQLSMALLINT direction = SQL_FETCH_NEXT; int rc = 0; +#ifdef PASE /* i5/OS problem with SQL_FETCH out_length */ + int i; + + for (i = 0; i < stmt->column_count; i++) { + stmt_res->columns[i].out_length = 0; + } +#endif + /* convert the PDO orientation information to the SQL one */ switch (ori) { case PDO_FETCH_ORI_NEXT: @@ -864,8 +1005,19 @@ static int ibm_stmt_fetcher( break; } - /* go fetch it. */ - rc = SQLFetchScroll(stmt_res->hstmt, direction, (SQLINTEGER) offset); +#ifdef PASE /* i5/OS problem with SQL_FETCH_ABSOLUTE */ + if (direction == SQL_FETCH_ABSOLUTE) { + rc = SQLFetchScroll((SQLHSTMT)stmt_res->hstmt, SQL_FETCH_FIRST, (SQLINTEGER)offset); + if (offset > 1 && (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)) { + rc = SQLFetchScroll((SQLHSTMT)stmt_res->hstmt, SQL_FETCH_RELATIVE, (SQLINTEGER)offset - 1); + } + } else { + rc = SQLFetchScroll((SQLHSTMT)stmt_res->hstmt, direction, (SQLINTEGER)offset); + } +#else + rc = SQLFetchScroll((SQLHSTMT)stmt_res->hstmt, direction, (SQLINTEGER)offset); +#endif + check_stmt_error(rc, "SQLFetchScroll"); /* @@ -970,10 +1122,14 @@ static int ibm_stmt_describer( &col_res->scale, &col_res->nullable); check_stmt_error(rc, "SQLDescribeCol"); +#ifndef PASE rc = SQLColAttribute(stmt_res->hstmt, colno+1, SQL_DESC_DISPLAY_SIZE, NULL, 0, NULL, &col_res->data_size); check_stmt_error(rc, "SQLColAttribute"); - +#else + rc = SQLColAttributes((SQLHSTMT)stmt_res->hstmt,(SQLSMALLINT)colno+1,SQL_DESC_DISPLAY_SIZE,NULL,0,NULL,&col_res->data_size); + check_stmt_error(rc, "SQLColAttributes"); +#endif /* * Make sure we get a name properly. If the name is too long for our * buffer (which in theory should never happen), allocate a longer one @@ -1034,7 +1190,7 @@ static int ibm_stmt_get_col( } else { *ptr = NULL; } - *len = 0; + *len = 0; } /* see if this is a null value */ else if (col_res->out_length == SQL_NULL_DATA) { @@ -1042,6 +1198,22 @@ static int ibm_stmt_get_col( *ptr = NULL; *len = 0; } + /* see if length is SQL_NTS ("count the length yourself"-value) */ + else if (col_res->out_length == SQL_NTS) { + if (col_res->data.str_val && col_res->data.str_val[0] != '\0') { + /* it's not an empty string */ + *ptr = col_res->data.str_val; + *len = strlen(col_res->data.str_val); + } else if (col_res->data.str_val && col_res->data.str_val[0] == '\0') { + /* it's an empty string */ + *ptr = col_res->data.str_val; + *len = 0; + } else { + /* it's NULL */ + *ptr = NULL; + *len = 0; + } + } /* string type...very common */ else if (col_res->returned_type == PDO_PARAM_STR) { /* set the info */ @@ -1057,9 +1229,7 @@ static int ibm_stmt_get_col( } /* step to the next result set of the query. */ -static int ibm_stmt_next_rowset( - pdo_stmt_t *stmt - TSRMLS_DC) +static int ibm_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) { stmt_handle *stmt_res = (stmt_handle *) stmt->driver_data; @@ -1125,6 +1295,7 @@ static int ibm_stmt_get_column_meta( add_assoc_long(return_value, "scale", col_res->scale); /* see if we can retrieve the table name */ +#ifndef PASE if (SQLColAttribute (stmt_res->hstmt, colno + 1, SQL_DESC_BASE_TABLE_NAME, (SQLPOINTER) attribute_buffer, ATTRIBUTEBUFFERSIZE, &length, (SQLPOINTER) & numericAttribute) != SQL_ERROR) { @@ -1136,32 +1307,44 @@ static int ibm_stmt_get_column_meta( add_assoc_stringl(return_value, "table", attribute_buffer, length, 1); } } +#endif /* see if we can retrieve the type name */ +#ifndef PASE if (SQLColAttribute(stmt_res->hstmt, colno + 1, SQL_DESC_TYPE_NAME, (SQLPOINTER) attribute_buffer, ATTRIBUTEBUFFERSIZE, &length, (SQLPOINTER) & numericAttribute) != SQL_ERROR) { add_assoc_stringl(return_value, "native_type", attribute_buffer, length, 1); } +#else + if (SQLColAttributes(stmt_res->hstmt, colno + 1, SQL_DESC_TYPE_NAME, + (SQLPOINTER) attribute_buffer, ATTRIBUTEBUFFERSIZE, (SQLPOINTER)&length, + (SQLPOINTER) & numericAttribute) != SQL_ERROR) { + add_assoc_stringl(return_value, "native_type", attribute_buffer, length, 1); + } +#endif MAKE_STD_ZVAL(flags); array_init(flags); add_assoc_bool(flags, "not_null", !col_res->nullable); /* see if we can retrieve the unsigned attribute */ +#ifndef PASE if (SQLColAttribute(stmt_res->hstmt, colno + 1, SQL_DESC_UNSIGNED, (SQLPOINTER) attribute_buffer, ATTRIBUTEBUFFERSIZE, &length, (SQLPOINTER) & numericAttribute) != SQL_ERROR) { add_assoc_bool(flags, "unsigned", numericAttribute == SQL_TRUE); } +#endif /* see if we can retrieve the autoincrement attribute */ +#ifndef PASE if (SQLColAttribute (stmt_res->hstmt, colno + 1, SQL_DESC_AUTO_UNIQUE_VALUE, (SQLPOINTER) attribute_buffer, ATTRIBUTEBUFFERSIZE, &length, (SQLPOINTER) & numericAttribute) != SQL_ERROR) { add_assoc_bool(flags, "auto_increment", numericAttribute == SQL_TRUE); } - +#endif /* add the flags to the result bundle. */ add_assoc_zval(return_value, "flags", flags); Index: php_pdo_ibm_int.h =================================================================== RCS file: /repository/pecl/pdo_ibm/php_pdo_ibm_int.h,v retrieving revision 1.5 diff -u -p -r1.5 php_pdo_ibm_int.h --- php_pdo_ibm_int.h 6 Aug 2007 15:24:33 -0000 1.5 +++ php_pdo_ibm_int.h 10 Jul 2008 11:47:26 -0000 @@ -138,7 +138,17 @@ typedef struct { SQLSMALLINT nullable; /* the nullable flag */ SQLSMALLINT scale; /* the scale value */ SQLUINTEGER out_length; /* the transfered data length. Filled in by a fetch */ + +#ifdef PASE + SQLINTEGER lob_loc; + SQLINTEGER loc_ind; + SQLINTEGER loc_type; + SQLUINTEGER lob_data_length; + SQLUINTEGER lob_data_offset; /* fetched blob part*/ + char *lob_data; +#endif column_data_value data; /* the transferred data */ + } column_data; /* size of the buffer used to read LOB streams */