CVS update: php3/functions

From: Date: Sat, 15 Aug 1998 17:47:17 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-264@lists.php.net to get a copy of this message
Date: Saturday August 15, 1998 @ 13:47 Author: danny Update of /repository/php3/functions In directory asf:/tmp/cvs-serv18666/functions Modified Files: ifx.ec php3_ifx.h Log Message: 1. removed ifx_create_db and ifx_drop_db, as you can do this with ifx_query 2. added 2 optional cursortype arguments ("scroll" and "hold)" to ifx_query for creating scrol, hold or scroll and hold cursors on selects 3. added 1 optional position ("first", "next", "last", "previous", "current") argument to ifx_fetch_row for use with scroll cursors 4. added function "string ifx_errormsg([errorcode])" : it returns the Informix error message corresponding with errorcode, or the text of the last Informix error (SQLCODE) if errorcode is absent. 5. commented the exposed functions in the source : just do "grep '^\*\*' ifx.ec" to get a short function reference Index: php3/functions/ifx.ec diff -c php3/functions/ifx.ec:1.7 php3/functions/ifx.ec:1.8 *** php3/functions/ifx.ec:1.7 Thu Aug 13 16:08:05 1998 --- php3/functions/ifx.ec Sat Aug 15 13:47:17 1998 *************** *** 27,32 **** --- 27,37 ---- | 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 + * ------------------------------------------------------------------- + */ /* * I started with the mysql-driver, removed all stuff I did not need, * and changed all mysql-specific stuff to Informix-ESQL/C. *************** *** 44,54 **** * ? 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 --- 49,57 ---- * ? 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 *************** *** 103,112 **** {"ifx_connect", php3_ifx_connect, NULL}, {"ifx_pconnect", php3_ifx_pconnect, NULL}, {"ifx_close", php3_ifx_close, NULL}, - {"ifx_create_db", php3_ifx_create_db, NULL}, - {"ifx_drop_db", php3_ifx_drop_db, NULL}, {"ifx_query", php3_ifx_query, NULL}, {"ifx_error", php3_ifx_error, NULL}, {"ifx_affected_rows", php3_ifx_affected_rows, NULL}, {"ifx_result", php3_ifx_result, NULL}, {"ifx_num_rows", php3_ifx_num_rows, NULL}, --- 106,114 ---- {"ifx_connect", php3_ifx_connect, NULL}, {"ifx_pconnect", php3_ifx_pconnect, NULL}, {"ifx_close", php3_ifx_close, NULL}, {"ifx_query", php3_ifx_query, NULL}, {"ifx_error", php3_ifx_error, NULL}, + {"ifx_errormsg", php3_ifx_errormsg, NULL}, {"ifx_affected_rows", php3_ifx_affected_rows, NULL}, {"ifx_result", php3_ifx_result, NULL}, {"ifx_num_rows", php3_ifx_num_rows, NULL}, *************** *** 207,213 **** PARAMETER char *ifx; EXEC SQL END DECLARE SECTION; { ! static char ifx_err_msg[81]; char c; switch (ifx_check()) { --- 209,215 ---- PARAMETER char *ifx; EXEC SQL END DECLARE SECTION; { ! char *ifx_err_msg; char c; switch (ifx_check()) { *************** *** 227,232 **** --- 229,235 ---- c = '?'; break; } + ifx_err_msg = emalloc(64); sprintf(ifx_err_msg,"%c [SQLSTATE=%c%c %c%c%c SQLCODE=%d]", c, SQLSTATE[0], *************** *** 370,376 **** return SUCCESS; } - void php3_info_ifx(void) { char maxp[16],maxl[16]; --- 373,378 ---- *************** *** 413,418 **** --- 415,428 ---- ); } + /* ---------------------------------------------------------------------- + ** int ifx_(p)connect($database,$userid,$password) + ** + ** connects to $database (db@server syntax) using $userid and $password + ** + ** returns a connection id on success or FALSE one error + ** ---------------------------------------------------------------------- + */ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) { *************** *** 689,694 **** --- 699,712 ---- php3_ifx_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); } + /* ---------------------------------------------------------------------- + ** int ifx_close(int $connid) + ** + ** closes connection $connid + ** always returns TRUE + ** ---------------------------------------------------------------------- + */ + void php3_ifx_close(INTERNAL_FUNCTION_PARAMETERS) { pval *ifx_link; *************** *** 737,855 **** - void php3_ifx_create_db(INTERNAL_FUNCTION_PARAMETERS) - { - pval *db,*ifx_link; - int id,type; - - EXEC SQL BEGIN DECLARE SECTION; - char *ifx; - char statement[512]; - EXEC SQL END DECLARE SECTION; - - Informix_TLS_VARS; - - - switch(ARG_COUNT(ht)) { - case 1: - if (getParameters(ht, 1, &db)==FAILURE) { - RETURN_FALSE; - } - id = php3_ifx_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - break; - case 2: - if (getParameters(ht, 2, &db, &ifx_link)==FAILURE) { - RETURN_FALSE; - } - convert_to_long(ifx_link); - id = ifx_link->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - - CHECK_LINK(id); - - ifx = (char *) php3_list_find(id,&type); - if (type!=Informix_GLOBAL(php3_ifx_module).le_link && type!=Informix_GLOBAL(php3_ifx_module).le_plink) { - php3_error(E_WARNING, - "ifx_create_db : %d (type %d) is not a Informix link index", - id, - type); - RETURN_FALSE; - } - - convert_to_string(db); - sprintf(statement, "create database %s", db->value.str.val); - EXEC SQL SET CONNECTION :ifx; - EXEC SQL EXECUTE IMMEDIATE :statement; - if (ifx_check() != IFX_SUCCESS) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } - } - - - void php3_ifx_drop_db(INTERNAL_FUNCTION_PARAMETERS) - { - pval *db,*ifx_link; - int id,type; - - EXEC SQL BEGIN DECLARE SECTION; - char *ifx; - char statement[512]; - EXEC SQL END DECLARE SECTION; - - Informix_TLS_VARS; - - - switch(ARG_COUNT(ht)) { - case 1: - if (getParameters(ht, 1, &db)==FAILURE) { - RETURN_FALSE; - } - id = php3_ifx_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - break; - case 2: - if (getParameters(ht, 2, &db, &ifx_link)==FAILURE) { - RETURN_FALSE; - } - convert_to_long(ifx_link); - id = ifx_link->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - - CHECK_LINK(id); - - ifx = (char *) php3_list_find(id,&type); - if (type!=Informix_GLOBAL(php3_ifx_module).le_link && type!=Informix_GLOBAL(php3_ifx_module).le_plink) { - php3_error(E_WARNING, - "ifx_drop_db : %d (type %d) is not a Informix link index", - id, - type); - RETURN_FALSE; - } - - convert_to_string(db); - sprintf(statement, "drop database %s", db->value.str.val); - EXEC SQL SET CONNECTION :ifx; - EXEC SQL EXECUTE IMMEDIATE :statement; - if (ifx_check() != IFX_SUCCESS) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } - } void php3_ifx_query(INTERNAL_FUNCTION_PARAMETERS) { ! pval *query,*ifx_link; int id,type; IFX_RES *Ifx_Result; --- 755,776 ---- + /* ---------------------------------------------------------------------- + ** int ifx_query(string $query, int $connid, [string $hold, [string $scroll]]) + ** + ** 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" + ** + ** returns a "result id" on success or FALSE on error + ** ---------------------------------------------------------------------- + */ void php3_ifx_query(INTERNAL_FUNCTION_PARAMETERS) { ! pval *query,*ifx_link, *cursortype1, *cursortype2; int id,type; IFX_RES *Ifx_Result; *************** *** 867,872 **** --- 788,794 ---- EXEC SQL END DECLARE SECTION; int locind; + char *ctype1, *ctype2; Informix_TLS_VARS; *************** *** 877,882 **** --- 799,805 ---- RETURN_FALSE; } id = php3_ifx_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); + ctype1 = ctype2 = NULL; break; case 2: if (getParameters(ht, 2, &query, &ifx_link)==FAILURE) { *************** *** 884,890 **** --- 807,842 ---- } convert_to_long(ifx_link); id = ifx_link->value.lval; + ctype1 = ctype2 = NULL; break; + case 3: + if (getParameters(ht, 3, + &query, + &ifx_link, + &cursortype1)==FAILURE) { + RETURN_FALSE; + } + convert_to_long(ifx_link); + id = ifx_link->value.lval; + ctype2 = NULL; + convert_to_string(cursortype1); + ctype1 = cursortype1->value.str.val; + break; + case 4: + if (getParameters(ht, 4, + &query, + &ifx_link, + &cursortype1, + &cursortype2)==FAILURE) { + RETURN_FALSE; + } + convert_to_long(ifx_link); + id = ifx_link->value.lval; + convert_to_string(cursortype1); + ctype1 = cursortype1->value.str.val; + convert_to_string(cursortype2); + ctype2 = cursortype2->value.str.val; + break; default: WRONG_PARAM_COUNT; break; *************** *** 908,913 **** --- 860,866 ---- sprintf(statemid, "statem%x", Informix_GLOBAL(php3_ifx_module).cursorid); sprintf(cursorid, "cursor%x", Informix_GLOBAL(php3_ifx_module).cursorid); sprintf(descrpid, "descrp%x", Informix_GLOBAL(php3_ifx_module).cursorid); + EXEC SQL set connection :ifx; if (ifx_check() < 0) { php3_error(E_WARNING,"Set connection %s fails (%s)", *************** *** 917,924 **** } EXEC SQL PREPARE :statemid FROM :statement; if (ifx_check() < 0) { ! php3_error(E_WARNING,"Prepare <%s> fails (%s)", ! statement, ifx_error(ifx)); RETURN_FALSE; } --- 870,876 ---- } EXEC SQL PREPARE :statemid FROM :statement; if (ifx_check() < 0) { ! php3_error(E_WARNING,"Prepare fails (%s)", ifx_error(ifx)); RETURN_FALSE; } *************** *** 927,944 **** --- 879,901 ---- php3_error(E_WARNING,"Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx)); + EXEC SQL free :statemid; RETURN_FALSE; } EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid; if (ifx_check() < 0) { php3_error(E_WARNING,"Describe fails (%s)", ifx_error(ifx)); + EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; + EXEC SQL free :statemid; RETURN_FALSE; } Ifx_Result = (IFX_RES *)emalloc(sizeof(IFX_RES)); if (Ifx_Result == NULL) { php3_error(E_WARNING,"Out of memory allocating IFX_RES"); + EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; + EXEC SQL free :statemid; RETURN_FALSE; } *************** *** 960,965 **** --- 917,924 ---- statement, ifx_error(ifx)); efree(Ifx_Result); + EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; + EXEC SQL free :statemid; RETURN_FALSE; } } else { *************** *** 968,987 **** php3_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx)); RETURN_FALSE; } Ifx_Result->numcols = fieldcount; ! ! EXEC SQL DECLARE :cursorid CURSOR FOR :statemid; if (ifx_check() < 0) { php3_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx)); efree(Ifx_Result); RETURN_FALSE; } EXEC SQL OPEN :cursorid; if (ifx_check() < 0) { php3_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx)); efree(Ifx_Result); RETURN_FALSE; } strcpy(Ifx_Result->cursorid, cursorid); --- 927,980 ---- php3_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx)); + EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; + EXEC SQL free :statemid; RETURN_FALSE; } Ifx_Result->numcols = fieldcount; ! ! Ifx_Result->isscroll = Ifx_Result->ishold = 0; ! if (ctype1 != NULL) { ! if (strcasecmp(ctype1,"SCROLL") == 0) ! Ifx_Result->isscroll = 1; ! else ! if (strcasecmp(ctype1,"HOLD") == 0) ! Ifx_Result->ishold = 1; ! } ! if (ctype2 != NULL) { ! if (strcasecmp(ctype2,"SCROLL") == 0) ! Ifx_Result->isscroll = 1; ! else ! if (strcasecmp(ctype2,"HOLD") == 0) ! Ifx_Result->ishold = 1; ! } ! ! ! if (Ifx_Result->isscroll) ! if (Ifx_Result->ishold) ! EXEC SQL DECLARE :cursorid SCROLL CURSOR WITH HOLD FOR :statemid; ! else ! EXEC SQL DECLARE :cursorid SCROLL CURSOR FOR :statemid; ! else ! if (Ifx_Result->ishold) ! EXEC SQL DECLARE :cursorid CURSOR WITH HOLD FOR :statemid; ! else ! EXEC SQL DECLARE :cursorid CURSOR FOR :statemid; ! if (ifx_check() < 0) { php3_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx)); efree(Ifx_Result); + EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; + EXEC SQL free :statemid; RETURN_FALSE; } EXEC SQL OPEN :cursorid; if (ifx_check() < 0) { php3_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx)); efree(Ifx_Result); + EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; + EXEC SQL free :statemid; + EXEC SQL free :cursorid; RETURN_FALSE; } strcpy(Ifx_Result->cursorid, cursorid); *************** *** 1014,1019 **** --- 1007,1020 ---- return_value->type = IS_LONG; } + /* ---------------------------------------------------------------------- + ** string ifx_error(int connection_id); + ** + ** returns the Informix error codes (SQLSTATE & SQLCODE) + ** + ** connection id is not checked, but remains for comatibility + ** ---------------------------------------------------------------------- + */ void php3_ifx_error(INTERNAL_FUNCTION_PARAMETERS) { pval *ifx_link; *************** *** 1038,1056 **** break; } ! if (id==-1) { ! RETURN_FALSE; } ! ifx = (IFX *) php3_list_find(id,&type); ! if (type!=Informix_GLOBAL(php3_ifx_module).le_link && type!=Informix_GLOBAL(php3_ifx_module).le_plink) { ! php3_error(E_WARNING, ! "ifx_error : %d (type %d) is not a Informix link index", ! id, ! type); ! RETURN_FALSE; } ! ! RETURN_STRING(ifx_error(ifx),1); } --- 1039,1113 ---- break; } ! /* connection id is no longer checked ! * ifx = (IFX *) php3_list_find(id,&type); ! * if (type!=Informix_GLOBAL(php3_ifx_module).le_link ! * && type!=Informix_GLOBAL(php3_ifx_module).le_plink) { ! * php3_error(E_WARNING, ! * "ifx_error : %d (type %d) is not an Informix link index", ! * id, ! * type); ! * } ! */ ! RETURN_STRING(ifx_error(0),0); /* ifx_error returns emalloced string */ ! } ! ! /* ---------------------------------------------------------------------- ! ** string ifx_errormsg([int errorcode]) ! ** ! ** returns the Informix errormessage associated with ! ** the most recent Informix error if SQLCODE is nonzero, or, ! ** when the optional "errocode" param is present, the errormessage ! ** corresponding to "errorcode". ! ** ---------------------------------------------------------------------- ! */ ! ! void php3_ifx_errormsg(INTERNAL_FUNCTION_PARAMETERS) ! { ! pval *errcode; ! ! int ifx_errorcode; ! int msglen, maxmsglen; ! char *ifx_errmsg; ! char * returnmsg; ! ! Informix_TLS_VARS; ! ! switch(ARG_COUNT(ht)) { ! case 0: ! ifx_errorcode = SQLCODE; ! break; ! case 1: ! if (getParameters(ht, 1, &errcode)==FAILURE) { ! RETURN_FALSE; ! } ! convert_to_long(errcode); ! ifx_errorcode = errcode->value.lval; ! break; ! default: ! WRONG_PARAM_COUNT; ! break; } ! ! maxmsglen = 255; ! ifx_errmsg = (char *)malloc(maxmsglen+1); ! if (ifx_errorcode != 0) { ! rgetlmsg(ifx_errorcode, ifx_errmsg, maxmsglen, &msglen); ! if (msglen > maxmsglen) { ! maxmsglen = msglen + 1; ! free(ifx_errmsg); ! ifx_errmsg = (char *)malloc(maxmsglen + 1); ! rgetlmsg(ifx_errorcode, ifx_errmsg, maxmsglen, &msglen); ! } ! } else { ! ifx_errmsg[0] = 0; } ! ! returnmsg = (char *) emalloc(strlen(ifx_errmsg) + 128); ! sprintf(returnmsg,ifx_errmsg, sqlca.sqlerrm); ! free(ifx_errmsg); ! ! RETURN_STRING(returnmsg,0); /* do not dup, emalloced ! */ } *************** *** 1092,1103 **** return_value->value.lval = -1; /* not supported */ return_value->type = IS_LONG; } - void php3_ifx_fetch_row(INTERNAL_FUNCTION_PARAMETERS) { ! pval *result; IFX_RES *Ifx_Result; EXEC SQL BEGIN DECLARE SECTION; --- 1149,1172 ---- return_value->value.lval = -1; /* not supported */ return_value->type = IS_LONG; } + /* ---------------------------------------------------------------------- + ** array ifx_fetch_row(int $resultid, [mixed $position]) + ** + ** fetches the next row, or if using a scroll cursor, and $position + ** is present, the row as given in $position, into an associative + ** array with the fieldnames as key + ** + ** returns FALSE on error + ** + ** $position can be : "FIRST", "NEXT", "LAST", "PREVIOUS", "CURRENT" + ** or an absolute row number + ** ---------------------------------------------------------------------- + */ void php3_ifx_fetch_row(INTERNAL_FUNCTION_PARAMETERS) { ! pval *result, *position; IFX_RES *Ifx_Result; EXEC SQL BEGIN DECLARE SECTION; *************** *** 1126,1131 **** --- 1195,1201 ---- loc_t *locator; float float_data; double double_data; + int fetch_row; EXEC SQL END DECLARE SECTION; int type; *************** *** 1139,1156 **** char *blobfilename; char *blobdir; ! 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); - 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; } --- 1209,1252 ---- char *blobfilename; char *blobdir; ! char *fetch_pos; + Informix_TLS_VARS; ! switch(ARG_COUNT(ht)) { ! case 0: ! WRONG_PARAM_COUNT; ! break; ! case 1: ! if (getParameters(ht, 1, &result)==FAILURE) { ! RETURN_FALSE; ! } ! convert_to_long(result); ! Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); ! fetch_pos = NULL; ! fetch_row = 0; ! break; ! case 2: ! if (getParameters(ht, 2, &result, &position)==FAILURE) { ! RETURN_FALSE; ! } ! convert_to_long(result); ! Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); ! if (position->type != IS_STRING) { ! fetch_pos = NULL; ! fetch_row = position->value.lval; ! } else { ! fetch_pos = position->value.str.val; ! fetch_row = 0; ! } ! break; ! default: ! WRONG_PARAM_COUNT; ! break; } if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { ! php3_error(E_WARNING,"%d is not an Informix result index", result->value.lval); RETURN_FALSE; } *************** *** 1164,1171 **** statemid = Ifx_Result->statemid; descrpid = Ifx_Result->descrpid; fieldcount = Ifx_Result->numcols; ! ! EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid; switch (ifx_check()) { case IFX_ERROR: php3_error(E_WARNING, --- 1260,1296 ---- statemid = Ifx_Result->statemid; descrpid = Ifx_Result->descrpid; fieldcount = Ifx_Result->numcols; ! ! if (! Ifx_Result->isscroll) { ! EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid; ! } else { ! if (fetch_pos == NULL) { ! if (fetch_row != 0) { ! EXEC SQL FETCH ABSOLUTE :fetch_row ! :cursorid USING SQL DESCRIPTOR :descrpid; ! } else { ! EXEC SQL FETCH NEXT :cursorid USING SQL DESCRIPTOR :descrpid; ! } ! } else { ! if (strcasecmp(fetch_pos,"NEXT") == 0) { ! EXEC SQL FETCH NEXT :cursorid USING SQL DESCRIPTOR :descrpid; ! } else { ! if (strcasecmp(fetch_pos,"PREVIOUS") == 0) { ! EXEC SQL FETCH PREVIOUS :cursorid USING SQL DESCRIPTOR :descrpid; ! } else { ! if (strcasecmp(fetch_pos,"FIRST") == 0) { ! EXEC SQL FETCH FIRST :cursorid USING SQL DESCRIPTOR :descrpid; ! } else { ! if (strcasecmp(fetch_pos,"LAST") == 0) { ! EXEC SQL FETCH LAST :cursorid USING SQL DESCRIPTOR :descrpid; ! } else { ! if (strcasecmp(fetch_pos,"CURRENT") == 0) { ! EXEC SQL FETCH CURRENT :cursorid USING SQL DESCRIPTOR :descrpid; ! } else { ! php3_error(E_WARNING, "invalid positioning arg on fetch"); ! }}}}} ! } ! } switch (ifx_check()) { case IFX_ERROR: php3_error(E_WARNING, *************** *** 1341,1346 **** --- 1466,1480 ---- } } + /* ---------------------------------------------------------------------- + ** string ifx_result(int $resultid, mixed field) + ** + ** returns the field pointed to by field (name or number) + ** + ** returns FALSE on error + ** ---------------------------------------------------------------------- + */ + void php3_ifx_result(INTERNAL_FUNCTION_PARAMETERS) { pval *result, *arg2; *************** *** 1626,1631 **** --- 1760,1774 ---- } + /* ---------------------------------------------------------------------- + ** int ifx_htmltbl_result(int $resultid, [string $htmltableoptions]) + ** + ** formats all rows of the $resultid query into a html table + ** the optional second argument is a string of <table> tag options + ** + ** returns the number of rows printed or FALSE on error + ** ---------------------------------------------------------------------- + */ void php3_ifx_htmltbl_result(INTERNAL_FUNCTION_PARAMETERS) { *************** *** 1903,1908 **** --- 2046,2061 ---- } + /* ---------------------------------------------------------------------- + ** array ifx_fieldtypes(int $resultid) + ** + ** returns an associative array with fieldnames as key + ** and SQL fieldtypes as data for query $resultid + ** + ** returns FALSE on error + ** ---------------------------------------------------------------------- + */ + void php3_ifx_fieldtypes(INTERNAL_FUNCTION_PARAMETERS) { *************** *** 2062,2067 **** --- 2215,2232 ---- } + /* ---------------------------------------------------------------------- + ** array ifx_fieldproperties(int $resultid) + ** + ** returns an associative array with fieldnames as key + ** and SQL fieldproperties as data for query $resultid + ** + ** properties are encoded as : "SQLTYPE;length;precision;scale" + ** + ** returns FALSE on error + ** ---------------------------------------------------------------------- + */ + void php3_ifx_fieldproperties(INTERNAL_FUNCTION_PARAMETERS) { pval *result, *arg2; *************** *** 2252,2257 **** --- 2417,2429 ---- return_value->type = IS_LONG; } + /* ---------------------------------------------------------------------- + ** int ifx_num_fields(int $resultid) + ** + ** returns the number of columns in query $resultid + ** or FALSE on error + ** ---------------------------------------------------------------------- + */ void php3_ifx_num_fields(INTERNAL_FUNCTION_PARAMETERS) { *************** *** 2292,2297 **** --- 2464,2479 ---- #endif } + + + /* ---------------------------------------------------------------------- + ** int ifx_free_result(int $resultid) + ** + ** releases resources for querie associated with $resultid + ** + ** returns FALSE on error + ** ---------------------------------------------------------------------- + */ void php3_ifx_free_result(INTERNAL_FUNCTION_PARAMETERS) { Index: php3/functions/php3_ifx.h diff -c php3/functions/php3_ifx.h:1.3 php3/functions/php3_ifx.h:1.4 *** php3/functions/php3_ifx.h:1.3 Thu Aug 13 14:27:43 1998 --- php3/functions/php3_ifx.h Sat Aug 15 13:47:17 1998 *************** *** 55,64 **** extern void php3_ifx_connect(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_pconnect(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_close(INTERNAL_FUNCTION_PARAMETERS); - extern void php3_ifx_create_db(INTERNAL_FUNCTION_PARAMETERS); - extern void php3_ifx_drop_db(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_query(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_error(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_affected_rows(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_result(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_num_rows(INTERNAL_FUNCTION_PARAMETERS); --- 55,63 ---- extern void php3_ifx_connect(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_pconnect(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_close(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_query(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_error(INTERNAL_FUNCTION_PARAMETERS); + extern void php3_ifx_errormsg(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_affected_rows(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_result(INTERNAL_FUNCTION_PARAMETERS); extern void php3_ifx_num_rows(INTERNAL_FUNCTION_PARAMETERS); *************** *** 90,95 **** --- 89,96 ---- char cursorid[16]; char descrpid[16]; char statemid[16]; + int isscroll; + int ishold; int numcols; int rowid; loc_t *blob_data[MAXBLOBS]; -- 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 (#264) next »