CVS update: php3/functions

From: Date: Tue, 11 Aug 1998 20:02:05 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-107@lists.php.net to get a copy of this message
Date: Tuesday August 11, 1998 @ 16:02 Author: danny Update of /repository/php3/functions In directory asf:/tmp/cvs-serv3344/functions Modified Files: ifx.ec php3_ifx.h Log Message: Latest version of Informix driver. - ifx_htmltbl_result($result,"html-table-options"); - info() stuff now OK (Thanks Jouni). - inifile stuff now OK. Danny.Heijl@cevi.be -- Aug. 11 1998 Index: php3/functions/ifx.ec diff -c php3/functions/ifx.ec:1.3 php3/functions/ifx.ec:1.4 *** php3/functions/ifx.ec:1.3 Mon Aug 10 17:28:11 1998 --- php3/functions/ifx.ec Tue Aug 11 16:02:04 1998 *************** *** 27,33 **** | Based on the MySQL code by: Zeev Suraski <bourbon@netvision.net.il> | +----------------------------------------------------------------------+ */ - /* * I started with the mysql-driver, removed all stuff I did not need, * and changed all mysql-specific stuff to Informix-ESQL/C. --- 27,32 ---- *************** *** 43,48 **** --- 42,59 ---- /* TODO: * * ? Safe mode implementation + * + * cursory stored procedures ? + * blob updates ( does someone need that ? ) + * lots of other stuff ?? + * What first ? + * + * I hope 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>). + * */ #if defined(COMPILE_DL) *************** *** 71,93 **** #include "php.h" #include "internal_functions.h" #include "php3_string.h" #include "php3_ifx.h" #if HAVE_IFX EXEC SQL include sqltypes; EXEC SQL include locator; typedef char IFX[128]; - /* the IFX_LIBS and IFX_INCL defines should go here */ - /* when the driver is integrated in the distribution */ - - /*#define PHP_IFX_INCLUDE "Informix 7.x incl" - #define PHP_IFX_LFLAGS "static" - #define PHP_IFX_LIBS "Informix 7.x libs" */ - #include "php3_list.h" #define SAFE_STRING(s) ((s)?(s):"") --- 82,100 ---- #include "php.h" #include "internal_functions.h" #include "php3_string.h" + #include "build-defs.h" #include "php3_ifx.h" #if HAVE_IFX + #include <errno.h> + EXEC SQL include sqltypes; EXEC SQL include locator; typedef char IFX[128]; #include "php3_list.h" #define SAFE_STRING(s) ((s)?(s):"") *************** *** 107,112 **** --- 114,120 ---- {"ifx_fetch_row", php3_ifx_fetch_row, NULL}, {"ifx_fetch_object", php3_ifx_fetch_object, NULL}, {"ifx_free_result", php3_ifx_free_result, NULL}, + {"ifx_htmltbl_result", php3_ifx_htmltbl_result, NULL}, {NULL, NULL, NULL} }; *************** *** 152,164 **** #endif #define CHECK_LINK(link) { \ ! if (link==0) { \ php3_error(E_WARNING, \ ! "Informix: A link to the server could not be established"); \ ! RETURN_FALSE; } \ } ! #define DUP 1 EXEC SQL DEFINE IFX_SUCCESS 0; EXEC SQL DEFINE IFX_WARNING 1; --- 160,173 ---- #endif #define CHECK_LINK(link) { \ ! if (link==0) { \ php3_error(E_WARNING, \ ! "Informix: A link to the server could not be established"); \ ! RETURN_FALSE; \ ! } \ } ! #define DUP 1 EXEC SQL DEFINE IFX_SUCCESS 0; EXEC SQL DEFINE IFX_WARNING 1; *************** *** 172,191 **** _ifx_check = IFX_ERROR; if (SQLSTATE[0] == '0') { ! switch (SQLSTATE[1]) { ! case '0': ! _ifx_check = IFX_SUCCESS; ! break; ! case '1': ! _ifx_check = IFX_WARNING; ! break; ! case '2': ! _ifx_check = IFX_NODATA; ! break; ! default : ! _ifx_check = IFX_ERROR; ! break; ! } } return _ifx_check; --- 181,200 ---- _ifx_check = IFX_ERROR; if (SQLSTATE[0] == '0') { ! switch (SQLSTATE[1]) { ! case '0': ! _ifx_check = IFX_SUCCESS; ! break; ! case '1': ! _ifx_check = IFX_WARNING; ! break; ! case '2': ! _ifx_check = IFX_NODATA; ! break; ! default : ! _ifx_check = IFX_ERROR; ! break; ! } } return _ifx_check; *************** *** 202,229 **** switch (ifx_check()) { case IFX_SUCCESS: c = ' '; ! break; case IFX_WARNING: c = 'W'; ! break; case IFX_ERROR: c = 'E'; ! break; case IFX_NODATA: c = 'N'; ! break; default: c = '?'; ! break; } sprintf(ifx_err_msg,"%c [SQLSTATE=%c%c %c%c%c SQLCODE=%d]", ! c, ! SQLSTATE[0], ! SQLSTATE[1], ! SQLSTATE[2], ! SQLSTATE[3], ! SQLSTATE[4], ! SQLCODE); return(ifx_err_msg); } --- 211,238 ---- switch (ifx_check()) { case IFX_SUCCESS: c = ' '; ! break; case IFX_WARNING: c = 'W'; ! break; case IFX_ERROR: c = 'E'; ! break; case IFX_NODATA: c = 'N'; ! break; default: c = '?'; ! break; } sprintf(ifx_err_msg,"%c [SQLSTATE=%c%c %c%c%c SQLCODE=%d]", ! c, ! SQLSTATE[0], ! SQLSTATE[1], ! SQLSTATE[2], ! SQLSTATE[3], ! SQLSTATE[4], ! SQLCODE); return(ifx_err_msg); } *************** *** 238,244 **** Informix_TLS_VARS; EXEC SQL SET CONNECTION :link; ! EXEC SQL CLOSE DATABASE; /* disconnect current ? */ efree(link); Informix_GLOBAL(php3_ifx_module).num_links--; } --- 247,253 ---- Informix_TLS_VARS; EXEC SQL SET CONNECTION :link; ! EXEC SQL DISCONNECT CURRENT; efree(link); Informix_GLOBAL(php3_ifx_module).num_links--; } *************** *** 252,258 **** Informix_TLS_VARS; EXEC SQL SET CONNECTION :link; ! EXEC SQL CLOSE DATABASE; /* disconnect current ? */ free(link); Informix_GLOBAL(php3_ifx_module).num_persistent--; --- 261,267 ---- Informix_TLS_VARS; EXEC SQL SET CONNECTION :link; ! EXEC SQL DISCONNECT CURRENT; free(link); Informix_GLOBAL(php3_ifx_module).num_persistent--; *************** *** 297,314 **** Informix_GLOBAL(php3_ifx_module).max_links=-1; } if (cfg_get_string("ifx.default_host", ! &Informix_GLOBAL(php3_ifx_module).default_host)==FAILURE ! || Informix_GLOBAL(php3_ifx_module).default_host[0]==0) { Informix_GLOBAL(php3_ifx_module).default_host=NULL; } if (cfg_get_string("ifx.default_user", ! &Informix_GLOBAL(php3_ifx_module).default_user)==FAILURE ! || Informix_GLOBAL(php3_ifx_module).default_user[0]==0) { Informix_GLOBAL(php3_ifx_module).default_user=NULL; } if (cfg_get_string("ifx.default_password", &Informix_GLOBAL(php3_ifx_module).default_password)==FAILURE ! || Informix_GLOBAL(php3_ifx_module).default_password[0]==0) { Informix_GLOBAL(php3_ifx_module).default_password=NULL; } Informix_GLOBAL(php3_ifx_module).num_persistent=0; --- 306,323 ---- Informix_GLOBAL(php3_ifx_module).max_links=-1; } if (cfg_get_string("ifx.default_host", ! &Informix_GLOBAL(php3_ifx_module).default_host)==FAILURE ! || Informix_GLOBAL(php3_ifx_module).default_host[0]==0) { Informix_GLOBAL(php3_ifx_module).default_host=NULL; } if (cfg_get_string("ifx.default_user", ! &Informix_GLOBAL(php3_ifx_module).default_user)==FAILURE ! || Informix_GLOBAL(php3_ifx_module).default_user[0]==0) { Informix_GLOBAL(php3_ifx_module).default_user=NULL; } if (cfg_get_string("ifx.default_password", &Informix_GLOBAL(php3_ifx_module).default_password)==FAILURE ! || Informix_GLOBAL(php3_ifx_module).default_password[0]==0) { Informix_GLOBAL(php3_ifx_module).default_password=NULL; } Informix_GLOBAL(php3_ifx_module).num_persistent=0; *************** *** 339,348 **** SET_MUTEX(ifx_mutex); numthreads--; if (!numthreads){ ! if (!TlsFree(InformixTls)){ ! FREE_MUTEX(ifx_mutex); ! return 0; ! }} FREE_MUTEX(ifx_mutex); #endif return SUCCESS; --- 348,358 ---- SET_MUTEX(ifx_mutex); numthreads--; if (!numthreads){ ! if (!TlsFree(InformixTls)){ ! FREE_MUTEX(ifx_mutex); ! return 0; ! } ! } FREE_MUTEX(ifx_mutex); #endif return SUCCESS; *************** *** 353,359 **** Informix_TLS_VARS; Informix_GLOBAL(php3_ifx_module).default_link=-1; ! Informix_GLOBAL(php3_ifx_module).num_links = Informix_GLOBAL(php3_ifx_module).num_persistent; return SUCCESS; } --- 363,370 ---- Informix_TLS_VARS; Informix_GLOBAL(php3_ifx_module).default_link=-1; ! Informix_GLOBAL(php3_ifx_module).num_links = ! Informix_GLOBAL(php3_ifx_module).num_persistent; return SUCCESS; } *************** *** 363,372 **** char maxp[16],maxl[16]; Informix_TLS_VARS; - // - // ????? - // - return; if (Informix_GLOBAL(php3_ifx_module).max_persistent==-1) { strcpy(maxp,"Unlimited"); --- 374,379 ---- *************** *** 384,405 **** "<tr><td>Allow persistent links:</td><td>%s</td></tr>\n" "<tr><td>Persistent links:</td><td>%d/%s</td></tr>\n" "<tr><td>Total links:</td><td>%d/%s</td></tr>\n" ! "<tr><td>Client API version:</td><td>%s</td></tr>\n" #if !(WIN32|WINNT) "<tr><td valign=\"top\">Compilation definitions:</td><td>" "<tt>IFX_INCLUDE=%s<br>\n" "IFX_LFLAGS=%s<br>\n" "IFX_LIBS=%s<br></tt></td></tr>" #endif ! "</table>\n" ! #if 0 (Informix_GLOBAL(php3_ifx_module).allow_persistent?"Yes":"No"), Informix_GLOBAL(php3_ifx_module).num_persistent,maxp, Informix_GLOBAL(php3_ifx_module).num_links,maxl, ! ifx_get_client_info() ! #endif #if !(WIN32|WINNT) ! ,PHP_IFX_INCLUDE,PHP_IFX_LFLAGS,PHP_IFX_LIBS #endif ); } --- 391,412 ---- "<tr><td>Allow persistent links:</td><td>%s</td></tr>\n" "<tr><td>Persistent links:</td><td>%d/%s</td></tr>\n" "<tr><td>Total links:</td><td>%d/%s</td></tr>\n" ! "<tr><td>Client API version:</td><td>%02.2f</td></tr>\n" #if !(WIN32|WINNT) "<tr><td valign=\"top\">Compilation definitions:</td><td>" "<tt>IFX_INCLUDE=%s<br>\n" "IFX_LFLAGS=%s<br>\n" "IFX_LIBS=%s<br></tt></td></tr>" #endif ! "</table>\n", (Informix_GLOBAL(php3_ifx_module).allow_persistent?"Yes":"No"), Informix_GLOBAL(php3_ifx_module).num_persistent,maxp, Informix_GLOBAL(php3_ifx_module).num_links,maxl, ! (double)(CLIENT_SQLI_VER/100.0) #if !(WIN32|WINNT) ! ,PHP_IFX_INCLUDE, ! PHP_IFX_LFLAGS, ! PHP_IFX_LIBS #endif ); } *************** *** 523,530 **** ifx = (char *)malloc(sizeof(IFX)); Informix_GLOBAL(php3_ifx_module).connectionid++; sprintf(ifx,"%s%x", ! user, ! Informix_GLOBAL(php3_ifx_module).connectionid); EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd --- 530,537 ---- ifx = (char *)malloc(sizeof(IFX)); Informix_GLOBAL(php3_ifx_module).connectionid++; sprintf(ifx,"%s%x", ! user, ! Informix_GLOBAL(php3_ifx_module).connectionid); EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd *************** *** 557,564 **** ifx = le->ptr; EXEC SQL SET CONNECTION :ifx; if (ifx_check() == IFX_ERROR) { ! /* the link died */ ! ifx = le->ptr; /* reconnect silently */ EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION; --- 564,571 ---- ifx = le->ptr; EXEC SQL SET CONNECTION :ifx; if (ifx_check() == IFX_ERROR) { ! /* the link died */ ! ifx = le->ptr; /* reconnect silently */ EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION; *************** *** 568,574 **** "Informix: Link to server lost, unable to reconnect (%s)", ifx_error(ifx)); _php3_hash_del(plist, hashed_details, ! hashed_details_length+1); efree(hashed_details); RETURN_FALSE; } --- 575,581 ---- "Informix: Link to server lost, unable to reconnect (%s)", ifx_error(ifx)); _php3_hash_del(plist, hashed_details, ! hashed_details_length+1); efree(hashed_details); RETURN_FALSE; } *************** *** 623,630 **** Informix_GLOBAL(php3_ifx_module).connectionid); EXEC SQL CONNECT TO :host AS :ifx ! USER :user USING :passwd ! WITH CONCURRENT TRANSACTION; if (ifx_check() == IFX_ERROR) { php3_error(E_WARNING,"ifx_pconnect : %s", ifx_error(ifx)); efree(hashed_details); --- 630,637 ---- Informix_GLOBAL(php3_ifx_module).connectionid); EXEC SQL CONNECT TO :host AS :ifx ! USER :user USING :passwd ! WITH CONCURRENT TRANSACTION; if (ifx_check() == IFX_ERROR) { php3_error(E_WARNING,"ifx_pconnect : %s", ifx_error(ifx)); efree(hashed_details); *************** *** 846,858 **** IFX_RES *Ifx_Result; EXEC SQL BEGIN DECLARE SECTION; ! char *ifx; /* connection ID */ ! char cursorid[32]; /* query cursor id */ ! char statemid[32]; /* statement id */ ! char descrpid[32]; /* descriptor id */ ! char *statement; /* query text */ ! int fieldcount; /* field count */ ! int i; /* field index */ short fieldtype; loc_t *locator; EXEC SQL END DECLARE SECTION; --- 853,865 ---- IFX_RES *Ifx_Result; EXEC SQL BEGIN DECLARE SECTION; ! char *ifx; /* connection ID */ ! char cursorid[32]; /* query cursor id */ ! char statemid[32]; /* statement id */ ! char descrpid[32]; /* descriptor id */ ! char *statement; /* query text */ ! int fieldcount; /* field count */ ! int i; /* field index */ short fieldtype; loc_t *locator; EXEC SQL END DECLARE SECTION; *************** *** 941,950 **** for (i = 0; i < MAXBLOBS; ++i) Ifx_Result->blob_data[i] = (loc_t *)NULL; ! if (sqlca.sqlcode != 0) { /* not a select, execute immediate */ ! strcpy(Ifx_Result->cursorid, ""); strcpy(Ifx_Result->descrpid, descrpid); ! strcpy(Ifx_Result->statemid, statemid); EXEC SQL EXECUTE :statemid; if (ifx_check() < 0) { php3_error(E_WARNING,"Execute immediate fails : %s (%s)", --- 948,957 ---- for (i = 0; i < MAXBLOBS; ++i) Ifx_Result->blob_data[i] = (loc_t *)NULL; ! if (sqlca.sqlcode != 0) { /* not a select, execute immediate */ ! strcpy(Ifx_Result->cursorid, ""); strcpy(Ifx_Result->descrpid, descrpid); ! strcpy(Ifx_Result->statemid, statemid); EXEC SQL EXECUTE :statemid; if (ifx_check() < 0) { php3_error(E_WARNING,"Execute immediate fails : %s (%s)", *************** *** 956,964 **** } else { 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)); RETURN_FALSE; } Ifx_Result->numcols = fieldcount; --- 963,971 ---- } else { 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)); RETURN_FALSE; } Ifx_Result->numcols = fieldcount; *************** *** 975,1002 **** efree(Ifx_Result); RETURN_FALSE; } ! strcpy(Ifx_Result->cursorid, cursorid); strcpy(Ifx_Result->descrpid, descrpid); ! strcpy(Ifx_Result->statemid, statemid); ! /* check for text/blob columns */ ! locind = 0; ! for (i = 1; i <= fieldcount; ++i) { ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE; ! if ((fieldtype == SQLTEXT) || (fieldtype == SQLBYTES)) { ! locator = (loc_t *)malloc(sizeof(loc_t)); ! Ifx_Result->blob_data[locind] = locator; ! ++locind; ! locator->loc_loctype = LOCMEMORY; ! locator->loc_bufsize = 512; ! locator->loc_buffer = (char *)malloc(2048); ! locator->loc_mflags = 0; ! locator->loc_oflags = 0; ! EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator; ! } ! } ! } return_value->value.lval = --- 982,1009 ---- efree(Ifx_Result); RETURN_FALSE; } ! strcpy(Ifx_Result->cursorid, cursorid); strcpy(Ifx_Result->descrpid, descrpid); ! strcpy(Ifx_Result->statemid, statemid); ! /* check for text/blob columns */ ! locind = 0; ! for (i = 1; i <= fieldcount; ++i) { ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE; ! if ((fieldtype == SQLTEXT) || (fieldtype == SQLBYTES)) { ! locator = (loc_t *)malloc(sizeof(loc_t)); ! Ifx_Result->blob_data[locind] = locator; ! ++locind; ! locator->loc_loctype = LOCMEMORY; ! locator->loc_bufsize = INITIAL_BLOBSIZE - 4; ! locator->loc_buffer = (char *)malloc(INITIAL_BLOBSIZE); ! locator->loc_mflags = 0; ! locator->loc_oflags = 0; ! EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator; ! } ! } ! } return_value->value.lval = *************** *** 1092,1120 **** IFX_RES *Ifx_Result; EXEC SQL BEGIN DECLARE SECTION; ! char *ifx; /* connection ID */ ! char *cursorid; /* query cursor id */ ! char *statemid; /* statement id */ ! char *descrpid; /* descriptor id */ ! char *statement; /* query text */ ! int fieldcount; /* field count */ ! int i; /* an index */ ! char fieldname[64]; /* fieldname */ ! char ifx_bug; /* pad for ifx bug */ ! short fieldtype; /* field type */ ! int fieldleng; /* field length */ ! int field_ind; /* the field index */ ! char *field; /* the field data */ ! ! short indicator; ! int int_data; ! char *char_data; ! long date_data; ! interval intvl_data = {0}; ! datetime dt_data = {0}; ! decimal dec_data = {0}; ! short short_data; ! loc_t *locator; EXEC SQL END DECLARE SECTION; int type; --- 1099,1129 ---- IFX_RES *Ifx_Result; EXEC SQL BEGIN DECLARE SECTION; ! char *ifx; /* connection ID */ ! char *cursorid; /* query cursor id */ ! char *statemid; /* statement id */ ! char *descrpid; /* descriptor id */ ! char *statement; /* query text */ ! int fieldcount; /* field count */ ! int i; /* an index */ ! char fieldname[64]; /* fieldname */ ! char ifx_bug; /* pad for ifx bug */ ! short fieldtype; /* field type */ ! int fieldleng; /* field length */ ! int field_ind; /* the field index */ ! char *field; /* the field data */ ! ! short indicator; ! int int_data; ! char *char_data; ! long date_data; ! interval intvl_data = {0}; ! datetime dt_data = {0}; ! decimal dec_data = {0}; ! short short_data; ! loc_t *locator; ! float float_data; ! double double_data; EXEC SQL END DECLARE SECTION; int type; *************** *** 1124,1130 **** char string_data[256]; long long_data; char *p; ! Informix_TLS_VARS; --- 1133,1142 ---- char string_data[256]; long long_data; char *p; ! FILE *fp; ! char *blobfilename; ! char *blobdir; ! Informix_TLS_VARS; *************** *** 1142,1148 **** } if (strcmp(Ifx_Result->cursorid,"") == 0) { php3_error(E_WARNING,"Not a select cursor !"); ! RETURN_FALSE; } ifx = Ifx_Result->connecid; --- 1154,1160 ---- } if (strcmp(Ifx_Result->cursorid,"") == 0) { php3_error(E_WARNING,"Not a select cursor !"); ! RETURN_FALSE; } ifx = Ifx_Result->connecid; *************** *** 1153,1163 **** EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid; switch (ifx_check()) { ! case IFX_ERROR: ! php3_error(E_WARNING, ! "Can not fetch next row on cursor %s (%s)", ! ifx_error(ifx), ! cursorid); RETURN_FALSE; break; case IFX_NODATA: --- 1165,1175 ---- EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid; switch (ifx_check()) { ! case IFX_ERROR: ! php3_error(E_WARNING, ! "Can not fetch next row on cursor %s (%s)", ! ifx_error(ifx), ! cursorid); RETURN_FALSE; break; case IFX_NODATA: *************** *** 1174,1179 **** --- 1186,1194 ---- } num_fields = fieldcount; + if ((blobdir = getenv("php3_blobdir")) == NULL) + blobdir = "."; + locind = 0; for (i = 1; i <= num_fields; i++) { EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE, *************** *** 1187,1197 **** RETURN_FALSE; } ! p = fieldname; /* rtrim fieldname */ while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p; *p = 0; ! if (indicator == -1) { /* NULL */ add_assoc_string(return_value, fieldname, "NULL", DUP); continue; } --- 1202,1212 ---- RETURN_FALSE; } ! p = fieldname; /* rtrim fieldname */ while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p; *p = 0; ! if (indicator == -1) { /* NULL */ add_assoc_string(return_value, fieldname, "NULL", DUP); continue; } *************** *** 1218,1223 **** --- 1233,1249 ---- *p = 0; add_assoc_string(return_value, fieldname, string_data, DUP); break; + case SQLSMFLOAT : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :float_data = DATA; + double_data = float_data; + sprintf(string_data,"%17.17g", double_data); + add_assoc_string(return_value, fieldname, string_data, DUP); + break; + case SQLFLOAT : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :double_data = DATA; + sprintf(string_data,"%17.17g", double_data); + add_assoc_string(return_value, fieldname, string_data, DUP); + break; case SQLDATE : EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :date_data = DATA; rdatestr(date_data, string_data); *************** *** 1244,1273 **** efree(char_data); char_data = NULL; break; ! case SQLTEXT : locator = Ifx_Result->blob_data[locind]; ! if (locator->loc_status < 0) { free(locator->loc_buffer); ! locator->loc_bufsize = fieldleng + 4; ! locator->loc_buffer = (char *)malloc(fieldleng + 4); if (locator->loc_buffer == NULL) { php3_error(E_WARNING,"no memory (%d bytes) for blob", ! fieldleng); RETURN_FALSE; } } add_assoc_stringl(return_value, ! fieldname, ! locator->loc_buffer, ! fieldleng, ! DUP); break; ! case SQLBYTES : ! sprintf(string_data,"(@BYTE@)[%d]",fieldleng); add_assoc_string(return_value, fieldname, string_data, DUP); break; - case SQLSMFLOAT : - case SQLFLOAT : default : sprintf(string_data,"ESQL/C : %s : unsupported field type[%d]", fieldname, --- 1270,1332 ---- efree(char_data); char_data = NULL; break; ! case SQLTEXT : /* is returned as if a long varchar */ locator = Ifx_Result->blob_data[locind]; ! ++locind; ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator = DATA; ! if (locator->loc_status < 0) { /* blob too large */ free(locator->loc_buffer); ! locator->loc_bufsize = locator->loc_size + 4; ! locator->loc_buffer = (char *)malloc(locator->loc_bufsize); if (locator->loc_buffer == NULL) { php3_error(E_WARNING,"no memory (%d bytes) for blob", ! locator->loc_bufsize); RETURN_FALSE; } + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator = DATA; } add_assoc_stringl(return_value, ! fieldname, ! locator->loc_buffer, ! locator->loc_size, ! DUP); break; ! case SQLBYTES : /* is dumped into a file, returns filename */ ! locator = Ifx_Result->blob_data[locind]; ! ++locind; ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator = DATA; ! if (locator->loc_status < 0) { /* blob too large */ ! free(locator->loc_buffer); ! locator->loc_bufsize = locator->loc_size + 4; ! locator->loc_buffer = (char *)malloc(locator->loc_bufsize); ! if (locator->loc_buffer == NULL) { ! php3_error(E_WARNING,"no memory (%d bytes) for blob", ! locator->loc_bufsize); ! RETURN_FALSE; ! } ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator = DATA; ! } ! /* dump blob in temp file */ ! sprintf(string_data,"blb%d", locind); ! blobfilename = tempnam(blobdir,string_data); ! fp = fopen(blobfilename, "wb"); ! if (fp == NULL) { ! php3_error(E_WARNING, "can't create blobfile %s (%d)", ! blobfilename, ! errno); ! } ! if (fwrite(locator->loc_buffer, ! locator->loc_size, 1, fp) != 1) { ! php3_error(E_WARNING, "can't write blobfile %s (%d)", ! blobfilename, ! errno); ! } ! fclose(fp); ! /* return filename and filesize */ ! sprintf(string_data,"@BlobFile@%s@%d@", blobfilename, locator->loc_size); ! free(blobfilename); add_assoc_string(return_value, fieldname, string_data, DUP); break; default : sprintf(string_data,"ESQL/C : %s : unsupported field type[%d]", fieldname, *************** *** 1286,1312 **** IFX_RES *Ifx_Result; EXEC SQL BEGIN DECLARE SECTION; ! char *ifx; /* connection ID */ ! char *cursorid; /* query cursor id */ ! char *statemid; /* statement id */ ! char *descrpid; /* descriptor id */ ! char *statement; /* query text */ ! int fieldcount; /* field count */ ! int i; /* an index */ ! char fieldname[64]; /* fieldname */ ! short fieldtype; /* field type */ ! int field_ind; /* the field index */ ! int fieldleng; /* field length */ ! char *field; /* the field */ ! ! short indicator; ! int int_data; ! char *char_data = NULL; ! long date_data; ! interval intvl_data = {0}; ! datetime dt_data = {0}; ! decimal dec_data = {0}; ! short short_data; EXEC SQL END DECLARE SECTION; int type; --- 1345,1374 ---- IFX_RES *Ifx_Result; EXEC SQL BEGIN DECLARE SECTION; ! char *ifx; /* connection ID */ ! char *cursorid; /* query cursor id */ ! char *statemid; /* statement id */ ! char *descrpid; /* descriptor id */ ! char *statement; /* query text */ ! int fieldcount; /* field count */ ! int i; /* an index */ ! char fieldname[64]; /* fieldname */ ! short fieldtype; /* field type */ ! int field_ind; /* the field index */ ! int fieldleng; /* field length */ ! char *field; /* the field */ ! ! short indicator; ! int int_data; ! char *char_data = NULL; ! long date_data; ! interval intvl_data = {0}; ! datetime dt_data = {0}; ! decimal dec_data = {0}; ! short short_data; ! float float_data; ! double double_data; ! loc_t *locator; EXEC SQL END DECLARE SECTION; int type; *************** *** 1315,1321 **** char string_data[256]; long long_data; char *p; ! Informix_TLS_VARS; switch (ARG_COUNT(ht)) { --- 1377,1387 ---- char string_data[256]; long long_data; char *p; ! int locind; ! FILE *fp; ! char *blobfilename; ! char *blobdir; ! Informix_TLS_VARS; switch (ARG_COUNT(ht)) { *************** *** 1339,1352 **** } if (Ifx_Result->rowid == 0) { ! php3_error(E_WARNING,"No rows fetched yet !"); ! RETURN_FALSE; } if (strcmp(Ifx_Result->cursorid,"") == 0) { ! php3_error(E_WARNING,"Not a select cursor !"); ! RETURN_FALSE; } ! ifx = Ifx_Result->connecid; cursorid = Ifx_Result->cursorid; statemid = Ifx_Result->statemid; --- 1405,1418 ---- } if (Ifx_Result->rowid == 0) { ! php3_error(E_WARNING,"No rows fetched yet !"); ! RETURN_FALSE; } if (strcmp(Ifx_Result->cursorid,"") == 0) { ! php3_error(E_WARNING,"Not a select cursor !"); ! RETURN_FALSE; } ! ifx = Ifx_Result->connecid; cursorid = Ifx_Result->cursorid; statemid = Ifx_Result->statemid; *************** *** 1354,1392 **** fieldcount = Ifx_Result->numcols; if (arg2->type == IS_STRING) { ! field = arg2->value.str.val; field_ind = -1; } else { ! field_ind = arg2->value.lval; field = NULL; } ! if (field != NULL) { /* field name supplied */ ! for (i = 1; i <= fieldcount; i++) { ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME; ! if (ifx_check() < 0) { ! php3_error(E_WARNING,"ifx_result : can not describe field %d",i); ! RETURN_FALSE; ! } ! ! p = fieldname; ! while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p; ! *p = 0; ! ! if (strcasecmp(fieldname, field) == 0) { ! field_ind = i; ! break; ! } ! } ! if (field_ind < 0) { ! php3_error(E_WARNING,"Unkown field <%s>", field); RETURN_FALSE; } ! } else { /* field index supplied */ ! if (field_ind > fieldcount || field_ind <= 0) { ! php3_error(E_WARNING,"ifx_result : invalid field index"); ! RETURN_FALSE; } } EXEC SQL GET DESCRIPTOR :descrpid VALUE :field_ind :fieldtype = TYPE, --- 1420,1472 ---- fieldcount = Ifx_Result->numcols; if (arg2->type == IS_STRING) { ! field = arg2->value.str.val; field_ind = -1; } else { ! field_ind = arg2->value.lval; field = NULL; } + + + /* if a fieldindex is given, we need to count the blobs to */ + /* get at the right blobindex */ + /* if a fieldname is given, we have to check all fields */ + /* for the right name and count the blobs too */ ! locind = 0; ! ! for (i = 1; i <= fieldcount; i++) { ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME, ! :fieldtype = TYPE; ! if (ifx_check() < 0) { ! php3_error(E_WARNING,"ifx_result : can not describe field %d",i); RETURN_FALSE; } ! if ((field == NULL) && (field_ind == i)) { ! break; /* we got to the field with the index */ ! } ! /* rtrim the informix fieldname */ ! p = fieldname; ! while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p; ! *p = 0; ! ! if (strcasecmp(fieldname, field) == 0) { ! field_ind = i; /* we got to the field with the name */ ! break; } + if ((fieldtype == SQLBYTES) || (fieldtype == SQLTEXT)) { + ++locind; /* bump locind if this one was a blob */ + } /* and try the next field */ + } + + if (field_ind < 0) { + php3_error(E_WARNING,"Unkown field <%s>", field); + RETURN_FALSE; + } + + if (field_ind > fieldcount || field_ind <= 0) { + php3_error(E_WARNING,"ifx_result : invalid field index"); + RETURN_FALSE; } EXEC SQL GET DESCRIPTOR :descrpid VALUE :field_ind :fieldtype = TYPE, *************** *** 1398,1404 **** ifx_error(ifx)); RETURN_FALSE; } ! if (indicator == -1) { /* NULL */ return_value->type = IS_STRING; return_value->value.str.len = strlen("NULL"); return_value->value.str.val = --- 1478,1484 ---- ifx_error(ifx)); RETURN_FALSE; } ! if (indicator == -1) { /* NULL */ return_value->type = IS_STRING; return_value->value.str.len = strlen("NULL"); return_value->value.str.val = *************** *** 1406,1412 **** return; } ! i = field_ind; /* field_index */ char_data = NULL; switch (fieldtype) { --- 1486,1492 ---- return; } ! i = field_ind; /* field_index */ char_data = NULL; switch (fieldtype) { *************** *** 1421,1426 **** --- 1501,1515 ---- long_data = short_data; sprintf(string_data,"%ld", long_data); break; + case SQLSMFLOAT : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :float_data = DATA; + double_data = float_data; + sprintf(string_data,"%17.17g", double_data); + break; + case SQLFLOAT : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :double_data = DATA; + sprintf(string_data,"%17.17g", double_data); + break; case SQLDECIMAL : case SQLMONEY : EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dec_data = DATA; *************** *** 1449,1462 **** } EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA; break; ! case SQLTEXT : ! sprintf(string_data,"(@TEXT@)[%d]",fieldleng); ! break; ! case SQLBYTES : ! sprintf(string_data,"(@BYTE@)[%d]",fieldleng); break; - case SQLSMFLOAT : - case SQLFLOAT : default : sprintf(string_data,"ESQL/C : %s : unsupported field type[%d]", fieldname, --- 1538,1599 ---- } EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA; break; ! case SQLTEXT : /* is returned as if a long varchar */ ! locator = Ifx_Result->blob_data[locind]; ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator = DATA; ! if (locator->loc_status < 0) { /* blob too large */ ! free(locator->loc_buffer); ! locator->loc_bufsize = locator->loc_size + 4; ! locator->loc_buffer = (char *)malloc(locator->loc_bufsize); ! if (locator->loc_buffer == NULL) { ! php3_error(E_WARNING,"no memory (%d bytes) for blob", ! locator->loc_bufsize); ! RETURN_FALSE; ! } ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator = DATA; ! } ! /* return immediately here to prevent the free after the case */ ! p = locator->loc_buffer; ! return_value->value.str.len = strlen(p); ! return_value->value.str.val = ! (char *) safe_estrndup(p, return_value->value.str.len); ! return_value->type = IS_STRING; ! return; ! break; ! case SQLBYTES : /* is dumped into a file, returns filename */ ! locator = Ifx_Result->blob_data[locind]; ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator = DATA; ! if (locator->loc_status < 0) { /* blob too large */ ! free(locator->loc_buffer); ! locator->loc_bufsize = locator->loc_size + 4; ! locator->loc_buffer = (char *)malloc(locator->loc_bufsize); ! if (locator->loc_buffer == NULL) { ! php3_error(E_WARNING,"no memory (%d bytes) for blob", ! locator->loc_bufsize); ! RETURN_FALSE; ! } ! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator = DATA; ! } ! /* dump blob in temp file */ ! sprintf(string_data,"blb%d", locind); ! blobfilename = tempnam(blobdir,string_data); ! fp = fopen(blobfilename, "wb"); ! if (fp == NULL) { ! php3_error(E_WARNING, "can't create blobfile %s (%d)", ! blobfilename, ! errno); ! } ! if (fwrite(locator->loc_buffer, ! locator->loc_size, 1, fp) != 1) { ! php3_error(E_WARNING, "can't write blobfile %s (%d)", ! blobfilename, ! errno); ! } ! fclose(fp); ! /* return filename and filesize */ ! sprintf(string_data,"@BlobFile@%s@%d@", blobfilename, locator->loc_size); ! free(blobfilename); break; default : sprintf(string_data,"ESQL/C : %s : unsupported field type[%d]", fieldname, *************** *** 1478,1490 **** (char *) safe_estrndup(p, return_value->value.str.len); } ! if (char_data != NULL) free(char_data); char_data = NULL; return_value->type = IS_STRING; } void php3_ifx_num_rows(INTERNAL_FUNCTION_PARAMETERS) { pval *result; --- 1615,1904 ---- (char *) safe_estrndup(p, return_value->value.str.len); } ! if (char_data != NULL) efree(char_data); char_data = NULL; return_value->type = IS_STRING; } + + void php3_ifx_htmltbl_result(INTERNAL_FUNCTION_PARAMETERS) + { + pval *result, *arg2; + IFX_RES *Ifx_Result; + + EXEC SQL BEGIN DECLARE SECTION; + char *ifx; /* connection ID */ + char *cursorid; /* query cursor id */ + char *statemid; /* statement id */ + char *descrpid; /* descriptor id */ + char *statement; /* query text */ + int fieldcount; /* field count */ + int i; /* an index */ + char fieldname[64]; /* fieldname */ + short fieldtype; /* field type */ + int field_ind; /* the field index */ + int fieldleng; /* field length */ + char *field; /* the field */ + + short indicator; + int int_data; + char *char_data = NULL; + long date_data; + interval intvl_data = {0}; + datetime dt_data = {0}; + decimal dec_data = {0}; + short short_data; + float float_data; + double double_data; + loc_t *locator; + EXEC SQL END DECLARE SECTION; + + int type; + int num_fields; + + char string_data[256]; + long long_data; + char *p; + int locind; + FILE *fp; + char *blobfilename; + char *blobdir; + char *table_options; + int moredata; + + Informix_TLS_VARS; + + + switch (ARG_COUNT(ht)) { + case 1: + if (getParameters(ht, 1, &result)==FAILURE) { + RETURN_FALSE; + } + table_options = NULL; + break; + case 2: + if (getParameters(ht, 2, &result, &arg2)==FAILURE) { + RETURN_FALSE; + } + table_options = arg2->value.str.val; + break; + default: + WRONG_PARAM_COUNT; + break; + } + + convert_to_long(result); + Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); + + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { + php3_error(E_WARNING, + "%d is not a Informix result index",result->value.lval); + RETURN_FALSE; + } + + if (strcmp(Ifx_Result->cursorid,"") == 0) { + php3_error(E_WARNING,"Not a select cursor !"); + RETURN_FALSE; + } + + ifx = Ifx_Result->connecid; + cursorid = Ifx_Result->cursorid; + statemid = Ifx_Result->statemid; + descrpid = Ifx_Result->descrpid; + fieldcount = Ifx_Result->numcols; + + /* try to fetch the first row */ + EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid; + switch (ifx_check()) { + case IFX_ERROR: + php3_error(E_WARNING, + "Can not fetch next row on cursor %s (%s)", + ifx_error(ifx), + cursorid); + RETURN_FALSE; + break; + case IFX_NODATA: + moredata = 0; + break; + default: + Ifx_Result->rowid = moredata = 1; + break; + } + + if(! moredata) { + php3_printf("<h2>No rows found</h2>\n"); + RETURN_LONG(0); + } + num_fields = fieldcount; + + /* start table tag */ + if (table_options == NULL) + php3_printf("<table><tr>"); + else + php3_printf("<table %s><tr>", table_options); + + /* table headings */ + for (i = 1; i <= num_fields; i++) { + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME; + if (ifx_check() < 0) { + php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", + i, + ifx_error(ifx)); + RETURN_FALSE; + } + + p = fieldname; /* Capitalize and rtrim fieldname */ + *p = toupper(*p); + while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p; + *p = 0; + + php3_printf("<th>%s</th>", fieldname); + } + php3_printf("</tr>\n"); + + /* start spitting out rows untill none left */ + while (moredata) { + printf("<tr>"); + locind = 0; + for (i = 1; i <= num_fields; i++) { + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE, + :fieldname = NAME, + :fieldleng = LENGTH, + :indicator = INDICATOR; + if (ifx_check() < 0) { + php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", + i, + ifx_error(ifx)); + RETURN_FALSE; + } + + p = fieldname; /* rtrim fieldname */ + while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p; + *p = 0; + + if (indicator == -1) { /* NULL */ + php3_printf("<td>NULL</td>"); + continue; + } + switch (fieldtype) { + case SQLSERIAL : + case SQLINT : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int_data = DATA; + long_data = int_data; + sprintf(string_data,"%ld", long_data); + php3_printf("<td>%s</td>", string_data); + break; + case SQLSMINT : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :short_data = DATA; + long_data = short_data; + sprintf(string_data,"%ld", long_data); + php3_printf("<td>%s</td>", string_data); + break; + case SQLDECIMAL : + case SQLMONEY : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dec_data = DATA; + memset(string_data, 0x20, 64); + dectoasc(&dec_data, string_data, 63, -1); + for (p =string_data; *p != ' '; ++p) ; + *p = 0; + php3_printf("<td>%s</td>", string_data); + break; + case SQLSMFLOAT : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :float_data = DATA; + double_data = float_data; + sprintf(string_data,"%17.17g", double_data); + php3_printf("<td>%s</td>", string_data); + break; + case SQLFLOAT : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :double_data = DATA; + sprintf(string_data,"%17.17g", double_data); + php3_printf("<td>%s</td>", string_data); + break; + case SQLDATE : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :date_data = DATA; + rdatestr(date_data, string_data); + php3_printf("<td>%s</td>", string_data); + break; + case SQLDTIME : + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dt_data = DATA; + dttoasc(&dt_data, string_data); + php3_printf("<td>%s</td>", string_data); + break; + case SQLINTERVAL: + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :intvl_data = DATA; + intoasc(&intvl_data, string_data); + php3_printf("<td>%s</td>", string_data); + break; + case SQLCHAR : + case SQLVCHAR : + if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) { + php3_error(E_WARNING, "Out of memory"); + RETURN_FALSE; + } + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA; + php3_printf("<td>%s</td>", char_data); + efree(char_data); + char_data = NULL; + break; + case SQLTEXT : /* is returned as if a long varchar */ + locator = Ifx_Result->blob_data[locind]; + ++locind; + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator = DATA; + if (locator->loc_status < 0) { /* blob too large */ + free(locator->loc_buffer); + locator->loc_bufsize = locator->loc_size + 4; + locator->loc_buffer = (char *)malloc(locator->loc_bufsize); + if (locator->loc_buffer == NULL) { + php3_error(E_WARNING,"no memory (%d bytes) for blob", + locator->loc_bufsize); + RETURN_FALSE; + } + EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator = DATA; + } + php3_printf("<td>%s</td>", char_data); + break; + case SQLBYTES : + ++locind; + php3_printf("<td>(BLOB)</td>", "(BLOB)"); + break; + default : + sprintf(string_data,"ESQL/C : %s : unsupported field type[%d]", + fieldname, + fieldleng); + php3_printf("<td>%s</td>", string_data); + break; + } + + continue; + } + php3_printf("</tr>\n"); + /* fetch next row */ + EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid; + switch (ifx_check()) { + case IFX_ERROR: + php3_error(E_WARNING, + "Can not fetch next row on cursor %s (%s)", + ifx_error(ifx), + cursorid); + RETURN_FALSE; + break; + case IFX_NODATA: + moredata = 0; + break; + default: + break; + } + Ifx_Result->rowid++; + + } /* endwhile (moredata); */ + php3_printf("</table>\n"); + + RETURN_LONG(Ifx_Result->rowid); + + } + void php3_ifx_num_rows(INTERNAL_FUNCTION_PARAMETERS) { pval *result; *************** *** 1506,1512 **** RETURN_FALSE; } ! return_value->value.lval = -1; /* not supported */ return_value->type = IS_LONG; } --- 1920,1926 ---- RETURN_FALSE; } ! return_value->value.lval = -1; /* not supported */ return_value->type = IS_LONG; } *************** *** 1542,1548 **** void php3_ifx_fetch_object(INTERNAL_FUNCTION_PARAMETERS) { ! #if 0 /* not yet supported (blobs ?) */ if (return_value->type==IS_ARRAY) { return_value->type=IS_OBJECT; --- 1956,1962 ---- void php3_ifx_fetch_object(INTERNAL_FUNCTION_PARAMETERS) { ! #if 0 /* not yet supported (blobs ?) */ if (return_value->type==IS_ARRAY) { return_value->type=IS_OBJECT; *************** *** 1557,1566 **** IFX_RES *Ifx_Result; EXEC SQL BEGIN DECLARE SECTION; ! char *ifx; /* connection ID */ ! char *cursorid; /* query cursor id */ ! char *statemid; /* statement id */ ! char *descrpid; /* descriptor id */ EXEC SQL END DECLARE SECTION; int type; --- 1971,1980 ---- IFX_RES *Ifx_Result; EXEC SQL BEGIN DECLARE SECTION; ! char *ifx; /* connection ID */ ! char *cursorid; /* query cursor id */ ! char *statemid; /* statement id */ ! char *descrpid; /* descriptor id */ EXEC SQL END DECLARE SECTION; int type; *************** *** 1595,1604 **** EXEC SQL free :cursorid; for (i = 0; i < MAXBLOBS; ++i) { ! if (Ifx_Result->blob_data[i] != NULL) { ! free(Ifx_Result->blob_data[i]->loc_buffer); ! free(Ifx_Result->blob_data[i]); ! } } EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; --- 2009,2018 ---- EXEC SQL free :cursorid; for (i = 0; i < MAXBLOBS; ++i) { ! if (Ifx_Result->blob_data[i] != NULL) { ! free(Ifx_Result->blob_data[i]->loc_buffer); ! free(Ifx_Result->blob_data[i]); ! } } EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; Index: php3/functions/php3_ifx.h diff -c php3/functions/php3_ifx.h:1.1 php3/functions/php3_ifx.h:1.2 *** php3/functions/php3_ifx.h:1.1 Sat Aug 8 17:06:54 1998 --- php3/functions/php3_ifx.h Tue Aug 11 16:02:05 1998 *************** *** 23,29 **** | If you did not, or have any questions about PHP licensing, please | | contact core@php.net. | +----------------------------------------------------------------------+ ! | Authors: Zeev Suraski <bourbon@netvision.net.il> | +----------------------------------------------------------------------+ */ --- 23,30 ---- | 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> | +----------------------------------------------------------------------+ */ *************** *** 65,70 **** --- 66,72 ---- extern void php3_ifx_fetch_row(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_fetch_object(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_free_result(INTERNAL_FUNCTION_PARAMETERS); + extern void php3_ifx_htmltbl_result(INTERNAL_FUNCTION_PARAMETERS); typedef struct { *************** *** 78,84 **** int cursorid; } ifx_module; ! #define MAXBLOBS 64 typedef struct ifx_res { char connecid[16]; --- 80,87 ---- int cursorid; } ifx_module; ! #define MAXBLOBS 64 ! #define INITIAL_BLOBSIZE 4096 typedef struct ifx_res { char connecid[16]; -- 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 (#107) next »