CVS update: php3/functions
| From: | nyenyon | Date: | Sun, 23 Aug 1998 16:23:07 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-529@lists.php.net to get a copy of this message | ||
Date: Sunday August 23, 1998 @ 12:23
Author: nyenyon
Update of /repository/php3/functions
In directory asf:/tmp/cvs-serv11401/functions
Modified Files:
ifx.ec php3_ifx.h
Log Message:
- full blobsupport (TEXT and BYTE)
- new functions: ifx_create_blob, ifx_copy_blob, ifx_free_blob, ifx_update_blob, ifx_get_blob,
ifx_blobinfile_mode
- file and memory-support of blobs
- load TEXT and BYTE in memory by default (controllable by "ifx.blobinfile" in
php3.ini-file)
- update all functions to support blobs (ifx_query, ifx_prepare, ifx_do, ifx_htmltbl_result,
ifx_fetch_row)
- minor bug-fixes
- Test-Page (informix_blob.php3) which tests the blob-support
Index: php3/functions/ifx.ec
diff -c php3/functions/ifx.ec:1.12 php3/functions/ifx.ec:1.13
*** php3/functions/ifx.ec:1.12 Wed Aug 19 14:46:15 1998
--- php3/functions/ifx.ec Sun Aug 23 12:23:06 1998
***************
*** 59,64 ****
--- 59,78 ----
*
*/
+
+ /*
+ Changes: 23.8.1998 (chc@idgruppe.de)
+ - full blobsupport (TEXT and BYTE)
+ - new functions: ifx_create_blob, ifx_copy_blob, ifx_free_blob, ifx_update_blob, ifx_get_blob,
ifx_blobinfile_mode
+ - file and memory-support of blobs
+ - load TEXT and BYTE in memory by default (controllable by "ifx.blobinfile" in
php3.ini-file)
+ - update all functions to support blobs (ifx_query, ifx_prepare, ifx_do, ifx_htmltbl_result,
ifx_fetch_row)
+ - minor bug-fixes
+ - Test-Page (informix_blob.php3) which tests the blob-support
+
+ */
+
+
#if defined(COMPILE_DL)
#include "dl/phpdl.h"
#endif
***************
*** 90,101 ****
#if HAVE_IFX
- #include <errno.h>
-
- EXEC SQL include sqltypes;
EXEC SQL include locator;
typedef char IFX[128];
#include "php3_list.h"
--- 104,115 ----
#if HAVE_IFX
EXEC SQL include locator;
+ EXEC SQL include sqltypes;
+ #include <errno.h>
+
typedef char IFX[128];
#include "php3_list.h"
***************
*** 112,126 ****
{"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},
{"ifx_num_fields", php3_ifx_num_fields, NULL},
{"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},
{"ifx_fieldtypes", php3_ifx_fieldtypes, NULL},
{"ifx_fieldproperties",php3_ifx_fieldproperties, NULL},
{NULL, NULL, NULL}
};
--- 126,146 ----
{"ifx_error", php3_ifx_error, NULL},
{"ifx_errormsg", php3_ifx_errormsg, NULL},
{"ifx_affected_rows", php3_ifx_affected_rows, NULL},
{"ifx_num_rows", php3_ifx_num_rows, NULL},
{"ifx_num_fields", php3_ifx_num_fields, NULL},
{"ifx_fetch_row", php3_ifx_fetch_row, NULL},
{"ifx_free_result", php3_ifx_free_result, NULL},
{"ifx_htmltbl_result", php3_ifx_htmltbl_result, NULL},
{"ifx_fieldtypes", php3_ifx_fieldtypes, NULL},
{"ifx_fieldproperties",php3_ifx_fieldproperties, NULL},
+
+ {"ifx_create_blob", php3_ifx_create_blob, NULL},
+ {"ifx_free_blob", php3_ifx_free_blob, NULL},
+ {"ifx_get_blob", php3_ifx_get_blob, NULL},
+ {"ifx_update_blob", php3_ifx_update_blob, NULL},
+ {"ifx_blobinfile_mode",php3_ifx_blobinfile_mode, NULL},
+ {"ifx_copy_blob" ,php3_ifx_copy_blob, NULL},
+
{NULL, NULL, NULL}
};
***************
*** 300,305 ****
--- 320,330 ----
TlsSetValue(InformixTls, (void *) ifx_globals);
#endif
+ if (cfg_get_long("ifx.blobinfile",
+ &Informix_GLOBAL(php3_ifx_module).blobinfile)==FAILURE) {
+ Informix_GLOBAL(php3_ifx_module).blobinfile=BLOBINFILE;
+ }
+
if (cfg_get_long("ifx.allow_persistent",
&Informix_GLOBAL(php3_ifx_module).allow_persistent)==FAILURE) {
Informix_GLOBAL(php3_ifx_module).allow_persistent=1;
***************
*** 330,335 ****
--- 355,362 ----
Informix_GLOBAL(php3_ifx_module).num_persistent=0;
Informix_GLOBAL(php3_ifx_module).le_result =
register_list_destructors(ifx_free_result,NULL);
+ Informix_GLOBAL(php3_ifx_module).le_blobresult =
+ register_list_destructors(ifx_free_result,NULL);
Informix_GLOBAL(php3_ifx_module).le_link =
register_list_destructors(_close_ifx_link,NULL);
Informix_GLOBAL(php3_ifx_module).le_plink =
***************
*** 756,767 ****
}
/* ----------------------------------------------------------------------
! ** 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
** also sets "affected_rows for retrieval by ifx_affected_rows
--- 783,796 ----
}
/* ----------------------------------------------------------------------
! ** int ifx_query(string $query, int $connid, [string $hold, [string $scroll]],[blobid,..])
**
** 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-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
***************
*** 770,778 ****
void php3_ifx_query(INTERNAL_FUNCTION_PARAMETERS)
{
pval *query,*ifx_link, *cursortype1, *cursortype2;
int id,type;
-
IFX_RES *Ifx_Result;
EXEC SQL BEGIN DECLARE SECTION;
--- 799,808 ----
void php3_ifx_query(INTERNAL_FUNCTION_PARAMETERS)
{
+ pval *pblobid[10];
+
pval *query,*ifx_link, *cursortype1, *cursortype2;
int id,type;
IFX_RES *Ifx_Result;
EXEC SQL BEGIN DECLARE SECTION;
***************
*** 785,847 ****
int i; /* field index */
short fieldtype;
loc_t *locator;
EXEC SQL END DECLARE SECTION;
int locind;
char *ctype1, *ctype2;
int affected_rows;
Informix_TLS_VARS;
!
! switch(ARG_COUNT(ht)) {
! case 1:
! if (getParameters(ht, 1, &query)==FAILURE) {
! 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) {
! RETURN_FALSE;
! }
! 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;
}
ifx = (char *) php3_list_find(id,&type);
if (type != Informix_GLOBAL(php3_ifx_module).le_link &&
--- 815,845 ----
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;
int locind;
char *ctype1, *ctype2;
int affected_rows;
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 &&
***************
*** 903,932 ****
}
/* initialize result data structure */
!
Ifx_Result->rowid = 0;
strcpy(Ifx_Result->connecid, ifx);
strcpy(Ifx_Result->descrpid, descrpid);
for (i = 0; i < MAXBLOBS; ++i)
! Ifx_Result->blob_data[i] = (loc_t *)NULL;
Ifx_Result->iscursory = -1; /* prevent ifx_do */
!
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)",
statement,
ifx_error(ifx));
! efree(Ifx_Result);
! EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
! EXEC SQL free :statemid;
! RETURN_FALSE;
! }
! Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
} else {
Ifx_Result->affected_rows = affected_rows; /* saved estimated */
EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
if (ifx_check() < 0) {
--- 901,996 ----
}
/* initialize result data structure */
!
Ifx_Result->rowid = 0;
strcpy(Ifx_Result->connecid, ifx);
strcpy(Ifx_Result->descrpid, descrpid);
for (i = 0; i < MAXBLOBS; ++i)
! Ifx_Result->blob_id[i] = -1;
Ifx_Result->iscursory = -1; /* prevent ifx_do */
! Ifx_Result->paramquery=0;
!
if (sqlca.sqlcode != 0) { /* not a select, execute immediate */
! /* ##
! ## NONSELECT-STATEMENT
! ##
! */
!
! strcpy(Ifx_Result->cursorid, "");
! strcpy(Ifx_Result->descrpid, descrpid);
! strcpy(Ifx_Result->statemid, statemid);
!
! if(ARG_COUNT(ht)>2) {
! for(i=0;i<10;i++)
! pblobid[i]=NULL;
! getParameters(ht, ARG_COUNT(ht),
&pblobid[0],&pblobid[1],&pblobid[2],&pblobid[3],&pblobid[4],&pblobid[5],&pblobid[6],&pblobid[7],&pblobid[8],&pblobid[9]);
!
! for(i=1;i<(ARG_COUNT(ht)-1);i++) {
! convert_to_long(pblobid[i+1]);
! locator=php3_intifx_get_blobloc((int)pblobid[i+1]->value.lval,list);
!
! EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA= :*locator, TYPE=:loc_t_type;
! }
! Ifx_Result->paramquery=1;
! EXEC SQL EXECUTE :statemid USING SQL DESCRIPTOR :descrpid;
! } else {
! EXEC SQL EXECUTE :statemid;
! }
! if (ifx_check() < 0) {
! php3_error(E_WARNING,"Execute immediate fails : %s (%s)",
statement,
ifx_error(ifx));
! efree(Ifx_Result);
! EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
! EXEC SQL free :statemid;
! RETURN_FALSE;
! }
! Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
} else {
+ /* ##
+ ** SELECT-STATEMENT
+ **
+ */
+
+ ctype1 = ctype2 = NULL; /* preset */
+
+ switch(ARG_COUNT(ht)) {
+ case 2:
+ break;
+ case 3:
+ if (getParameters(ht, 3,
+ &pblobid[0],
+ &pblobid[1],
+ &cursortype1)==FAILURE) {
+ RETURN_FALSE;
+ }
+ convert_to_long(ifx_link);
+ id = ifx_link->value.lval;
+ convert_to_string(cursortype1);
+ ctype1 = cursortype1->value.str.val;
+ break;
+ case 4:
+ if (getParameters(ht, 4,
+ &pblobid[0],
+ &pblobid[1],
+ &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;
+ }
+
+
+
Ifx_Result->affected_rows = affected_rows; /* saved estimated */
EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
if (ifx_check() < 0) {
***************
*** 990,1017 ****
/* 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 = -1;
! locator->loc_buffer = NULL;
! locator->loc_mflags = 0;
! locator->loc_oflags = 0;
EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
}
}
}
! return_value->value.lval =
! php3_list_insert(Ifx_Result,
! Informix_GLOBAL(php3_ifx_module).le_result);
! return_value->type = IS_LONG;
}
--- 1054,1090 ----
/* 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)) {
!
! int bid;
! if(fieldtype==SQLTEXT) {
! bid=php3_intifx_create_blob(1,0,"",-1,list);
! }
! if(fieldtype==SQLBYTES) {
! if(Informix_GLOBAL(php3_ifx_module).blobinfile==0) {
! bid=php3_intifx_create_blob(0,0,"",-1,list);
! } else {
! blobfilename=php3_intifx_create_tmpfile(i);
! bid=php3_intifx_create_blob(0,1,blobfilename,strlen(blobfilename),list);
! locator=php3_intifx_get_blobloc(bid,list);
! locator->loc_oflags=LOC_WONLY;
! }
! }
! locator=php3_intifx_get_blobloc(bid,list);
! Ifx_Result->blob_id[locind]=bid;
EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
+ ++locind;
}
}
}
!
! RETURN_LONG(php3_list_insert(Ifx_Result,Informix_GLOBAL(php3_ifx_module).le_result));
}
***************
*** 1020,1025 ****
--- 1093,1100 ----
**
** 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
***************
*** 1028,1036 ****
void php3_ifx_prepare(INTERNAL_FUNCTION_PARAMETERS)
{
pval *query,*ifx_link, *cursortype1, *cursortype2;
int id,type;
-
IFX_RES *Ifx_Result;
EXEC SQL BEGIN DECLARE SECTION;
--- 1103,1112 ----
void php3_ifx_prepare(INTERNAL_FUNCTION_PARAMETERS)
{
+ pval *pblobid[10];
+
pval *query,*ifx_link, *cursortype1, *cursortype2;
int id,type;
IFX_RES *Ifx_Result;
EXEC SQL BEGIN DECLARE SECTION;
***************
*** 1043,1111 ****
int i; /* field index */
short fieldtype;
loc_t *locator;
EXEC SQL END DECLARE SECTION;
int locind;
char *ctype1, *ctype2;
int affected_rows;
Informix_TLS_VARS;
!
! switch(ARG_COUNT(ht)) {
! case 1:
! if (getParameters(ht, 1, &query)==FAILURE) {
! 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) {
! RETURN_FALSE;
! }
! 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;
}
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_prepare : %d (type %d) is not a Informix link index",
id,
type);
RETURN_FALSE;
--- 1119,1155 ----
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;
int locind;
char *ctype1, *ctype2;
int affected_rows;
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 &&
type!=Informix_GLOBAL(php3_ifx_module).le_plink) {
php3_error(E_WARNING,
! "ifx_query : %d (type %d) is not a Informix link index",
id,
type);
RETURN_FALSE;
***************
*** 1113,1118 ****
--- 1157,1163 ----
affected_rows = -1; /* invalid */
+
convert_to_string(query);
statement = query->value.str.val;
***************
*** 1134,1142 ****
ifx_error(ifx));
RETURN_FALSE;
}
-
affected_rows = sqlca.sqlerrd[0]; /* save estimated affected rows */
-
EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 256;
if (ifx_check() < 0) {
php3_error(E_WARNING,"Allocate desciptor <%s> fails (%s)",
--- 1179,1185 ----
***************
*** 1163,1182 ****
}
/* initialize result data structure */
!
Ifx_Result->rowid = 0;
strcpy(Ifx_Result->connecid, ifx);
strcpy(Ifx_Result->descrpid, descrpid);
- for (i = 0; i < MAXBLOBS; ++i)
- Ifx_Result->blob_data[i] = (loc_t *)NULL;
strcpy(Ifx_Result->statemid, statemid);
! if (sqlca.sqlcode != 0) { /* not a select */
! strcpy(Ifx_Result->cursorid, "");
! Ifx_Result->iscursory = 0;
! } else { /* cursory, select */
strcpy(Ifx_Result->cursorid, cursorid);
Ifx_Result->iscursory = 1;
EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
if (ifx_check() < 0) {
php3_error(E_WARNING,"Can not get descriptor %s (%s)",
--- 1206,1290 ----
}
/* initialize result data structure */
!
Ifx_Result->rowid = 0;
strcpy(Ifx_Result->connecid, ifx);
strcpy(Ifx_Result->descrpid, descrpid);
strcpy(Ifx_Result->statemid, statemid);
+ for (i = 0; i < MAXBLOBS; ++i)
+ Ifx_Result->blob_id[i] = -1;
+ Ifx_Result->iscursory = -1; /* prevent ifx_do */
+ Ifx_Result->paramquery=0;
! if (sqlca.sqlcode != 0) { /* not a select, execute immediate */
! /* ##
! ## NONSELECT-STATEMENT
! ##
! */
! strcpy(Ifx_Result->cursorid, cursorid);
! Ifx_Result->iscursory = 0;
! strcpy(Ifx_Result->cursorid, "");
! strcpy(Ifx_Result->descrpid, descrpid);
!
! if(ARG_COUNT(ht)>2) {
! for(i=0;i<10;i++)
! pblobid[i]=NULL;
! getParameters(ht, ARG_COUNT(ht),
&pblobid[0],&pblobid[1],&pblobid[2],&pblobid[3],&pblobid[4],&pblobid[5],&pblobid[6],&pblobid[7],&pblobid[8],&pblobid[9]);
!
! for(i=1;i<(ARG_COUNT(ht)-1);i++) {
! convert_to_long(pblobid[i+1]);
! locator=php3_intifx_get_blobloc((int)pblobid[i+1]->value.lval,list);
!
! EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA= :*locator, TYPE=:loc_t_type;
! } /* for */
! Ifx_Result->paramquery=1;
! } /* if */
! } else {
! /* ##
! ** SELECT-STATEMENT
! **
! */
!
! ctype1 = ctype2 = NULL; /* preset */
!
! switch(ARG_COUNT(ht)) {
! case 2:
! break;
! case 3:
! if (getParameters(ht, 3,
! &pblobid[0],
! &pblobid[1],
! &cursortype1)==FAILURE) {
! RETURN_FALSE;
! }
! convert_to_long(ifx_link);
! id = ifx_link->value.lval;
! convert_to_string(cursortype1);
! ctype1 = cursortype1->value.str.val;
! break;
! case 4:
! if (getParameters(ht, 4,
! &pblobid[0],
! &pblobid[1],
! &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;
! }
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)",
***************
*** 1204,1219 ****
if (strcasecmp(ctype2,"HOLD") == 0)
Ifx_Result->ishold = 1;
}
- } /* end cursory select */
-
- Ifx_Result->affected_rows = affected_rows; /* saved estimated */
! return_value->value.lval =
! php3_list_insert(Ifx_Result,
! Informix_GLOBAL(php3_ifx_module).le_result);
! return_value->type = IS_LONG;
}
/* ----------------------------------------------------------------------
--- 1312,1324 ----
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));
}
/* ----------------------------------------------------------------------
***************
*** 1247,1252 ****
--- 1352,1359 ----
EXEC SQL END DECLARE SECTION;
int locind;
+ char *blobfilename;
+ char *blobdir;
Informix_TLS_VARS;
***************
*** 1285,1299 ****
result->value.lval);
RETURN_FALSE;
}
! if (! Ifx_Result->iscursory) { /* execute immediate */
! EXEC SQL EXECUTE :statemid;
! if (ifx_check() < 0) {
! php3_error(E_WARNING,"Execute immediate fails : %s (%s)",
! statemid,
ifx_error(ifx));
! RETURN_FALSE;
! }
! Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
} else { /* open cursor */
if (Ifx_Result->isscroll)
if (Ifx_Result->ishold)
--- 1392,1409 ----
result->value.lval);
RETURN_FALSE;
}
! if (Ifx_Result->iscursory==0) { /* execute immediate */
! if(Ifx_Result->paramquery!=0) {
! EXEC SQL EXECUTE :statemid USING SQL DESCRIPTOR :descrpid;
! } else {
! EXEC SQL EXECUTE :statemid;
! }
! if (ifx_check() < 0) {
! php3_error(E_WARNING,"Execute immediate fails : %s ",
ifx_error(ifx));
! RETURN_FALSE;
! }
! Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
} else { /* open cursor */
if (Ifx_Result->isscroll)
if (Ifx_Result->ishold)
***************
*** 1305,1311 ****
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));
RETURN_FALSE;
--- 1415,1421 ----
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));
RETURN_FALSE;
***************
*** 1317,1345 ****
}
/* 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 = -1;
! locator->loc_buffer = NULL;
! locator->loc_mflags = 0;
! locator->loc_oflags = 0;
EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
}
}
!
} /* end open cursor */
RETURN_TRUE;
}
/* ----------------------------------------------------------------------
** string ifx_error(int connection_id);
**
--- 1427,1469 ----
}
/* 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)) {
!
! int bid;
! if(fieldtype==SQLTEXT) {
! bid=php3_intifx_create_blob(1,0,"",-1,list);
! }
! if(fieldtype==SQLBYTES) {
! if(Informix_GLOBAL(php3_ifx_module).blobinfile==0) {
! bid=php3_intifx_create_blob(0,0,"",-1,list);
! } else {
! blobfilename=php3_intifx_create_tmpfile(i);
! bid=php3_intifx_create_blob(0,1,blobfilename,strlen(blobfilename),list);
! locator=php3_intifx_get_blobloc(bid,list);
! locator->loc_oflags=LOC_WONLY;
! }
! }
! locator=php3_intifx_get_blobloc(bid,list);
! Ifx_Result->blob_id[locind]=bid;
EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
+ ++locind;
}
}
!
} /* end open cursor */
RETURN_TRUE;
}
+
+
+
/* ----------------------------------------------------------------------
** string ifx_error(int connection_id);
**
***************
*** 1530,1536 ****
datetime dt_data = {0};
decimal dec_data = {0};
short short_data;
! loc_t *locator;
float float_data;
double double_data;
int fetch_row;
--- 1654,1660 ----
datetime dt_data = {0};
decimal dec_data = {0};
short short_data;
! loc_t *locator, *locator_b;
float float_data;
double double_data;
int fetch_row;
***************
*** 1538,1551 ****
int type;
int num_fields;
! int locind;
char string_data[256];
long long_data;
char *p;
FILE *fp;
char *blobfilename;
- char *blobdir;
char *fetch_pos;
--- 1662,1674 ----
int type;
int num_fields;
! int locind,bid,bid_b;
char string_data[256];
long long_data;
char *p;
FILE *fp;
char *blobfilename;
char *fetch_pos;
***************
*** 1628,1638 ****
php3_error(E_WARNING, "invalid positioning arg on fetch");
}}}}}
}
! }
switch (ifx_check()) {
case IFX_ERROR:
- if (SQLCODE == -451)
- php3_error(E_WARNING,"blob too large");
php3_error(E_WARNING,
"Can not fetch row on cursor %s (%s)",
ifx_error(ifx),
--- 1751,1760 ----
php3_error(E_WARNING, "invalid positioning arg on fetch");
}}}}}
}
! }
! if(SQLCODE!=-451) {
switch (ifx_check()) {
case IFX_ERROR:
php3_error(E_WARNING,
"Can not fetch row on cursor %s (%s)",
ifx_error(ifx),
***************
*** 1644,1651 ****
break;
default:
break;
}
-
Ifx_Result->rowid++;
if (array_init(return_value)==FAILURE) {
--- 1766,1773 ----
break;
default:
break;
+ }
}
Ifx_Result->rowid++;
if (array_init(return_value)==FAILURE) {
***************
*** 1653,1661 ****
}
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,
--- 1775,1780 ----
***************
*** 1674,1683 ****
*p = 0;
if (indicator == -1) { /* NULL */
! add_assoc_string(return_value, fieldname, "NULL", DUP);
! if ((fieldtype == SQLBYTES) || (fieldtype == SQLTEXT))
! ++locind;
! continue;
}
switch (fieldtype) {
case SQLSERIAL :
--- 1793,1802 ----
*p = 0;
if (indicator == -1) { /* NULL */
! if(fieldtype==SQLTEXT || fieldtype==SQLBYTES)
! ++locind;
! add_assoc_string(return_value, fieldname, "", DUP);
! continue;
}
switch (fieldtype) {
case SQLSERIAL :
***************
*** 1738,1801 ****
add_assoc_string(return_value, fieldname, char_data, DUP);
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_indicator + 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_indicator + 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,
--- 1857,1892 ----
add_assoc_string(return_value, fieldname, char_data, DUP);
efree(char_data);
char_data = NULL;
break;
! case SQLBYTES :
! case SQLTEXT :
! bid_b=Ifx_Result->blob_id[locind];
! locator_b=php3_intifx_get_blobloc(bid_b,list);
!
! EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator_b = DATA;
! if (locator_b->loc_status < 0) { /* blob too large */
php3_error(E_WARNING,"no memory (%d bytes) for blob",
! locator_b->loc_bufsize);
RETURN_FALSE;
}
! if(locator_b->loc_indicator==-1) {
! add_assoc_string(return_value, fieldname, "", DUP);
! ++locind;
! break;
}
!
! bid=php3_intifx_copy_blob(bid_b, list);
!
! if(locator_b->loc_loctype==LOCFNAME) {
! blobfilename=php3_intifx_create_tmpfile(bid_b);
! php3_intifx_update_blob(bid_b,blobfilename,strlen(blobfilename),list);
! efree(blobfilename);
! EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA= :*locator_b;
! }
! ++locind;
!
! add_assoc_long(return_value,fieldname,bid);
! break;
default :
sprintf(string_data,"ESQL/C : %s : unsupported field type[%d]",
fieldname,
***************
*** 1808,2107 ****
}
}
- /* ----------------------------------------------------------------------
- ** 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;
- 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;
-
- Informix_TLS_VARS;
-
- switch (ARG_COUNT(ht)) {
- case 2:
- if (getParameters(ht, 2, &result, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- 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 (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;
- descrpid = Ifx_Result->descrpid;
- 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 ((blobdir = getenv("php3_blobdir")) == NULL)
- blobdir = ".";
-
- /* 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,
- :fieldleng = LENGTH,
- :indicator = INDICATOR;
- if (ifx_check() < 0) {
- php3_error(E_WARNING,"ifx_result : get descriptor for field %d fails (%s)",
- field_ind,
- 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 =
- (char *)safe_estrndup("NULL",return_value->value.str.len);
- return;
- }
-
- i = field_ind; /* field_index */
-
- char_data = NULL;
- 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);
- break;
- case SQLSMINT :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :short_data = DATA;
- 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;
- memset(string_data, 0x20, 64);
- dectoasc(&dec_data, string_data, 63, -1);
- for (p =string_data; *p != ' '; ++p) ;
- *p = 0;
- break;
- case SQLDATE :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :date_data = DATA;
- rdatestr(date_data, string_data);
- break;
- case SQLDTIME :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dt_data = DATA;
- dttoasc(&dt_data, string_data);
- break;
- case SQLINTERVAL:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :intvl_data = DATA;
- intoasc(&intvl_data, 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;
- 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_indicator + 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 = locator->loc_size;
- 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_indicator + 4;
- locator->loc_buffer = (char *)malloc(locator->loc_bufsize + 4);
- 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,
- fieldleng);
- break;
- }
-
- if (char_data != NULL)
- p = char_data;
- else
- p = string_data;
-
- if (php3_ini.magic_quotes_runtime) {
- return_value->value.str.val =
- _php3_addslashes(p, strlen(p), &return_value->value.str.len, 0);
- } else {
- return_value->value.str.len = strlen(p);
- return_value->value.str.val =
- (char *) safe_estrndup(p, return_value->value.str.len);
- }
-
- if (char_data != NULL) efree(char_data);
- char_data = NULL;
-
- return_value->type = IS_STRING;
- }
-
-
/* ----------------------------------------------------------------------
** int ifx_htmltbl_result(int $resultid, [string $htmltableoptions])
**
--- 1899,1906 ----
***************
*** 2141,2147 ****
short short_data;
float float_data;
double double_data;
! loc_t *locator;
EXEC SQL END DECLARE SECTION;
int type;
--- 1940,1946 ----
short short_data;
float float_data;
double double_data;
! loc_t *locator_b;
EXEC SQL END DECLARE SECTION;
int type;
***************
*** 2150,2161 ****
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;
--- 1949,1961 ----
char string_data[256];
long long_data;
char *p;
! int locind,bid_b;
FILE *fp;
char *blobfilename;
char *blobdir;
char *table_options;
int moredata;
+ int bid;
Informix_TLS_VARS;
***************
*** 2202,2209 ****
EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid;
switch (ifx_check()) {
case IFX_ERROR:
- if (SQLCODE == -451)
- php3_error(E_WARNING,"blob too large");
php3_error(E_WARNING,
"Can not fetch next row on cursor %s (%s)",
ifx_error(ifx),
--- 2002,2007 ----
***************
*** 2270,2279 ****
*p = 0;
if (indicator == -1) { /* NULL */
! php3_printf("<td>NULL</td>");
! if ((fieldtype == SQLBYTES) || (fieldtype == SQLTEXT))
! ++locind;
! continue;
}
switch (fieldtype) {
case SQLSERIAL :
--- 2068,2077 ----
*p = 0;
if (indicator == -1) { /* NULL */
! if(fieldtype==SQLTEXT || fieldtype==SQLBYTES)
! ++locind;
! php3_printf("<td>NULL</td>");
! continue;
}
switch (fieldtype) {
case SQLSERIAL :
***************
*** 2336,2361 ****
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_indicator + 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;
! }
! locator->loc_buffer[locator->loc_size] = 0;
! php3_printf("<td>%s</td>", locator->loc_buffer);
break;
case SQLBYTES :
! ++locind;
! php3_printf("<td>(BLOB)</td>");
break;
default :
sprintf(string_data,"ESQL/C : %s : unsupported field type[%d]",
--- 2134,2143 ----
char_data = NULL;
break;
case SQLTEXT : /* is returned as if a long varchar */
! php3_printf("<td>(TEXT)</td>");
break;
case SQLBYTES :
! php3_printf("<td>(BYTE)</td>");
break;
default :
sprintf(string_data,"ESQL/C : %s : unsupported field type[%d]",
***************
*** 2372,2379 ****
EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid;
switch (ifx_check()) {
case IFX_ERROR:
- if (SQLCODE == -451)
- php3_error(E_WARNING,"blob too large");
php3_error(E_WARNING,
"Can not fetch next row on cursor %s (%s)",
ifx_error(ifx),
--- 2154,2159 ----
***************
*** 2811,2829 ****
- 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;
- }
-
- #endif
- }
-
-
/* ----------------------------------------------------------------------
** int ifx_free_result(int $resultid)
**
--- 2591,2596 ----
***************
*** 2879,2887 ****
}
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]);
}
}
--- 2646,2653 ----
}
for (i = 0; i < MAXBLOBS; ++i) {
! if (Ifx_Result->blob_id[i]>0) {
! php3_intifx_free_blob(Ifx_Result->blob_id[i],list);
}
}
***************
*** 2892,2897 ****
--- 2658,3154 ----
}
#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
+ ** ----------------------------------------------------------------------
+ */
+ void php3_ifx_create_blob(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *pmode, *pparam,*ptype;
+ long id;
+ long mode,type;
+
+ if (ARG_COUNT(ht)!=3 || getParameters(ht, 3, &ptype,&pmode,&pparam)==FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_long(pmode);
+ convert_to_string(pparam);
+ convert_to_long(ptype);
+
+ type=ptype->value.lval;
+ if(type!=0)
+ type=1;
+ mode=pmode->value.lval;
+ if(mode!=0)
+ mode=1;
+
+ id=php3_intifx_create_blob(type,mode,pparam->value.str.val,pparam->value.str.len,list);
+ if(id<0) {
+ RETURN_FALSE;
+ }
+ RETURN_LONG(id);
+ }
+
+ /* ----------------------------------------------------------------------
+ ** internal function
+ ** long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list)
+ **
+ ** 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
+ ** ----------------------------------------------------------------------
+ */
+ long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list) {
+ IFX_BLOBRES *Ifx_blob;
+
+
+ Ifx_blob=emalloc(sizeof(IFX_BLOBRES));
+ if(Ifx_blob==NULL) {
+ php3_error(E_WARNING,"can't create blob-resource");
+ return -1;
+ }
+
+ Ifx_blob->type=(int)type;
+ Ifx_blob->mode=(int)mode;
+
+ if(mode==0) {
+ if(len>=0) {
+ char *content=emalloc(len);
+ if(content==NULL) {
+ php3_error(E_WARNING,"can't create blob-resource");
+ return -1;
+ }
+ memcpy(content,param, len);
+ Ifx_blob->blob_data.loc_loctype=LOCMEMORY;
+ Ifx_blob->blob_data.loc_buffer=content;
+ Ifx_blob->blob_data.loc_bufsize=len;
+ Ifx_blob->blob_data.loc_size=len;
+ Ifx_blob->blob_data.loc_mflags=0;
+ Ifx_blob->blob_data.loc_oflags=0;
+ } else {
+ Ifx_blob->blob_data.loc_loctype=LOCMEMORY;
+ Ifx_blob->blob_data.loc_buffer=NULL;
+ Ifx_blob->blob_data.loc_bufsize=-1;
+ Ifx_blob->blob_data.loc_size=-1;
+ Ifx_blob->blob_data.loc_mflags=0;
+ Ifx_blob->blob_data.loc_oflags=0;
+ }
+ } else {
+ char *filename=emalloc(len+1);
+ if(filename==NULL) {
+ php3_error(E_WARNING,"can't create blob-resource");
+ return -1;
+ }
+ memcpy(filename,param, len);
+ filename[len]=0;
+ Ifx_blob->blob_data.loc_loctype=LOCFNAME;
+ Ifx_blob->blob_data.loc_fname=filename;
+ Ifx_blob->blob_data.loc_oflags=LOC_WONLY;
+ Ifx_blob->blob_data.loc_size=-1;
+ }
+ return php3_list_insert(Ifx_blob,Informix_GLOBAL(php3_ifx_module).le_blobresult);
+ }
+
+
+
+
+ /* ----------------------------------------------------------------------
+ ** int php3_ifx_copy_blob(int bid)
+ **
+ ** duplicates the given blob-object
+ ** bid: Id of Blobobject
+ **
+ ** return false on error otherwise the new Blob-Object-id
+ ** ----------------------------------------------------------------------
+ */
+ void php3_ifx_copy_blob(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *pbid;
+ long newid;
+
+ if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &pbid)==FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_long(pbid);
+
+ newid=php3_intifx_copy_blob(pbid->value.lval,list);
+ if(newid<0) {
+ RETURN_FALSE;
+ }
+
+ RETURN_LONG(newid);
+ }
+
+
+
+ /* ----------------------------------------------------------------------
+ ** internal function
+ ** long php3_intifx_copy_blob(long bid, HashTable *list)
+ **
+ ** duplicates the given blob-object
+ ** bid: Id of Blobobject
+ ** list: internal hashlist of php3
+ **
+ ** return -1 on error otherwise the new Blob-Object-id
+ ** ----------------------------------------------------------------------
+ */
+ long php3_intifx_copy_blob(long bid, HashTable *list) {
+ IFX_BLOBRES *Ifx_blob, *Ifx_blob_orig;
+ loc_t *locator, *locator_orig;
+ int type;
+
+ Ifx_blob_orig = (IFX_BLOBRES *) php3_list_find(bid,&type);
+ if (type!=Informix_GLOBAL(php3_ifx_module).le_blobresult) {
+ php3_error(E_WARNING,"%d is not a Informix blob-result index",
+ bid);
+ return -1;
+ }
+ Ifx_blob=emalloc(sizeof(IFX_BLOBRES));
+ if(Ifx_blob==NULL) {
+ php3_error(E_WARNING,"can't create blob-resource");
+ return -1;
+ }
+
+ Ifx_blob->type=Ifx_blob_orig->type;
+ Ifx_blob->mode=Ifx_blob_orig->mode;
+
+ locator=&(Ifx_blob->blob_data);
+ locator_orig=&(Ifx_blob_orig->blob_data);
+
+ if(Ifx_blob->mode==0) {
+ char *content;
+ if(locator_orig->loc_size>=0 && locator_orig->loc_buffer!=NULL) {
+ if((content=emalloc(locator_orig->loc_size))==NULL) {
+ php3_error(E_WARNING,"can't create blob-resource");
+ return -1;
+ }
+ memcpy(content,locator_orig->loc_buffer, locator_orig->loc_size);
+ locator->loc_buffer=content;
+ locator->loc_bufsize=locator_orig->loc_size;
+ locator->loc_size=locator_orig->loc_size;
+ } else {
+ locator->loc_buffer=NULL;
+ locator->loc_bufsize=-1;
+ locator->loc_size=-1;
+ }
+ locator->loc_loctype=LOCMEMORY;
+ locator->loc_mflags=0;
+ locator->loc_oflags=0;
+ } else {
+ char *filename;
+
+ if((filename=emalloc(strlen(locator_orig->loc_fname)+1))==NULL) {
+ php3_error(E_WARNING,"can't create blob-resource");
+ return -1;
+ }
+ strcpy(filename,locator_orig->loc_fname);
+ locator->loc_loctype=LOCFNAME;
+ locator->loc_fname=filename;
+ locator->loc_size=-1;
+ locator->loc_oflags=locator_orig->loc_oflags;
+ }
+
+ return php3_list_insert(Ifx_blob,Informix_GLOBAL(php3_ifx_module).le_blobresult);
+ }
+
+
+
+ /* ----------------------------------------------------------------------
+ ** int php3_ifx_free_blob(int bid)
+ **
+ ** deletes the blob-object
+ ** bid: Id of Blobobject
+ ** return false on error otherwise true
+ ** ----------------------------------------------------------------------
+ */
+ void php3_ifx_free_blob(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *pid;
+ long ret;
+
+ if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &pid)==FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_long(pid);
+
+ ret=php3_intifx_free_blob(pid->value.lval,list);
+ if(ret<0) {
+ RETURN_FALSE;
+ }
+ RETURN_TRUE;
+ }
+
+ /* ----------------------------------------------------------------------
+ ** internal function
+ ** long php3_intifx_free_blob(long bid, HashTable *list)
+ **
+ ** deletes the blob-object
+ ** bid: Id of Blobobject
+ ** list: internal hashlist of php3
+ **
+ ** return -1 on error otherwise 0
+ ** ----------------------------------------------------------------------
+ */
+ long php3_intifx_free_blob(long bid, HashTable *list) {
+ IFX_BLOBRES *Ifx_blob;
+ int type;
+
+ Ifx_blob = (IFX_BLOBRES *) php3_list_find(bid,&type);
+ if (type!=Informix_GLOBAL(php3_ifx_module).le_blobresult) {
+ php3_error(E_WARNING,"%d is not a Informix blob-result index",
+ bid);
+ return -1;
+ }
+ if(Ifx_blob->mode==0)
+ if(Ifx_blob->blob_data.loc_buffer!=NULL)
+ efree(Ifx_blob->blob_data.loc_buffer);
+ else
+ if(Ifx_blob->blob_data.loc_fname!=NULL)
+ efree(Ifx_blob->blob_data.loc_fname);
+ php3_list_delete(bid);
+ efree(Ifx_blob);
+ return 0;
+ }
+
+
+ /* ----------------------------------------------------------------------
+ ** string php3_ifx_get_blob(int bid)
+ **
+ ** returns the content of the blob-object
+ ** bid: Id of Blobobject
+ ** return the content
+ ** ----------------------------------------------------------------------
+ */
+ void php3_ifx_get_blob(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *pbid;
+ char *content;
+ long len;
+
+
+ if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &pbid)==FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_long(pbid);
+
+ len=php3_intifx_get_blob(pbid->value.lval,list,&content);
+ if(len<0) {
+ RETURN_FALSE;
+ }
+
+ RETURN_STRINGL(content,len,1);
+ }
+
+
+ /* ----------------------------------------------------------------------
+ ** internal function
+ ** long php3_intifx_get_blob(long bid, HashTable *list, char** content)
+ **
+ ** returns the content of the blob-object
+ ** bid: Id of Blobobject
+ ** list: internal hashlist of php3
+ **
+ ** return -1 on error
+ ** returns the pointer to the content in char** content and the amount of content in bytes
+ ** ----------------------------------------------------------------------
+ */
+ long php3_intifx_get_blob(long bid, HashTable *list, char** content) {
+ IFX_BLOBRES *Ifx_blob;
+ int type;
+
+ Ifx_blob = (IFX_BLOBRES *) php3_list_find(bid,&type);
+ if (type!=Informix_GLOBAL(php3_ifx_module).le_blobresult) {
+ php3_error(E_WARNING,"%d is not a Informix blob-result index",
+ bid);
+ return -1;
+ }
+
+ if(Ifx_blob->mode==0) {
+ *content=Ifx_blob->blob_data.loc_buffer;
+ return Ifx_blob->blob_data.loc_size;
+ }
+ *content=Ifx_blob->blob_data.loc_fname;
+ return strlen(Ifx_blob->blob_data.loc_fname);
+ }
+
+
+ /* ----------------------------------------------------------------------
+ ** internal function
+ ** loc_t *php3_intifx_get_blobloc(long bid, HashTable *list)
+ **
+ ** returns the blob-locator-structur
+ ** bid: Id of Blobobject
+ ** list: internal hashlist of php3
+ ** return NULL on error or the pointer to the locator-structur
+ ** ----------------------------------------------------------------------
+ */
+ loc_t *php3_intifx_get_blobloc(long bid, HashTable *list) {
+ IFX_BLOBRES *Ifx_blob;
+ int type;
+
+ Ifx_blob = (IFX_BLOBRES *) php3_list_find(bid,&type);
+ if (type!=Informix_GLOBAL(php3_ifx_module).le_blobresult) {
+ php3_error(E_WARNING,"%d is not a Informix blob-result index",
+ bid);
+ return NULL;
+ }
+
+ return &(Ifx_blob->blob_data);
+ }
+
+
+
+ /* ----------------------------------------------------------------------
+ ** int php3_ifx_update_blob(int bid, string content)
+ **
+ ** updates the content of the blob-object
+ ** bid: Id of Blobobject
+ ** content: string of new data
+ ** return false on error otherwise true
+ ** ----------------------------------------------------------------------
+ */
+
+ void php3_ifx_update_blob(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *pbid,*pparam;
+ long ret;
+
+
+ if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &pbid,&pparam)==FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_long(pbid);
+ convert_to_string(pparam);
+
+
ret=php3_intifx_update_blob(pbid->value.lval,pparam->value.str.val,pparam->value.str.len,list);
+ if(ret<0) {
+ RETURN_FALSE;
+ }
+ RETURN_TRUE;
+ }
+
+
+ /* ----------------------------------------------------------------------
+ ** internal function
+ ** long php3_intifx_update_blob(long bid, char* param, long len, HashTable *list)
+ **
+ ** updates the content of the blob-object
+ ** bid: Id of Blobobject
+ ** param: string of new data
+ ** len: length of string
+ ** list: internal hashlist of php3
+ ** return nothing
+ ** ----------------------------------------------------------------------
+ */
+ long php3_intifx_update_blob(long bid, char* param, long len, HashTable *list) {
+ IFX_BLOBRES *Ifx_blob;
+ int type;
+
+ Ifx_blob = (IFX_BLOBRES *) php3_list_find(bid,&type);
+ if (type!=Informix_GLOBAL(php3_ifx_module).le_blobresult) {
+ php3_error(E_WARNING,"%d is not a Informix blob-result index",
+ bid);
+ return -1;
+ }
+
+ if(Ifx_blob->mode==0) {
+ char *content;
+
+ if(Ifx_blob->blob_data.loc_buffer!=NULL)
+ efree(Ifx_blob->blob_data.loc_buffer);
+ if(len>=0) {
+ if((content=emalloc(len))==NULL) {
+ php3_error(E_WARNING,"can't create blob-resource");
+ return -1;
+ }
+ memcpy(content,param, len);
+ Ifx_blob->blob_data.loc_buffer=content;
+ Ifx_blob->blob_data.loc_bufsize=len;
+ Ifx_blob->blob_data.loc_size=len;
+ } else {
+ Ifx_blob->blob_data.loc_buffer=NULL;
+ Ifx_blob->blob_data.loc_bufsize=-1;
+ Ifx_blob->blob_data.loc_size=-1;
+ }
+ Ifx_blob->blob_data.loc_mflags=0;
+ Ifx_blob->blob_data.loc_oflags=0;
+ } else {
+ char *filename;
+
+ if(Ifx_blob->blob_data.loc_fname!=NULL)
+ efree(Ifx_blob->blob_data.loc_fname);
+ if((filename=emalloc(len+1))==NULL) {
+ php3_error(E_WARNING,"can't create blob-resource");
+ return -1;
+ }
+ memcpy(filename,param, len);
+ filename[len]=0;
+ Ifx_blob->blob_data.loc_fname=filename;
+ Ifx_blob->blob_data.loc_size=-1;
+ }
+ return 0;
+ }
+
+
+
+
+
+
+ char* php3_intifx_create_tmpfile(long bid) {
+ char filename[10];
+ char *blobdir;
+ char *blobfile;
+
+ if ((blobdir = getenv("php3_blobdir")) == NULL)
+ blobdir=".";
+
+ sprintf(filename,"blb%d",bid);
+ blobfile=tempnam(blobdir,filename);
+ free(blobdir);
+ return blobfile;
+ }
+
+
+
+
+ /* ----------------------------------------------------------------------
+ ** void php3_ifx_blobinfile_mode(int $mode)
+ **
+ ** sets the default blob-mode for all select-queries
+ ** mode=0: save Byte-Blobs in momory
+ ** mode=1: save Byte-Blobs in a file
+ ** return nothing
+ ** ----------------------------------------------------------------------
+ */
+ void php3_ifx_blobinfile_mode(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *pmode;
+
+
+ if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &pmode)==FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_long(pmode);
+
+ Informix_GLOBAL(php3_ifx_module).blobinfile=pmode->value.lval;
+ RETURN_TRUE;
+ }
/*
* Local variables:
Index: php3/functions/php3_ifx.h
diff -c php3/functions/php3_ifx.h:1.5 php3/functions/php3_ifx.h:1.6
*** php3/functions/php3_ifx.h:1.5 Sun Aug 16 10:50:44 1998
--- php3/functions/php3_ifx.h Sun Aug 23 12:23:06 1998
***************
*** 44,49 ****
--- 44,50 ----
#endif
#include "locator.h"
+ #include "sqltypes.h"
extern php3_module_entry ifx_module_entry;
#define ifx_module_ptr &ifx_module_entry
***************
*** 61,90 ****
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);
extern void php3_ifx_num_fields(INTERNAL_FUNCTION_PARAMETERS);
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);
extern void php3_ifx_fieldtypes(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_fieldproperties(INTERNAL_FUNCTION_PARAMETERS);
typedef struct {
long default_link;
long num_links,num_persistent;
long max_links,max_persistent;
long allow_persistent;
! int le_result,le_link,le_plink;
char *default_host, *default_user, *default_password;
int connectionid;
int cursorid;
} ifx_module;
#define MAXBLOBS 64
! #define INITIAL_BLOBSIZE 4096
typedef struct ifx_res {
char connecid[16];
--- 62,103 ----
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_num_rows(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_num_fields(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_fetch_row(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_free_result(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_htmltbl_result(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_fieldtypes(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_fieldproperties(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_ifx_create_blob(INTERNAL_FUNCTION_PARAMETERS);
+ extern long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list);
+ extern void php3_ifx_free_blob(INTERNAL_FUNCTION_PARAMETERS) ;
+ extern long php3_intifx_free_blob(long id, HashTable *list);
+ extern void php3_ifx_get_blob(INTERNAL_FUNCTION_PARAMETERS);
+ extern long php3_intifx_get_blob(long bid, HashTable *list, char** content);
+ extern void php3_ifx_update_blob(INTERNAL_FUNCTION_PARAMETERS);
+ extern long php3_intifx_update_blob(long bid, char* param, long len, HashTable *list);
+ extern loc_t *php3_intifx_get_blobloc(long bid, HashTable *list);
+ extern char* php3_intifx_create_tmpfile(long bid);
+ extern void php3_ifx_blobinfile_mode(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_ifx_copy_blob(INTERNAL_FUNCTION_PARAMETERS);
+ extern long php3_intifx_copy_blob(long bid, HashTable *list);
typedef struct {
long default_link;
long num_links,num_persistent;
long max_links,max_persistent;
long allow_persistent;
! int le_result,le_link,le_plink,le_blobresult;
char *default_host, *default_user, *default_password;
int connectionid;
int cursorid;
+ long blobinfile; /* 0=save in memory, 1=save in file */
} ifx_module;
#define MAXBLOBS 64
! #define BLOBINFILE 0 /* 0=in memory, 1=in file */
typedef struct ifx_res {
char connecid[16];
***************
*** 94,104 ****
int isscroll;
int ishold;
int iscursory;
int numcols;
int rowid;
int affected_rows;
! loc_t *blob_data[MAXBLOBS];
} IFX_RES;
#ifndef THREAD_SAFE
extern ifx_module php3_ifx_module;
--- 107,126 ----
int isscroll;
int ishold;
int iscursory;
+ int paramquery;
int numcols;
int rowid;
int affected_rows;
! int blob_id[MAXBLOBS];
} IFX_RES;
+
+
+ typedef struct ifx_blobres {
+ loc_t blob_data;
+ int type;
+ int mode;
+ } IFX_BLOBRES;
+
#ifndef THREAD_SAFE
extern ifx_module php3_ifx_module;
--
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