CVS update: php3/functions

From: Date: Sun, 13 Sep 1998 20:43:27 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-1038@lists.php.net to get a copy of this message
Date: Sunday September 13, 1998 @ 16:43 Author: danny Update of /repository/php3/functions In directory asf:/u2/tmp/cvs-serv11667/functions Modified Files: ifx.ec php3_ifx.h Log Message: - ifx_error and ifx_errormsg now should always return correct SQLCODE value - ifx_affected_rows works again for non-select type queries Index: php3/functions/ifx.ec diff -c php3/functions/ifx.ec:1.15 php3/functions/ifx.ec:1.16 *** php3/functions/ifx.ec:1.15 Fri Sep 11 07:10:48 1998 --- php3/functions/ifx.ec Sun Sep 13 16:43:26 1998 *************** *** 23,35 **** | If you did not, or have any questions about PHP licensing, please | | contact core@php.net. | +----------------------------------------------------------------------+ ! | Author: Danny Heijl <Danny.Heijl@cevi.be> | | Based on the MySQL code by: Zeev Suraski <bourbon@netvision.net.il> | +----------------------------------------------------------------------+ */ /* ------------------------------------------------------------------- * if you want a function reference : "grep '^\*\*' ifx.ec" will give ! * you a short one * ------------------------------------------------------------------- */ /* --- 23,37 ---- | If you did not, or have any questions about PHP licensing, please | | contact core@php.net. | +----------------------------------------------------------------------+ ! | Authors: Danny Heijl <Danny.Heijl@cevi.be> : initial cut (ODS 7.2x) | ! | Christian Cartus <chc@idgruppe.de> : blobs, and IUS 9 | ! | Jouni Ahto <jah@guru.cultnet.fi> : configuration stuff | | Based on the MySQL code by: Zeev Suraski <bourbon@netvision.net.il> | +----------------------------------------------------------------------+ */ /* ------------------------------------------------------------------- * if you want a function reference : "grep '^\*\*' ifx.ec" will give ! * you a very short one * ------------------------------------------------------------------- */ /* *************** *** 48,60 **** * * ? Safe mode implementation * ! * cursory stored procedures ? ! * blob updates ! * ! * UDS 9.X support will be added in cooperation with Christian Cartus ! * with lots of other good stuff he had already done before in his own ! * driver version (Christian Cartus <chc@idgruppe.de>). ! * Jouni Ahto also has promised help and already did the configuration stuff * (Jouni Ahto <jah@guru.cultnet.fi>). * */ --- 50,57 ---- * * ? Safe mode implementation * ! * ? cursory stored procedures ! * Jouni Ahto promised help and already did the configuration stuff * (Jouni Ahto <jah@guru.cultnet.fi>). * */ *************** *** 248,254 **** } } ! return _ifx_check; } static char *ifx_error(ifx) --- 245,251 ---- } } ! return _ifx_check; } static char *ifx_error(ifx) *************** *** 258,264 **** { char *ifx_err_msg; char c; ! switch (ifx_check()) { case IFX_SUCCESS: c = ' '; --- 255,267 ---- { char *ifx_err_msg; char c; ! int errorcode; ! ! if (Informix_GLOBAL(php3_ifx_module).sv_sqlcode == 0) ! errorcode = SQLCODE; ! else ! errorcode = Informix_GLOBAL(php3_ifx_module).sv_sqlcode; ! switch (ifx_check()) { case IFX_SUCCESS: c = ' '; *************** *** 284,290 **** SQLSTATE[2], SQLSTATE[3], SQLSTATE[4], ! SQLCODE); return(ifx_err_msg); } --- 287,293 ---- SQLSTATE[2], SQLSTATE[3], SQLSTATE[4], ! errorcode); return(ifx_err_msg); } *************** *** 394,399 **** --- 397,403 ---- Informix_GLOBAL(php3_ifx_module).default_password=NULL; } Informix_GLOBAL(php3_ifx_module).num_persistent=0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode=0; Informix_GLOBAL(php3_ifx_module).le_result = register_list_destructors(ifx_free_result,NULL); Informix_GLOBAL(php3_ifx_module).le_blobresult = *************** *** 579,586 **** } - if (!Informix_GLOBAL(php3_ifx_module).allow_persistent) { persistent=0; } --- 583,590 ---- } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; if (!Informix_GLOBAL(php3_ifx_module).allow_persistent) { persistent=0; } *************** *** 622,627 **** --- 626,632 ---- WITH CONCURRENT TRANSACTION; if (ifx_check() == IFX_ERROR) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,ifx_error(ifx)); free(ifx); efree(hashed_details); *************** *** 655,660 **** --- 660,666 ---- WITH CONCURRENT TRANSACTION; if (ifx_check() == IFX_ERROR) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING, "Informix: Link to server lost, unable to reconnect (%s)", ifx_error(ifx)); *************** *** 717,722 **** --- 723,729 ---- USER :user USING :passwd WITH CONCURRENT TRANSACTION; if (ifx_check() == IFX_ERROR) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"ifx_pconnect : %s", ifx_error(ifx)); efree(hashed_details); efree(ifx); *************** *** 790,795 **** --- 797,803 ---- Informix_TLS_VARS; + switch (ARG_COUNT(ht)) { case 0: *************** *** 807,812 **** --- 815,822 ---- break; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + ifx = (char *) php3_list_find(id,&type); if (type!=Informix_GLOBAL(php3_ifx_module).le_link && type!=Informix_GLOBAL(php3_ifx_module).le_plink) { *************** *** 826,842 **** } /* ---------------------------------------------------------------------- ! ** int ifx_query(string $query, int $connid, [string $hold, [string $scroll]],[blobidarray]) ** ** executes query $query on connection $connid ** for select queries a cursor is declared and opened ** non-select queries are "execute immediate" ** select queries accept 2 optional params : "SCROLL" and/or "HOLD" ! ** blobsupport: mark the blob-column with ? and add a blob-id-array-functionparameter ! ** example: ifx_query'insert into catalog (stock_num, manu_code,cat_descr,cat_picture) values(1,"HRO",?,?)',$cid,$bidarray); ** ** returns a "result id" on success or FALSE on error ! ** also sets "affected_rows for retrieval by ifx_affected_rows ** ---------------------------------------------------------------------- */ --- 836,856 ---- } /* ---------------------------------------------------------------------- ! ** int ifx_query(string $query, int $connid, ! ** string $hold, string $scroll, $blobidarray) ! ** $hold, $croll, and $blobidarray are optional ** ** executes query $query on connection $connid ** for select queries a cursor is declared and opened ** non-select queries are "execute immediate" ** select queries accept 2 optional params : "SCROLL" and/or "HOLD" ! ** blobsupport: mark the blob-column(s) with ? in the query and add ! ** a blob-id-array-functionparameter ! ** example: ifx_query("insert into catalog (stock_num, manu_code, ! ** cat_descr,cat_picture) values(1,'HRO',?,?)",$cid,$bidarray); ** ** returns a "result id" on success or FALSE on error ! ** also sets "affected_rows for retrieval by ifx_affected_rows() ** ---------------------------------------------------------------------- */ *************** *** 856,862 **** int i; /* field index */ short fieldtype; loc_t *locator; ! int loc_t_type=CLOCATORTYPE; /* WORKAROUND: TYPE=CLOCATORTYPE doesn't work, don't ask me, why. */ EXEC SQL END DECLARE SECTION; char *blobfilename; --- 870,877 ---- int i; /* field index */ short fieldtype; loc_t *locator; ! int loc_t_type=CLOCATORTYPE; /* WORKAROUND:TYPE=CLOCATORTYPE doesn't work, ! don't ask me, why. */ EXEC SQL END DECLARE SECTION; char *blobfilename; *************** *** 866,876 **** Informix_TLS_VARS; - if(ARG_COUNT(ht)<2) { WRONG_PARAM_COUNT; } /* get the first 2 parameters */ if (getParameters(ht, 2, &query, &ifx_link)==FAILURE) { RETURN_FALSE; --- 881,892 ---- Informix_TLS_VARS; if(ARG_COUNT(ht)<2) { WRONG_PARAM_COUNT; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + /* get the first 2 parameters */ if (getParameters(ht, 2, &query, &ifx_link)==FAILURE) { RETURN_FALSE; *************** *** 878,887 **** convert_to_long(ifx_link); id = ifx_link->value.lval; - - - - ifx = (char *) php3_list_find(id,&type); if (type != Informix_GLOBAL(php3_ifx_module).le_link && type!=Informix_GLOBAL(php3_ifx_module).le_plink) { --- 894,899 ---- *************** *** 904,909 **** --- 916,922 ---- EXEC SQL set connection :ifx; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); *************** *** 911,916 **** --- 924,930 ---- } EXEC SQL PREPARE :statemid FROM :statement; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Prepare fails (%s)", ifx_error(ifx)); RETURN_FALSE; *************** *** 918,923 **** --- 932,938 ---- affected_rows = sqlca.sqlerrd[0]; /* save estimated affected rows */ EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 256; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx)); *************** *** 926,931 **** --- 941,947 ---- } EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Describe fails (%s)", ifx_error(ifx)); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; *************** *** 1008,1013 **** --- 1024,1030 ---- EXEC SQL EXECUTE :statemid; } if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Execute immediate fails : %s (%s)", statement, ifx_error(ifx)); *************** *** 1065,1070 **** --- 1082,1088 ---- Ifx_Result->affected_rows = affected_rows; /* saved estimated */ EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx)); *************** *** 1104,1109 **** --- 1122,1128 ---- EXEC SQL DECLARE :cursorid CURSOR FOR :statemid; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx)); efree(Ifx_Result); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; *************** *** 1112,1117 **** --- 1131,1137 ---- } EXEC SQL OPEN :cursorid; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx)); efree(Ifx_Result); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; *************** *** 1160,1171 **** /* ---------------------------------------------------------------------- ! ** int ifx_prepare(string $query, int $connid, [string $hold, [string $scroll]]) ! ** ** prepares query $query on connection $connid ** select queries accept 2 optional params : "SCROLL" and/or "HOLD" ** blobsupport: mark the blob-column with ? and add a blob-id-functionparameter ! ** example: ifx_query'insert into catalog (stock_num, manu_code,cat_descr,cat_picture) values(1,"HRO",?,?)',$cid,$bid1,$bid2); ** ** returns a "result id" on success or FALSE on error ** also sets "affected_rows for retrieval by ifx_affected_rows --- 1180,1196 ---- /* ---------------------------------------------------------------------- ! ** int ifx_prepare(string $query, int $connid, ! ** string $hold, string $scroll, array $blobidarry) ! ** ! ** $hold, $scroll are optional and valid only for select queries ! ** $blobidarray is optional, an array of blob id's ! ** ** prepares query $query on connection $connid ** select queries accept 2 optional params : "SCROLL" and/or "HOLD" ** blobsupport: mark the blob-column with ? and add a blob-id-functionparameter ! ** example: ifx_query("insert into catalog (stock_num, manu_code ,cat_descr, ! ** cat_picture) values(1,'HRO',?,?)",$cid,$bid1,$bid2); ** ** returns a "result id" on success or FALSE on error ** also sets "affected_rows for retrieval by ifx_affected_rows *************** *** 1189,1195 **** int i; /* field index */ short fieldtype; loc_t *locator; ! int loc_t_type=CLOCATORTYPE; /* WORKAROUND: TYPE=CLOCATORTYPE doesn't work, don't ask me, why. */ EXEC SQL END DECLARE SECTION; char *blobfilename; --- 1214,1221 ---- int i; /* field index */ short fieldtype; loc_t *locator; ! int loc_t_type=CLOCATORTYPE; /* WORKAROUND: TYPE=CLOCATORTYPE doesn't work, ! don't ask me, why. */ EXEC SQL END DECLARE SECTION; char *blobfilename; *************** *** 1199,1219 **** Informix_TLS_VARS; - if(ARG_COUNT(ht)<2) { WRONG_PARAM_COUNT; } /* get the first 2 parameters */ if (getParameters(ht, 2, &query, &ifx_link)==FAILURE) { RETURN_FALSE; } convert_to_long(ifx_link); id = ifx_link->value.lval; - - - - ifx = (char *) php3_list_find(id,&type); if (type != Informix_GLOBAL(php3_ifx_module).le_link && --- 1225,1242 ---- Informix_TLS_VARS; if(ARG_COUNT(ht)<2) { WRONG_PARAM_COUNT; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + /* get the first 2 parameters */ if (getParameters(ht, 2, &query, &ifx_link)==FAILURE) { RETURN_FALSE; } convert_to_long(ifx_link); id = ifx_link->value.lval; ifx = (char *) php3_list_find(id,&type); if (type != Informix_GLOBAL(php3_ifx_module).le_link && *************** *** 1238,1243 **** --- 1261,1267 ---- EXEC SQL set connection :ifx; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); *************** *** 1245,1250 **** --- 1269,1275 ---- } EXEC SQL PREPARE :statemid FROM :statement; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Prepare fails (%s)", ifx_error(ifx)); RETURN_FALSE; *************** *** 1252,1257 **** --- 1277,1283 ---- affected_rows = sqlca.sqlerrd[0]; /* save estimated affected rows */ EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 256; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx)); *************** *** 1260,1265 **** --- 1286,1292 ---- } EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Describe fails (%s)", ifx_error(ifx)); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; *************** *** 1269,1274 **** --- 1296,1302 ---- Ifx_Result = (IFX_RES *)emalloc(sizeof(IFX_RES)); if (Ifx_Result == NULL) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Out of memory allocating IFX_RES"); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; EXEC SQL free :statemid; *************** *** 1336,1343 **** EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA= :*locator, TYPE=:loc_t_type; i++; _php3_hash_move_forward(pblobidarr->value.ht); ! } ! } /* if */ } else { /* ## ** SELECT-STATEMENT --- 1364,1372 ---- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA= :*locator, TYPE=:loc_t_type; i++; _php3_hash_move_forward(pblobidarr->value.ht); ! } /* while */ ! } /* if paramquery */ ! Ifx_Result->affected_rows = affected_rows; /* saved estimated */ } else { /* ## ** SELECT-STATEMENT *************** *** 1379,1391 **** default: WRONG_PARAM_COUNT; break; ! } strcpy(Ifx_Result->cursorid, cursorid); Ifx_Result->iscursory = 1; Ifx_Result->affected_rows = affected_rows; /* saved estimated */ EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT; if (ifx_check() < 0) { php3_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx)); --- 1408,1421 ---- default: WRONG_PARAM_COUNT; break; ! } /* case */ strcpy(Ifx_Result->cursorid, cursorid); Ifx_Result->iscursory = 1; Ifx_Result->affected_rows = affected_rows; /* saved estimated */ EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx)); *************** *** 1411,1421 **** if (strcasecmp(ctype2,"HOLD") == 0) Ifx_Result->ishold = 1; } - - ! Ifx_Result->affected_rows = affected_rows; /* saved estimated */ ! } /* if */ RETURN_LONG(php3_list_insert(Ifx_Result,Informix_GLOBAL(php3_ifx_module).le_result)); } --- 1441,1448 ---- if (strcasecmp(ctype2,"HOLD") == 0) Ifx_Result->ishold = 1; } ! } /* if select */ RETURN_LONG(php3_list_insert(Ifx_Result,Informix_GLOBAL(php3_ifx_module).le_result)); } *************** *** 1456,1462 **** Informix_TLS_VARS; - switch(ARG_COUNT(ht)) { case 0: WRONG_PARAM_COUNT; --- 1483,1488 ---- *************** *** 1473,1478 **** --- 1499,1506 ---- break; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING,"%d is not an Informix result index", result->value.lval); *************** *** 1498,1503 **** --- 1526,1532 ---- EXEC SQL EXECUTE :statemid; } if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Execute immediate fails : %s ", ifx_error(ifx)); RETURN_FALSE; *************** *** 1516,1526 **** --- 1545,1557 ---- EXEC SQL DECLARE :cursorid CURSOR FOR :statemid; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx)); RETURN_FALSE; } EXEC SQL OPEN :cursorid; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx)); RETURN_FALSE; } *************** *** 1568,1574 **** ** ** returns the Informix error codes (SQLSTATE & SQLCODE) ** ! ** connection id is not checked, but remains for comatibility ** ---------------------------------------------------------------------- */ void php3_ifx_error(INTERNAL_FUNCTION_PARAMETERS) --- 1599,1605 ---- ** ** returns the Informix error codes (SQLSTATE & SQLCODE) ** ! ** connection id is not checked, but remains for compatibility ** ---------------------------------------------------------------------- */ void php3_ifx_error(INTERNAL_FUNCTION_PARAMETERS) *************** *** 1631,1637 **** switch(ARG_COUNT(ht)) { case 0: ! ifx_errorcode = SQLCODE; break; case 1: if (getParameters(ht, 1, &errcode)==FAILURE) { --- 1662,1671 ---- switch(ARG_COUNT(ht)) { case 0: ! if (Informix_GLOBAL(php3_ifx_module).sv_sqlcode == 0) ! ifx_errorcode = SQLCODE; ! else ! ifx_errorcode = Informix_GLOBAL(php3_ifx_module).sv_sqlcode; break; case 1: if (getParameters(ht, 1, &errcode)==FAILURE) { *************** *** 1684,1690 **** Informix_TLS_VARS; - switch(ARG_COUNT(ht)) { case 0: WRONG_PARAM_COUNT; --- 1718,1723 ---- *************** *** 1701,1706 **** --- 1734,1741 ---- break; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING,"%d is not an Informix result index", result->value.lval); *************** *** 1772,1778 **** char *fetch_pos; Informix_TLS_VARS; ! switch(ARG_COUNT(ht)) { case 0: WRONG_PARAM_COUNT; --- 1807,1813 ---- char *fetch_pos; Informix_TLS_VARS; ! switch(ARG_COUNT(ht)) { case 0: WRONG_PARAM_COUNT; *************** *** 1805,1810 **** --- 1840,1847 ---- break; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING,"%d is not an Informix result index", result->value.lval); *************** *** 1854,1859 **** --- 1891,1897 ---- if(SQLCODE!=-451) { switch (ifx_check()) { case IFX_ERROR: + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING, "Can not fetch row on cursor %s (%s)", ifx_error(ifx), *************** *** 1881,1886 **** --- 1919,1925 ---- :fieldleng = LENGTH, :indicator = INDICATOR; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx)); *************** *** 2093,2099 **** Informix_TLS_VARS; - switch (ARG_COUNT(ht)) { case 1: if (getParameters(ht, 1, &result)==FAILURE) { --- 2132,2137 ---- *************** *** 2112,2117 **** --- 2150,2157 ---- break; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); *************** *** 2136,2141 **** --- 2176,2182 ---- EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid; switch (ifx_check()) { case IFX_ERROR: + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), *************** *** 2166,2171 **** --- 2207,2213 ---- for (i = 1; i <= num_fields; i++) { EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx)); *************** *** 2191,2196 **** --- 2233,2239 ---- :fieldleng = LENGTH, :indicator = INDICATOR; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx)); *************** *** 2328,2333 **** --- 2371,2377 ---- EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid; switch (ifx_check()) { case IFX_ERROR: + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), *************** *** 2407,2413 **** Informix_TLS_VARS; - switch (ARG_COUNT(ht)) { case 1: if (getParameters(ht, 1, &result)==FAILURE) { --- 2451,2456 ---- *************** *** 2426,2431 **** --- 2469,2476 ---- break; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); *************** *** 2454,2459 **** --- 2499,2505 ---- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME, :fieldtype = TYPE; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx)); *************** *** 2583,2589 **** Informix_TLS_VARS; - switch (ARG_COUNT(ht)) { case 1: if (getParameters(ht, 1, &result)==FAILURE) { --- 2629,2634 ---- *************** *** 2602,2607 **** --- 2647,2654 ---- break; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); *************** *** 2634,2639 **** --- 2681,2687 ---- :scale = SCALE, :isnullable = NULLABLE; if (ifx_check() < 0) { + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx)); *************** *** 2711,2721 **** int type; Informix_TLS_VARS; - if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &result)==FAILURE) { WRONG_PARAM_COUNT; } convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); --- 2759,2770 ---- int type; Informix_TLS_VARS; if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &result)==FAILURE) { WRONG_PARAM_COUNT; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); *************** *** 2744,2754 **** int type; Informix_TLS_VARS; - if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &result)==FAILURE) { WRONG_PARAM_COUNT; } convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); --- 2793,2804 ---- int type; Informix_TLS_VARS; if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &result)==FAILURE) { WRONG_PARAM_COUNT; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); *************** *** 2768,2774 **** /* ---------------------------------------------------------------------- ** int ifx_free_result(int $resultid) ** ! ** releases resources for querie associated with $resultid ** ** returns FALSE on error ** ---------------------------------------------------------------------- --- 2818,2824 ---- /* ---------------------------------------------------------------------- ** int ifx_free_result(int $resultid) ** ! ** releases resources for query associated with $resultid ** ** returns FALSE on error ** ---------------------------------------------------------------------- *************** *** 2809,2814 **** --- 2859,2866 ---- RETURN_FALSE; } + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; + cursorid = Ifx_Result->cursorid; statemid = Ifx_Result->statemid; descrpid = Ifx_Result->descrpid; *************** *** 2843,2862 **** #endif - - - - - - - - /* ---------------------------------------------------------------------- ! ** int php3_ifx_create_blob(int type, int mode, string param ** ** creates an blob-object ** type: 1=TEXT, 0=BYTE ! ** mode: blob-object holts 0=the content in momory, 1=content in file ** param: if mode=0: pointer to the content ** mode=1: pointer to the filestring ** return false on error otherwise the new Blob-Object-id --- 2895,2906 ---- #endif /* ---------------------------------------------------------------------- ! ** int php3_ifx_create_blob(int type, int mode, string param) ** ** creates an blob-object ** type: 1=TEXT, 0=BYTE ! ** mode: blob-object holds 0=the content in memory, 1=content in file ** param: if mode=0: pointer to the content ** mode=1: pointer to the filestring ** return false on error otherwise the new Blob-Object-id *************** *** 2894,2903 **** ** ** creates an blob-object ** type: 1=TEXT, 0=BYTE ! ** mode: blob-object holts 0=the content in momory, 1=content in file ** param: if mode=0: pointer to the content ** mode=1: pointer to the filestring ! ** len: length og param ** list: internal hashlist of php3 ** return -1 on error otherwise the new Blob-Object-id ** ---------------------------------------------------------------------- --- 2938,2947 ---- ** ** creates an blob-object ** type: 1=TEXT, 0=BYTE ! ** mode: blob-object holds 0=the content in momory, 1=content in file ** param: if mode=0: pointer to the content ** mode=1: pointer to the filestring ! ** len: length of param ** list: internal hashlist of php3 ** return -1 on error otherwise the new Blob-Object-id ** ---------------------------------------------------------------------- *************** *** 3362,3368 **** /* ---------------------------------------------------------------------- ** void php3_ifx_byteasvarchar(int $mode) ** ! ** sets the default bye-mode for all select-queries ** mode=0: select returns a blob-id ** mode=1: select returns a varchar with byte-content ** return nothing --- 3406,3412 ---- /* ---------------------------------------------------------------------- ** void php3_ifx_byteasvarchar(int $mode) ** ! ** sets the default byte-mode for all select-queries ** mode=0: select returns a blob-id ** mode=1: select returns a varchar with byte-content ** return nothing Index: php3/functions/php3_ifx.h diff -c php3/functions/php3_ifx.h:1.7 php3/functions/php3_ifx.h:1.8 *** php3/functions/php3_ifx.h:1.7 Fri Sep 11 07:10:49 1998 --- php3/functions/php3_ifx.h Sun Sep 13 16:43:26 1998 *************** *** 23,29 **** | If you did not, or have any questions about PHP licensing, please | | contact core@php.net. | +----------------------------------------------------------------------+ ! | Authors: Danny Heijl <Danny.Heijl@cevi.be> | | based on mysql code by: Zeev Suraski <bourbon@netvision.net.il> | +----------------------------------------------------------------------+ */ --- 23,31 ---- | If you did not, or have any questions about PHP licensing, please | | contact core@php.net. | +----------------------------------------------------------------------+ ! | Authors: Danny Heijl <Danny.Heijl@cevi.be>, initial cut (ODS 7) | ! | Christian Cartus <chc@idgruppe.de>, blobs, and IUS 9 | ! | Jouni Ahto <jah@guru.cultnet.fi> : configuration stuff | | based on mysql code by: Zeev Suraski <bourbon@netvision.net.il> | +----------------------------------------------------------------------+ */ *************** *** 116,122 **** char *default_host, *default_user, *default_password; int connectionid; int cursorid; ! long blobinfile; /* 0=save in memory, 1=save in file */ long textasvarchar; /* 0=as id, 1=as varchar */ long byteasvarchar; /* 0=as id, 1=as varchar */ long nullformat; /* 0=NULL as "", 1= NULL as "NULL" */ --- 118,125 ---- char *default_host, *default_user, *default_password; int connectionid; int cursorid; ! int sv_sqlcode; /* saved informix SQLCODE value */ ! long blobinfile; /* 0=save in memory, 1=save in file */ long textasvarchar; /* 0=as id, 1=as varchar */ long byteasvarchar; /* 0=as id, 1=as varchar */ long nullformat; /* 0=NULL as "", 1= NULL as "NULL" */ *************** *** 162,170 **** int lofd; } IFX_SLOBRES; #endif - - - #ifndef THREAD_SAFE --- 165,170 ---- -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#1038) next »