CVS update: php3/functions
| From: | nyenyon | Date: | Sat, 24 Oct 1998 19:02:08 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2001@lists.php.net to get a copy of this message | ||
Date: Saturday October 24, 1998 @ 15:02
Author: nyenyon
Update of /repository/php3/functions
In directory asf:/u2/tmp/cvs-serv4558
Modified Files:
ifx.ec php3_ifx.h
Log Message:
- changes the internal structure of IFX_BLOB and IFX_SLOB into one structure. it is now prepared for
general-id-usage
- fixed a lvarchar-bug (i hate esql/c)
Index: php3/functions/ifx.ec
diff -c php3/functions/ifx.ec:1.29 php3/functions/ifx.ec:1.30
*** php3/functions/ifx.ec:1.29 Fri Sep 25 16:08:36 1998
--- php3/functions/ifx.ec Sat Oct 24 15:02:04 1998
***************
*** 89,94 ****
--- 89,98 ----
Changes 25.9.1998 (danny.heijl@cevi.be)
- cursory and non-cursory stored procedures
+ Changes 24.10.1998 (chc@idgruppe.de)
+ - changes the internal structure of IFX_BLOB and IFX_SLOB into one structure. it is now prepared
for general-id-usage
+ - fixed a lvarchar-bug (i hate esql/c)
+
*/
***************
*** 122,132 ****
#include "php3_ifx.h"
#if HAVE_IFX
- #define BL_BYTE 0
- #define BL_TEXT 1
- #define BL_INMEM 0
- #define BL_INFILE 1
#define IFX_SCROLL 1
#define IFX_HOLD 2
--- 126,141 ----
#include "php3_ifx.h"
#if HAVE_IFX
+
+ #define TYPE_BLBYTE 0
+ #define TYPE_BLTEXT 1
+ #define TYPE_SLOB 2
+
+
+ #define BLMODE_INMEM 0
+ #define BLMODE_INFILE 1
+
#define IFX_SCROLL 1
#define IFX_HOLD 2
***************
*** 423,432 ****
Informix_GLOBAL(php3_ifx_module).sv_sqlcode=0;
Informix_GLOBAL(php3_ifx_module).le_result =
register_list_destructors(ifx_free_result,NULL);
! Informix_GLOBAL(php3_ifx_module).le_blobresult =
register_list_destructors(ifx_free_result,NULL);
- Informix_GLOBAL(php3_ifx_module).le_slobresult =
- 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 =
--- 432,439 ----
Informix_GLOBAL(php3_ifx_module).sv_sqlcode=0;
Informix_GLOBAL(php3_ifx_module).le_result =
register_list_destructors(ifx_free_result,NULL);
! Informix_GLOBAL(php3_ifx_module).le_idresult =
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 =
***************
*** 910,915 ****
--- 917,923 ----
loc_t *locator;
int loc_t_type=CLOCATORTYPE; /* WORKAROUND:TYPE=CLOCATORTYPE doesn't work,
don't ask me, why. */
+ fixed binary 'blob' ifx_lo_t *slocator;
EXEC SQL END DECLARE SECTION;
char *blobfilename;
***************
*** 1004,1015 ****
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;
! $ifdef HAVE_IFX_IUS;
! for (i = 0; i < MAXSLOBS; ++i)
! Ifx_Result->slob_id[i] = -1;
! $endif;
cursoryproc = 0;
if (query_type == SQ_EXECPROC) {
--- 1012,1019 ----
Ifx_Result->rowid = 0;
strcpy(Ifx_Result->connecid, ifx);
strcpy(Ifx_Result->descrpid, descrpid);
! for (i = 0; i < MAX_RESID; ++i)
! Ifx_Result->res_id[i] = -1;
cursoryproc = 0;
if (query_type == SQ_EXECPROC) {
***************
*** 1054,1077 ****
while (_php3_hash_get_current_data(pblobidarr->value.ht,
(void **) &tmp) == SUCCESS) {
convert_to_long(tmp);
- locator=php3_intifx_get_blobloc((int)tmp->value.lval,list);
- if(locator==NULL) {
- php3_error(E_WARNING,"%d is not a Informix blob-result index",
- (int)tmp->value.lval);
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- RETURN_FALSE;
- }
- if(locator->loc_loctype==LOCFNAME) {
- locator->loc_oflags=LOC_RONLY;
- }
if ((query_type == SQ_UPDATE) || (query_type == SQ_UPDALL)) {
! EXEC SQL SET DESCRIPTOR :descrpid COUNT = :i;
}
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
- DATA= :*locator,
- TYPE= :loc_t_type;
i++;
_php3_hash_move_forward(pblobidarr->value.ht);
}
--- 1058,1084 ----
while (_php3_hash_get_current_data(pblobidarr->value.ht,
(void **) &tmp) == SUCCESS) {
convert_to_long(tmp);
if ((query_type == SQ_UPDATE) || (query_type == SQ_UPDALL)) {
! EXEC SQL SET DESCRIPTOR :descrpid COUNT = :i;
! }
! /* TEXT/BYTE */
! if(php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLTEXT ||
php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLBYTE) {
! locator=php3_intifx_get_blobloc((int)tmp->value.lval,list);
! if(locator==NULL) {
! php3_error(E_WARNING,"%d is not a Informix blob-result index",
! (int)tmp->value.lval);
! EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
! EXEC SQL free :statemid;
! efree(Ifx_Result);
! RETURN_FALSE;
! }
! if(locator->loc_loctype==LOCFNAME) {
! locator->loc_oflags=LOC_RONLY;
! }
! EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
! DATA= :*locator,
! TYPE= :loc_t_type;
}
i++;
_php3_hash_move_forward(pblobidarr->value.ht);
}
***************
*** 1178,1205 ****
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(BL_TEXT,BL_INMEM,"",-1,list);
locator=php3_intifx_get_blobloc(bid,list);
}
if(fieldtype==SQLBYTES) {
if(Informix_GLOBAL(php3_ifx_module).blobinfile==0) {
! bid=php3_intifx_create_blob(BL_BYTE,BL_INMEM,"",-1,list);
locator=php3_intifx_get_blobloc(bid,list);
} else {
blobfilename=php3_intifx_create_tmpfile(i);
bid=php3_intifx_create_blob(
! BL_BYTE,BL_INFILE,
blobfilename,strlen(blobfilename),list);
locator=php3_intifx_get_blobloc(bid,list);
locator->loc_oflags=LOC_WONLY;
}
}
! Ifx_Result->blob_id[locind]=bid;
! EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
++locind;
}
}
--- 1185,1218 ----
locind = 0;
for (i = 1; i <= fieldcount; ++i) {
EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE;
! if ((fieldtype == SQLTEXT) || (fieldtype == SQLBYTES) || fieldtype==SQLUDTFIXED) {
int bid;
if(fieldtype==SQLTEXT) {
! bid=php3_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,list);
locator=php3_intifx_get_blobloc(bid,list);
+ EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
}
if(fieldtype==SQLBYTES) {
if(Informix_GLOBAL(php3_ifx_module).blobinfile==0) {
! bid=php3_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,list);
locator=php3_intifx_get_blobloc(bid,list);
} else {
blobfilename=php3_intifx_create_tmpfile(i);
bid=php3_intifx_create_blob(
! TYPE_BLBYTE,BLMODE_INFILE,
blobfilename,strlen(blobfilename),list);
locator=php3_intifx_get_blobloc(bid,list);
locator->loc_oflags=LOC_WONLY;
}
+ EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
}
! if(fieldtype==SQLUDTFIXED) {
! bid=php3_intifxus_new_slob(list);
! slocator=php3_intifxus_get_slobloc(bid,list);
! EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*slocator;
! }
! Ifx_Result->res_id[locind]=bid;
++locind;
}
}
***************
*** 1247,1253 ****
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;
--- 1260,1267 ----
short fieldtype;
loc_t *locator;
int loc_t_type=CLOCATORTYPE; /* WORKAROUND: TYPE=CLOCATORTYPE doesn't work,
! don't ask me, why. */
! fixed binary 'blob' ifx_lo_t *slocator;
EXEC SQL END DECLARE SECTION;
char *blobfilename;
***************
*** 1345,1356 ****
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;
! $ifdef HAVE_IFX_IUS;
! for (i = 0; i < MAXSLOBS; ++i)
! Ifx_Result->slob_id[i] = -1;
! $endif;
cursoryproc = 0;
if (query_type == SQ_EXECPROC) {
--- 1359,1366 ----
strcpy(Ifx_Result->connecid, ifx);
strcpy(Ifx_Result->descrpid, descrpid);
strcpy(Ifx_Result->statemid, statemid);
! for (i = 0; i < MAX_RESID; ++i)
! Ifx_Result->res_id[i] = -1;
cursoryproc = 0;
if (query_type == SQ_EXECPROC) {
***************
*** 1394,1400 ****
i=1;
while (_php3_hash_get_current_data(pblobidarr->value.ht,
(void **) &tmp) == SUCCESS) {
! convert_to_long(tmp);
locator=php3_intifx_get_blobloc((int)tmp->value.lval,list);
if(locator==NULL) {
php3_error(E_WARNING,"%d is not a Informix blob-result index",
--- 1404,1415 ----
i=1;
while (_php3_hash_get_current_data(pblobidarr->value.ht,
(void **) &tmp) == SUCCESS) {
! convert_to_long(tmp);
! if ((query_type == SQ_UPDATE) || (query_type == SQ_UPDALL)) {
! EXEC SQL SET DESCRIPTOR :descrpid COUNT = :i;
! }
! /* TEXT/BYTE */
! if(php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLTEXT ||
php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLBYTE) {
locator=php3_intifx_get_blobloc((int)tmp->value.lval,list);
if(locator==NULL) {
php3_error(E_WARNING,"%d is not a Informix blob-result index",
***************
*** 1407,1420 ****
if(locator->loc_loctype==LOCFNAME) {
locator->loc_oflags=LOC_RONLY;
}
- if ((query_type == SQ_UPDATE) || (query_type == SQ_UPDALL)) {
- EXEC SQL SET DESCRIPTOR :descrpid COUNT = :i;
- }
EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
DATA= :*locator,
TYPE=:loc_t_type;
! i++;
! _php3_hash_move_forward(pblobidarr->value.ht);
} /* while */
} /* if paramquery */
Ifx_Result->affected_rows = affected_rows; /* saved estimated */
--- 1422,1433 ----
if(locator->loc_loctype==LOCFNAME) {
locator->loc_oflags=LOC_RONLY;
}
EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
DATA= :*locator,
TYPE=:loc_t_type;
! }
! i++;
! _php3_hash_move_forward(pblobidarr->value.ht);
} /* while */
} /* if paramquery */
Ifx_Result->affected_rows = affected_rows; /* saved estimated */
***************
*** 1499,1504 ****
--- 1512,1518 ----
int i; /* field index */
short fieldtype;
loc_t *locator;
+ fixed binary 'blob' ifx_lo_t *slocator;
EXEC SQL END DECLARE SECTION;
int locind;
***************
*** 1586,1613 ****
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(BL_TEXT,BL_INMEM,"",-1,list);
locator=php3_intifx_get_blobloc(bid,list);
}
if(fieldtype==SQLBYTES) {
if(Informix_GLOBAL(php3_ifx_module).blobinfile==0) {
! bid=php3_intifx_create_blob(BL_BYTE,BL_INMEM,"",-1,list);
locator=php3_intifx_get_blobloc(bid,list);
} else {
blobfilename=php3_intifx_create_tmpfile(i);
bid=php3_intifx_create_blob(
! BL_BYTE,BL_INFILE,
blobfilename,strlen(blobfilename),list);
locator=php3_intifx_get_blobloc(bid,list);
locator->loc_oflags=LOC_WONLY;
}
}
! Ifx_Result->blob_id[locind]=bid;
! EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
++locind;
}
}
--- 1600,1633 ----
locind = 0;
for (i = 1; i <= fieldcount; ++i) {
EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE;
! if ((fieldtype == SQLTEXT) || (fieldtype == SQLBYTES) || fieldtype==SQLUDTFIXED) {
int bid;
if(fieldtype==SQLTEXT) {
! bid=php3_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,list);
locator=php3_intifx_get_blobloc(bid,list);
+ EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
}
if(fieldtype==SQLBYTES) {
if(Informix_GLOBAL(php3_ifx_module).blobinfile==0) {
! bid=php3_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,list);
locator=php3_intifx_get_blobloc(bid,list);
} else {
blobfilename=php3_intifx_create_tmpfile(i);
bid=php3_intifx_create_blob(
! TYPE_BLBYTE,BLMODE_INFILE,
blobfilename,strlen(blobfilename),list);
locator=php3_intifx_get_blobloc(bid,list);
locator->loc_oflags=LOC_WONLY;
}
+ EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
}
! if(fieldtype==SQLUDTFIXED) {
! bid=php3_intifxus_new_slob(list);
! slocator=php3_intifxus_get_slobloc(bid,list);
! EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*slocator;
! }
! Ifx_Result->res_id[locind]=bid;
++locind;
}
}
***************
*** 1809,1814 ****
--- 1829,1835 ----
$ifdef HAVE_IFX_IUS;
ifx_int8_t int8_var;
+ lvarchar *lvar_tmp;
$endif;
short indicator;
***************
*** 1820,1825 ****
--- 1841,1847 ----
decimal dec_data = {0};
short short_data;
loc_t *locator, *locator_b;
+ fixed binary 'blob' ifx_lo_t *slocator;
float float_data;
double double_data;
int fetch_row;
***************
*** 1974,1987 ****
|| (Informix_GLOBAL(php3_ifx_module).byteasvarchar==0
&& fieldtype==SQLBYTES)) {
! bid_b=Ifx_Result->blob_id[locind];
bid=php3_intifx_copy_blob(bid_b, list);
php3_intifx_update_blob(bid,nullstr,strlen(nullstr),list);
add_assoc_long(return_value,fieldname,bid);
++locind;
continue;
}
! if(fieldtype==SQLTEXT || fieldtype==SQLBYTES) {
++locind;
}
add_assoc_string(return_value, fieldname, nullstr, DUP);
--- 1996,2009 ----
|| (Informix_GLOBAL(php3_ifx_module).byteasvarchar==0
&& fieldtype==SQLBYTES)) {
! bid_b=Ifx_Result->res_id[locind];
bid=php3_intifx_copy_blob(bid_b, list);
php3_intifx_update_blob(bid,nullstr,strlen(nullstr),list);
add_assoc_long(return_value,fieldname,bid);
++locind;
continue;
}
! if(fieldtype==SQLTEXT || fieldtype==SQLBYTES || fieldtype==SQLUDTFIXED) {
++locind;
}
add_assoc_string(return_value, fieldname, nullstr, DUP);
***************
*** 2045,2056 ****
add_assoc_string(return_value, fieldname, string_data, DUP);
break;
case SQLLVARCHAR:
case SQLBOOL:
$endif;
- case SQLCHAR :
case SQLVCHAR :
- case SQLNCHAR :
case SQLNVCHAR :
if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
php3_error(E_WARNING, "Out of memory");
RETURN_FALSE;
--- 2067,2092 ----
add_assoc_string(return_value, fieldname, string_data, DUP);
break;
case SQLLVARCHAR:
+ ifx_var_flag(&lvar_tmp,1);
+ EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :lvar_tmp = DATA;
+
+ fieldleng=ifx_var_getlen(&lvar_tmp);
+ if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
+ php3_error(E_WARNING, "Out of memory");
+ RETURN_FALSE;
+ }
+ memcpy(char_data,ifx_var_getdata(&lvar_tmp),fieldleng);
+ ifx_var_dealloc(&lvar_tmp);
+ add_assoc_stringl(return_value, fieldname, char_data, fieldleng,0);
+ break;
+
+
case SQLBOOL:
$endif;
case SQLVCHAR :
case SQLNVCHAR :
+ case SQLCHAR :
+ case SQLNCHAR :
if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
php3_error(E_WARNING, "Out of memory");
RETURN_FALSE;
***************
*** 2064,2072 ****
efree(char_data);
char_data = NULL;
break;
case SQLBYTES :
case SQLTEXT : /* NULL has already been dealt with */
! bid_b=Ifx_Result->blob_id[locind];
locator_b=php3_intifx_get_blobloc(bid_b,list);
++locind;
--- 2100,2120 ----
efree(char_data);
char_data = NULL;
break;
+
+ case SQLUDTFIXED :
+ bid_b=Ifx_Result->res_id[locind];
+ add_assoc_long(return_value,fieldname,bid_b);
+
+ bid=php3_intifxus_new_slob(list);
+ slocator=php3_intifxus_get_slobloc(bid,list);
+ EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*slocator;
+ Ifx_Result->res_id[locind]=bid;
+ ++locind;
+ break;
+
case SQLBYTES :
case SQLTEXT : /* NULL has already been dealt with */
! bid_b=Ifx_Result->res_id[locind];
locator_b=php3_intifx_get_blobloc(bid_b,list);
++locind;
***************
*** 2156,2161 ****
--- 2204,2210 ----
$ifdef HAVE_IFX_IUS;
ifx_int8_t int8_var;
+ lvarchar *lvar_tmp;
$endif;
short indicator;
***************
*** 2368,2373 ****
--- 2417,2435 ----
php3_printf("<td>%s</td>", string_data);
break;
case SQLLVARCHAR:
+ ifx_var_flag(&lvar_tmp,1);
+ EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :lvar_tmp = DATA;
+
+ fieldleng=ifx_var_getlen(&lvar_tmp);
+ if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
+ php3_error(E_WARNING, "Out of memory");
+ RETURN_FALSE;
+ }
+ memcpy(char_data,ifx_var_getdata(&lvar_tmp),fieldleng);
+ ifx_var_dealloc(&lvar_tmp);
+ add_assoc_stringl(return_value, fieldname, char_data, fieldleng,0);
+ break;
+
case SQLBOOL :
$endif;
case SQLCHAR :
***************
*** 2391,2397 ****
/* NULL has already been dealt with */
/* treated always as a long VARCHAR here */
/* if blobinbfile, too bad */
! bid_b=Ifx_Result->blob_id[locind];
++locind;
locator_b=php3_intifx_get_blobloc(bid_b,list);
--- 2453,2459 ----
/* NULL has already been dealt with */
/* treated always as a long VARCHAR here */
/* if blobinbfile, too bad */
! bid_b=Ifx_Result->res_id[locind];
++locind;
locator_b=php3_intifx_get_blobloc(bid_b,list);
***************
*** 2988,3007 ****
Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0;
! for (i = 0; i < MAXBLOBS; ++i) {
! if (Ifx_Result->blob_id[i]>0) {
! php3_intifx2_free_blob(Ifx_Result->blob_id[i],list);
! Ifx_Result->blob_id[i]=-1;
}
}
- $ifdef HAVE_IFX_IUS;
- for (i = 0; i < MAXSLOBS; ++i) {
- if (Ifx_Result->slob_id[i]>0) {
- php3_intifxus_free_slob(Ifx_Result->slob_id[i],list);
- Ifx_Result->slob_id[i]=-1;
- }
- }
- $endif;
cursorid = Ifx_Result->cursorid;
statemid = Ifx_Result->statemid;
--- 3050,3061 ----
Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0;
! for (i = 0; i < MAX_RESID; ++i) {
! if (Ifx_Result->res_id[i]>0) {
! php3_intifx2_free_blob(Ifx_Result->res_id[i],list);
! Ifx_Result->res_id[i]=-1;
}
}
cursorid = Ifx_Result->cursorid;
statemid = Ifx_Result->statemid;
***************
*** 3020,3026 ****
--- 3074,3111 ----
RETURN_TRUE;
}
+
+
+
+
/* ----------------------------------------------------------------------
+ * internal function
+ * long php3_intifx_getType(long id, HashTable *list)
+ *
+ * returns the type of an id-object
+ * bid: Id of object
+ * list: internal hashlist of php3
+ *
+ * return -1 on error otherwise the type: TYPE_BLTEXT, TYPE_BLBYTE, TYPE_SLOB
+ * ----------------------------------------------------------------------
+ */
+ long php3_intifx_getType(long id, HashTable *list) {
+ IFX_IDRES *Ifx_res;
+ int type;
+
+ Ifx_res = (IFX_IDRES *) php3_list_find(id,&type);
+ if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult) {
+ php3_error(E_WARNING,"%d is not a Informix id-result index",
+ id);
+ return -1;
+ }
+ return Ifx_res->type;
+ }
+
+
+
+
+ /* ----------------------------------------------------------------------
** int php3_ifx_create_blob(int type, int mode, string param)
**
** creates an blob-object
***************
*** 3045,3054 ****
type=ptype->value.lval;
if(type!=0)
! type=BL_TEXT;
mode=pmode->value.lval;
if(mode!=0)
! mode=BL_INFILE;
id=php3_intifx_create_blob(type,mode,pparam->value.str.val,pparam->value.str.len,list);
if(id<0) {
--- 3130,3139 ----
type=ptype->value.lval;
if(type!=0)
! type=TYPE_BLTEXT;
mode=pmode->value.lval;
if(mode!=0)
! mode=BLMODE_INFILE;
id=php3_intifx_create_blob(type,mode,pparam->value.str.val,pparam->value.str.len,list);
if(id<0) {
***************
*** 3072,3092 ****
* ----------------------------------------------------------------------
*/
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;
}
! memset(Ifx_blob, 0, sizeof(IFX_BLOBRES));
! Ifx_blob->type=(int)type;
! Ifx_blob->mode=(int)mode;
! if(mode==BL_INMEM) {
if(len>=0) {
char *content=emalloc(len);
if(content==NULL) {
--- 3157,3181 ----
* ----------------------------------------------------------------------
*/
long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list) {
! IFX_IDRES *Ifx_blob;
! Ifx_blob=emalloc(sizeof(IFX_IDRES));
if(Ifx_blob==NULL) {
php3_error(E_WARNING,"can't create blob-resource");
return -1;
}
! memset(Ifx_blob, 0, sizeof(IFX_IDRES));
! if(type==0 ) {
! Ifx_blob->type=TYPE_BLBYTE;
! } else {
! Ifx_blob->type=TYPE_BLTEXT;
! }
! Ifx_blob->BLOB.mode=(int)mode;
! if(mode==BLMODE_INMEM) {
if(len>=0) {
char *content=emalloc(len);
if(content==NULL) {
***************
*** 3094,3114 ****
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 { /* mode = BL_INFILE */
char *filename=emalloc(len+1);
if(filename==NULL) {
php3_error(E_WARNING,"can't create blob-resource");
--- 3183,3203 ----
return -1;
}
memcpy(content,param,len);
! Ifx_blob->BLOB.blob_data.loc_loctype=LOCMEMORY;
! Ifx_blob->BLOB.blob_data.loc_buffer=content;
! Ifx_blob->BLOB.blob_data.loc_bufsize=len;
! Ifx_blob->BLOB.blob_data.loc_size=len;
! Ifx_blob->BLOB.blob_data.loc_mflags=0;
! Ifx_blob->BLOB.blob_data.loc_oflags=0;
} else {
! Ifx_blob->BLOB.blob_data.loc_loctype=LOCMEMORY;
! Ifx_blob->BLOB.blob_data.loc_buffer=NULL;
! Ifx_blob->BLOB.blob_data.loc_bufsize=-1;
! Ifx_blob->BLOB.blob_data.loc_size=-1;
! Ifx_blob->BLOB.blob_data.loc_mflags=0;
! Ifx_blob->BLOB.blob_data.loc_oflags=0;
}
! } else { /* mode = BLMODE_INFILE */
char *filename=emalloc(len+1);
if(filename==NULL) {
php3_error(E_WARNING,"can't create blob-resource");
***************
*** 3116,3127 ****
}
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);
}
--- 3205,3216 ----
}
memcpy(filename,param,len);
filename[len]=0;
! Ifx_blob->BLOB.blob_data.loc_loctype=LOCFNAME;
! Ifx_blob->BLOB.blob_data.loc_fname=filename;
! Ifx_blob->BLOB.blob_data.loc_oflags=LOC_WONLY;
! Ifx_blob->BLOB.blob_data.loc_size=-1;
}
! return php3_list_insert(Ifx_blob,Informix_GLOBAL(php3_ifx_module).le_idresult);
}
***************
*** 3167,3197 ****
* ----------------------------------------------------------------------
*/
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;
}
! memset(Ifx_blob, 0, sizeof(IFX_BLOBRES));
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==BL_INMEM) {
char *content;
if(locator_orig->loc_size>=0 && locator_orig->loc_buffer!=NULL) {
if((content=emalloc(locator_orig->loc_size))==NULL) {
--- 3256,3286 ----
* ----------------------------------------------------------------------
*/
long php3_intifx_copy_blob(long bid, HashTable *list) {
! IFX_IDRES *Ifx_blob, *Ifx_blob_orig;
loc_t *locator, *locator_orig;
int type;
! Ifx_blob_orig = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || !(Ifx_blob_orig->type==TYPE_BLBYTE
|| Ifx_blob_orig->type==TYPE_BLTEXT)) {
php3_error(E_WARNING,"%d is not a Informix blob-result index",
bid);
return -1;
}
! Ifx_blob=emalloc(sizeof(IFX_IDRES));
if(Ifx_blob==NULL) {
php3_error(E_WARNING,"can't create blob-resource");
return -1;
}
! memset(Ifx_blob, 0, sizeof(IFX_IDRES));
Ifx_blob->type=Ifx_blob_orig->type;
! Ifx_blob->BLOB.mode=Ifx_blob_orig->BLOB.mode;
! locator=&(Ifx_blob->BLOB.blob_data);
! locator_orig=&(Ifx_blob_orig->BLOB.blob_data);
! if(Ifx_blob->BLOB.mode==BLMODE_INMEM) {
char *content;
if(locator_orig->loc_size>=0 && locator_orig->loc_buffer!=NULL) {
if((content=emalloc(locator_orig->loc_size))==NULL) {
***************
*** 3210,3216 ****
locator->loc_loctype=LOCMEMORY;
locator->loc_mflags=0;
locator->loc_oflags=0;
! } else { /* BL_INFILE */
char *filename;
if((filename=emalloc(strlen(locator_orig->loc_fname)+1))==NULL) {
--- 3299,3305 ----
locator->loc_loctype=LOCMEMORY;
locator->loc_mflags=0;
locator->loc_oflags=0;
! } else { /* BLMODE_INFILE */
char *filename;
if((filename=emalloc(strlen(locator_orig->loc_fname)+1))==NULL) {
***************
*** 3224,3230 ****
locator->loc_oflags=locator_orig->loc_oflags;
}
! return php3_list_insert(Ifx_blob,Informix_GLOBAL(php3_ifx_module).le_blobresult);
}
--- 3313,3319 ----
locator->loc_oflags=locator_orig->loc_oflags;
}
! return php3_list_insert(Ifx_blob,Informix_GLOBAL(php3_ifx_module).le_idresult);
}
***************
*** 3266,3288 ****
* ----------------------------------------------------------------------
*/
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==BL_INMEM) {
! if(Ifx_blob->blob_data.loc_buffer==NULL
! || Ifx_blob->blob_data.loc_size<=0) {;} else {
! efree(Ifx_blob->blob_data.loc_buffer);
! }
! } else { /* BL_INFILE */
! if(Ifx_blob->blob_data.loc_fname!=NULL) {
! efree(Ifx_blob->blob_data.loc_fname);
}
}
--- 3355,3377 ----
* ----------------------------------------------------------------------
*/
long php3_intifx_free_blob(long bid, HashTable *list) {
! IFX_IDRES *Ifx_blob;
int type;
! Ifx_blob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult &&
!(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
php3_error(E_WARNING,"%d is not a Informix blob-result index",
bid);
return -1;
}
! if(Ifx_blob->BLOB.mode==BLMODE_INMEM) {
! if(Ifx_blob->BLOB.blob_data.loc_buffer==NULL
! || Ifx_blob->BLOB.blob_data.loc_size<=0) {;} else {
! efree(Ifx_blob->BLOB.blob_data.loc_buffer);
! }
! } else { /* BLMODE_INFILE */
! if(Ifx_blob->BLOB.blob_data.loc_fname!=NULL) {
! efree(Ifx_blob->BLOB.blob_data.loc_fname);
}
}
***************
*** 3308,3330 ****
* ----------------------------------------------------------------------
*/
long php3_intifx2_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==BL_INMEM) {
! if(Ifx_blob->blob_data.loc_buffer==NULL ||
! Ifx_blob->blob_data.loc_size<=0) {;} else {
! free(Ifx_blob->blob_data.loc_buffer);
}
} else {
! if(Ifx_blob->blob_data.loc_fname!=NULL) {
! efree(Ifx_blob->blob_data.loc_fname);
}
}
--- 3397,3419 ----
* ----------------------------------------------------------------------
*/
long php3_intifx2_free_blob(long bid, HashTable *list) {
! IFX_IDRES *Ifx_blob;
int type;
! Ifx_blob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult &&
!(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
php3_error(E_WARNING,"%d is not a Informix blob-result index",
bid);
return -1;
}
! if(Ifx_blob->BLOB.mode==BLMODE_INMEM) {
! if(Ifx_blob->BLOB.blob_data.loc_buffer==NULL ||
! Ifx_blob->BLOB.blob_data.loc_size<=0) {;} else {
! free(Ifx_blob->BLOB.blob_data.loc_buffer);
}
} else {
! if(Ifx_blob->BLOB.blob_data.loc_fname!=NULL) {
! efree(Ifx_blob->BLOB.blob_data.loc_fname);
}
}
***************
*** 3373,3394 ****
* ----------------------------------------------------------------------
*/
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==BL_INMEM) {
! *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);
}
--- 3462,3483 ----
* ----------------------------------------------------------------------
*/
long php3_intifx_get_blob(long bid, HashTable *list, char** content) {
! IFX_IDRES *Ifx_blob;
int type;
! Ifx_blob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult &&
!(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
php3_error(E_WARNING,"%d is not a Informix blob-result index",
bid);
return -1;
}
! if(Ifx_blob->BLOB.mode==BLMODE_INMEM) {
! *content=Ifx_blob->BLOB.blob_data.loc_buffer;
! return Ifx_blob->BLOB.blob_data.loc_size;
}
! *content=Ifx_blob->BLOB.blob_data.loc_fname;
! return strlen(Ifx_blob->BLOB.blob_data.loc_fname);
}
***************
*** 3403,3419 ****
* ----------------------------------------------------------------------
*/
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);
}
--- 3492,3508 ----
* ----------------------------------------------------------------------
*/
loc_t *php3_intifx_get_blobloc(long bid, HashTable *list) {
! IFX_IDRES *Ifx_blob;
int type;
! Ifx_blob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult &&
!(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
php3_error(E_WARNING,"%d is not a Informix blob-result index",
bid);
return NULL;
}
! return &(Ifx_blob->BLOB.blob_data);
}
***************
*** 3463,3512 ****
* ----------------------------------------------------------------------
*/
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==BL_INMEM) {
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;
}
--- 3552,3601 ----
* ----------------------------------------------------------------------
*/
long php3_intifx_update_blob(long bid, char* param, long len, HashTable *list) {
! IFX_IDRES *Ifx_blob;
int type;
! Ifx_blob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult &&
!(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
php3_error(E_WARNING,"%d is not a Informix blob-result index",
bid);
return -1;
}
! if(Ifx_blob->BLOB.mode==BLMODE_INMEM) {
char *content;
! if(Ifx_blob->BLOB.blob_data.loc_buffer!=NULL)
! efree(Ifx_blob->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.blob_data.loc_buffer=content;
! Ifx_blob->BLOB.blob_data.loc_bufsize=len;
! Ifx_blob->BLOB.blob_data.loc_size=len;
} else {
! Ifx_blob->BLOB.blob_data.loc_buffer=NULL;
! Ifx_blob->BLOB.blob_data.loc_bufsize=-1;
! Ifx_blob->BLOB.blob_data.loc_size=-1;
}
! Ifx_blob->BLOB.blob_data.loc_mflags=0;
! Ifx_blob->BLOB.blob_data.loc_oflags=0;
} else {
char *filename;
! if(Ifx_blob->BLOB.blob_data.loc_fname!=NULL)
! efree(Ifx_blob->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.blob_data.loc_fname=filename;
! Ifx_blob->BLOB.blob_data.loc_size=-1;
}
return 0;
}
***************
*** 3729,3758 ****
* ----------------------------------------------------------------------
*/
long php3_intifxus_create_slob(long create_mode, HashTable *list) {
! IFX_SLOBRES *Ifx_slob;
int errcode;
! Ifx_slob=emalloc(sizeof(IFX_SLOBRES));
if(Ifx_slob==NULL) {
php3_error(E_WARNING,"can't create slob-resource");
return -1;
}
! errcode=ifx_lo_def_create_spec(&(Ifx_slob->createspec));
if(errcode<0) {
php3_error(E_WARNING,"can't create slob-resource");
return -1;
}
!
!
Ifx_slob->lofd=ifx_lo_create(Ifx_slob->createspec,create_mode,&(Ifx_slob->slobdata),&errcode);
! if(errcode<0 || Ifx_slob->lofd<0) {
php3_error(E_WARNING,"can't create slob-resource");
return -1;
}
! return php3_list_insert(Ifx_slob,Informix_GLOBAL(php3_ifx_module).le_slobresult);
}
--- 3818,3847 ----
* ----------------------------------------------------------------------
*/
long php3_intifxus_create_slob(long create_mode, HashTable *list) {
! IFX_IDRES *Ifx_slob;
int errcode;
! Ifx_slob=emalloc(sizeof(IFX_IDRES));
if(Ifx_slob==NULL) {
php3_error(E_WARNING,"can't create slob-resource");
return -1;
}
! errcode=ifx_lo_def_create_spec(&(Ifx_slob->SLOB.createspec));
if(errcode<0) {
php3_error(E_WARNING,"can't create slob-resource");
return -1;
}
! Ifx_slob->type=TYPE_SLOB;
!
Ifx_slob->SLOB.lofd=ifx_lo_create(Ifx_slob->SLOB.createspec,create_mode,&(Ifx_slob->SLOB.slob_data),&errcode);
! if(errcode<0 || Ifx_slob->SLOB.lofd<0) {
php3_error(E_WARNING,"can't create slob-resource");
return -1;
}
! return php3_list_insert(Ifx_slob,Informix_GLOBAL(php3_ifx_module).le_idresult);
}
***************
*** 3793,3803 ****
* ----------------------------------------------------------------------
*/
long php3_intifxus_free_slob(long bid, HashTable *list) {
! IFX_SLOBRES *Ifx_slob;
int type;
! Ifx_slob = (IFX_SLOBRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_slobresult) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
return -1;
--- 3882,3892 ----
* ----------------------------------------------------------------------
*/
long php3_intifxus_free_slob(long bid, HashTable *list) {
! IFX_IDRES *Ifx_slob;
int type;
! Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
return -1;
***************
*** 3807,3815 ****
if(php3_intifxus_close_slob(bid, list)<0) {
return -1;
}
! if(Ifx_slob->createspec!=NULL) {
! ifx_lo_spec_free(Ifx_slob->createspec);
! Ifx_slob->createspec=NULL;
}
efree(Ifx_slob);
php3_list_delete(bid);
--- 3896,3904 ----
if(php3_intifxus_close_slob(bid, list)<0) {
return -1;
}
! if(Ifx_slob->SLOB.createspec!=NULL) {
! ifx_lo_spec_free(Ifx_slob->SLOB.createspec);
! Ifx_slob->SLOB.createspec=NULL;
}
efree(Ifx_slob);
php3_list_delete(bid);
***************
*** 3855,3882 ****
* ----------------------------------------------------------------------
*/
long php3_intifxus_close_slob(long bid, HashTable *list) {
! IFX_SLOBRES *Ifx_slob;
int type;
! Ifx_slob = (IFX_SLOBRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_slobresult) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
return -1;
}
! if(Ifx_slob->lofd<0) {
php3_error(E_WARNING,"slob-resource already closed");
return -1;
}
! if(ifx_lo_close(Ifx_slob->lofd)<0) {
php3_error(E_WARNING,"can't close slob-resource");
return -1;
}
! Ifx_slob->lofd=-1;
return 0;
}
--- 3944,3971 ----
* ----------------------------------------------------------------------
*/
long php3_intifxus_close_slob(long bid, HashTable *list) {
! IFX_IDRES *Ifx_slob;
int type;
! Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
return -1;
}
! if(Ifx_slob->SLOB.lofd<0) {
php3_error(E_WARNING,"slob-resource already closed");
return -1;
}
! if(ifx_lo_close(Ifx_slob->SLOB.lofd)<0) {
php3_error(E_WARNING,"can't close slob-resource");
return -1;
}
! Ifx_slob->SLOB.lofd=-1;
return 0;
}
***************
*** 3934,3958 ****
* ----------------------------------------------------------------------
*/
long php3_intifxus_open_slob(long bid, long create_mode, HashTable *list) {
! IFX_SLOBRES *Ifx_slob;
int errcode;
int type;
! Ifx_slob = (IFX_SLOBRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_slobresult) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
return -1;
}
! if(Ifx_slob->lofd>0) {
php3_error(E_WARNING,"slob-resource already open");
return -1;
}
! Ifx_slob->lofd=ifx_lo_open(&(Ifx_slob->slobdata),create_mode,&errcode);
! if(errcode<0 || Ifx_slob->lofd<0) {
php3_error(E_WARNING,"can't open slob-resource");
return -1;
}
--- 4023,4047 ----
* ----------------------------------------------------------------------
*/
long php3_intifxus_open_slob(long bid, long create_mode, HashTable *list) {
! IFX_IDRES *Ifx_slob;
int errcode;
int type;
! Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
return -1;
}
! if(Ifx_slob->SLOB.lofd>0) {
php3_error(E_WARNING,"slob-resource already open");
return -1;
}
! Ifx_slob->SLOB.lofd=ifx_lo_open(&(Ifx_slob->SLOB.slob_data),create_mode,&errcode);
! if(errcode<0 || Ifx_slob->SLOB.lofd<0) {
php3_error(E_WARNING,"can't open slob-resource");
return -1;
}
***************
*** 3968,4019 ****
/* ----------------------------------------------------------------------
* internal function
! * long php3_intifx_new_slob(HashTable *list)
*
* creates an slob-object but don't open it
* list: internal hashlist of php3
! * return -1 on error otherwise the new Blob-Object-id
* ----------------------------------------------------------------------
*/
long php3_intifxus_new_slob(HashTable *list) {
! IFX_SLOBRES *Ifx_slob;
int errcode;
! Ifx_slob=emalloc(sizeof(IFX_SLOBRES));
if(Ifx_slob==NULL) {
php3_error(E_WARNING,"can't create slob-resource");
return -1;
}
! Ifx_slob->lofd=-1;
! Ifx_slob->createspec=NULL;
! return php3_list_insert(Ifx_slob,Informix_GLOBAL(php3_ifx_module).le_slobresult);
}
/* ----------------------------------------------------------------------
* internal function
! * ifx_lo_t *php3_intifx_get_slobloc(long bid, HashTable *list)
*
* retuens the ifx_lo_t-structure of a slob-object
* list: internal hashlist of php3
* return -1 on error otherwise the new Blob-Object-id
* ----------------------------------------------------------------------
*/
! ifx_lo_t *php3_intifx_get_slobloc(long bid, HashTable *list) {
! IFX_SLOBRES *Ifx_slob;
int errcode, type;
! Ifx_slob = (IFX_SLOBRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_slobresult) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
return NULL;
}
!
! return &(Ifx_slob->slobdata);
}
--- 4057,4109 ----
/* ----------------------------------------------------------------------
* internal function
! * long php3_intifxus_new_slob(HashTable *list)
*
* creates an slob-object but don't open it
* list: internal hashlist of php3
! * return -1 on error otherwise the new slob-Object-id
* ----------------------------------------------------------------------
*/
long php3_intifxus_new_slob(HashTable *list) {
! IFX_IDRES *Ifx_slob;
int errcode;
! Ifx_slob=emalloc(sizeof(IFX_IDRES));
if(Ifx_slob==NULL) {
php3_error(E_WARNING,"can't create slob-resource");
return -1;
}
! Ifx_slob->type=TYPE_SLOB;
! Ifx_slob->SLOB.lofd=-1;
! Ifx_slob->SLOB.createspec=NULL;
! return php3_list_insert(Ifx_slob,Informix_GLOBAL(php3_ifx_module).le_idresult);
}
/* ----------------------------------------------------------------------
* internal function
! * ifx_lo_t *php3_intifxus_get_slobloc(long bid, HashTable *list)
*
* retuens the ifx_lo_t-structure of a slob-object
* list: internal hashlist of php3
* return -1 on error otherwise the new Blob-Object-id
* ----------------------------------------------------------------------
*/
! ifx_lo_t *php3_intifxus_get_slobloc(long bid, HashTable *list) {
! IFX_IDRES *Ifx_slob;
int errcode, type;
! Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
return NULL;
}
!
! return &(Ifx_slob->SLOB.slob_data);
}
***************
*** 4033,4039 ****
void php3_ifxus_tell_slob(INTERNAL_FUNCTION_PARAMETERS) {
pval *pbid;
long bid;
! IFX_SLOBRES *Ifx_slob;
ifx_int8_t akt_seek_pos;
int type;
long lakt_seek_pos;
--- 4123,4129 ----
void php3_ifxus_tell_slob(INTERNAL_FUNCTION_PARAMETERS) {
pval *pbid;
long bid;
! IFX_IDRES *Ifx_slob;
ifx_int8_t akt_seek_pos;
int type;
long lakt_seek_pos;
***************
*** 4043,4056 ****
}
convert_to_long(pbid);
bid=pbid->value.lval;
! Ifx_slob = (IFX_SLOBRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_slobresult) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
RETURN_FALSE;
}
! if(ifx_lo_tell(Ifx_slob->lofd,&akt_seek_pos)<0) {
php3_error(E_WARNING,"can't perform tell-operation");
RETURN_FALSE;
}
--- 4133,4146 ----
}
convert_to_long(pbid);
bid=pbid->value.lval;
! Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
RETURN_FALSE;
}
! if(ifx_lo_tell(Ifx_slob->SLOB.lofd,&akt_seek_pos)<0) {
php3_error(E_WARNING,"can't perform tell-operation");
RETURN_FALSE;
}
***************
*** 4077,4083 ****
void php3_ifxus_seek_slob(INTERNAL_FUNCTION_PARAMETERS) {
pval *pbid, *pmode, *poffset;
long bid,lakt_seek_pos;
! IFX_SLOBRES *Ifx_slob;
ifx_int8_t akt_seek_pos,offset;
int type,mode;
--- 4167,4173 ----
void php3_ifxus_seek_slob(INTERNAL_FUNCTION_PARAMETERS) {
pval *pbid, *pmode, *poffset;
long bid,lakt_seek_pos;
! IFX_IDRES *Ifx_slob;
ifx_int8_t akt_seek_pos,offset;
int type,mode;
***************
*** 4089,4096 ****
convert_to_long(poffset);
bid=pbid->value.lval;
! Ifx_slob = (IFX_SLOBRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_slobresult) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
RETURN_FALSE;
--- 4179,4186 ----
convert_to_long(poffset);
bid=pbid->value.lval;
! Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
RETURN_FALSE;
***************
*** 4105,4111 ****
}
ifx_int8cvlong(poffset->value.lval,&offset);
! if(ifx_lo_seek(Ifx_slob->lofd,&offset, mode,&akt_seek_pos)<0) {
php3_error(E_WARNING,"can't perform seek-operation");
RETURN_FALSE;
}
--- 4195,4201 ----
}
ifx_int8cvlong(poffset->value.lval,&offset);
! if(ifx_lo_seek(Ifx_slob->SLOB.lofd,&offset, mode,&akt_seek_pos)<0) {
php3_error(E_WARNING,"can't perform seek-operation");
RETURN_FALSE;
}
***************
*** 4132,4138 ****
void php3_ifxus_read_slob(INTERNAL_FUNCTION_PARAMETERS) {
pval *pbid, *pnbytes;
long bid, nbytes;
! IFX_SLOBRES *Ifx_slob;
int errcode,type;
char *buffer;
--- 4222,4228 ----
void php3_ifxus_read_slob(INTERNAL_FUNCTION_PARAMETERS) {
pval *pbid, *pnbytes;
long bid, nbytes;
! IFX_IDRES *Ifx_slob;
int errcode,type;
char *buffer;
***************
*** 4144,4151 ****
convert_to_long(pnbytes);
bid=pbid->value.lval;
! Ifx_slob = (IFX_SLOBRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_slobresult) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
RETURN_FALSE;
--- 4234,4241 ----
convert_to_long(pnbytes);
bid=pbid->value.lval;
! Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
RETURN_FALSE;
***************
*** 4157,4163 ****
php3_error(E_WARNING,"cannot allocate memory");
RETURN_FALSE;
}
! if(ifx_lo_read(Ifx_slob->lofd,buffer,nbytes,&errcode)<0) {
efree(buffer);
php3_error(E_WARNING,"error during reading slob");
RETURN_FALSE;
--- 4247,4253 ----
php3_error(E_WARNING,"cannot allocate memory");
RETURN_FALSE;
}
! if(ifx_lo_read(Ifx_slob->SLOB.lofd,buffer,nbytes,&errcode)<0) {
efree(buffer);
php3_error(E_WARNING,"error during reading slob");
RETURN_FALSE;
***************
*** 4179,4185 ****
void php3_ifxus_write_slob(INTERNAL_FUNCTION_PARAMETERS) {
pval *pbid, *pcontent;
long bid, nbytes;
! IFX_SLOBRES *Ifx_slob;
int errcode,type;
char *buffer;
--- 4269,4275 ----
void php3_ifxus_write_slob(INTERNAL_FUNCTION_PARAMETERS) {
pval *pbid, *pcontent;
long bid, nbytes;
! IFX_IDRES *Ifx_slob;
int errcode,type;
char *buffer;
***************
*** 4191,4198 ****
convert_to_string(pcontent);
bid=pbid->value.lval;
! Ifx_slob = (IFX_SLOBRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_slobresult) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
RETURN_FALSE;
--- 4281,4288 ----
convert_to_string(pcontent);
bid=pbid->value.lval;
! Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type);
! if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php3_error(E_WARNING,"%d is not a Informix slob-result index",
bid);
RETURN_FALSE;
***************
*** 4204,4210 ****
php3_error(E_WARNING,"string has no content");
RETURN_FALSE;
}
! if((nbytes=ifx_lo_write(Ifx_slob->lofd,buffer,nbytes,&errcode))<0) {
php3_error(E_WARNING,"error during writing slob");
RETURN_FALSE;
}
--- 4294,4300 ----
php3_error(E_WARNING,"string has no content");
RETURN_FALSE;
}
! if((nbytes=ifx_lo_write(Ifx_slob->SLOB.lofd,buffer,nbytes,&errcode))<0) {
php3_error(E_WARNING,"error during writing slob");
RETURN_FALSE;
}
Index: php3/functions/php3_ifx.h
diff -c php3/functions/php3_ifx.h:1.12 php3/functions/php3_ifx.h:1.13
*** php3/functions/php3_ifx.h:1.12 Wed Oct 7 17:11:24 1998
--- php3/functions/php3_ifx.h Sat Oct 24 15:02:06 1998
***************
*** 73,85 ****
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);
long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list);
extern void php3_ifx_free_blob(INTERNAL_FUNCTION_PARAMETERS) ;
long php3_intifx_free_blob(long id, HashTable *list);
-
long php3_intifx2_free_blob(long id, HashTable *list);
-
extern void php3_ifx_get_blob(INTERNAL_FUNCTION_PARAMETERS);
long php3_intifx_get_blob(long bid, HashTable *list, char** content);
extern void php3_ifx_update_blob(INTERNAL_FUNCTION_PARAMETERS);
--- 73,84 ----
extern void php3_ifx_fieldtypes(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_fieldproperties(INTERNAL_FUNCTION_PARAMETERS);
+ long php3_intifx_getType(long id, HashTable *list);
extern void php3_ifx_create_blob(INTERNAL_FUNCTION_PARAMETERS);
long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list);
extern void php3_ifx_free_blob(INTERNAL_FUNCTION_PARAMETERS) ;
long php3_intifx_free_blob(long id, HashTable *list);
long php3_intifx2_free_blob(long id, HashTable *list);
extern void php3_ifx_get_blob(INTERNAL_FUNCTION_PARAMETERS);
long php3_intifx_get_blob(long bid, HashTable *list, char** content);
extern void php3_ifx_update_blob(INTERNAL_FUNCTION_PARAMETERS);
***************
*** 104,110 ****
extern void php3_ifxus_open_slob(INTERNAL_FUNCTION_PARAMETERS) ;
long php3_intifxus_open_slob(long bid, long create_mode, HashTable *list);
long php3_intifxus_new_slob(HashTable *list);
! ifx_lo_t *php3_intifx_get_slobloc(long bid, HashTable *list);
extern void php3_ifxus_read_slob(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifxus_write_slob(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifxus_seek_slob(INTERNAL_FUNCTION_PARAMETERS);
--- 103,109 ----
extern void php3_ifxus_open_slob(INTERNAL_FUNCTION_PARAMETERS) ;
long php3_intifxus_open_slob(long bid, long create_mode, HashTable *list);
long php3_intifxus_new_slob(HashTable *list);
! ifx_lo_t *php3_intifxus_get_slobloc(long bid, HashTable *list);
extern void php3_ifxus_read_slob(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifxus_write_slob(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifxus_seek_slob(INTERNAL_FUNCTION_PARAMETERS);
***************
*** 116,122 ****
long num_links,num_persistent;
long max_links,max_persistent;
long allow_persistent;
! int le_result,le_link,le_plink,le_blobresult,le_slobresult;
char *default_host, *default_user, *default_password;
int connectionid;
int cursorid;
--- 115,121 ----
long num_links,num_persistent;
long max_links,max_persistent;
long allow_persistent;
! int le_result,le_link,le_plink,le_idresult;
char *default_host, *default_user, *default_password;
int connectionid;
int cursorid;
***************
*** 128,135 ****
long nullformat; /* 0=NULL as "", 1= NULL as "NULL" */
} ifx_module;
! #define MAXBLOBS 64
! #define MAXSLOBS 64
#define BLOBINFILE 0 /* 0=in memory, 1=in file */
typedef struct ifx_res {
--- 127,133 ----
long nullformat; /* 0=NULL as "", 1= NULL as "NULL" */
} ifx_module;
! #define MAX_RESID 64
#define BLOBINFILE 0 /* 0=in memory, 1=in file */
typedef struct ifx_res {
***************
*** 144,173 ****
int numcols;
int rowid;
int affected_rows;
! int blob_id[MAXBLOBS];
! # if HAVE_IFX_IUS
! int slob_id[MAXSLOBS];
! # endif
} IFX_RES;
! typedef struct ifx_blobres {
! int mode;
! loc_t blob_data;
int type;
! } IFX_BLOBRES;
#if HAVE_IFX_IUS
! typedef struct ifx_slobres {
! ifx_lo_t slobdata;
! ifx_lo_create_spec_t *createspec;
! int lofd;
! } IFX_SLOBRES;
#endif
#ifndef THREAD_SAFE
--- 142,182 ----
int numcols;
int rowid;
int affected_rows;
! int res_id[MAX_RESID];
} IFX_RES;
! typedef struct _IFX_IDRES {
int type;
! union {
! struct {
! int mode;
! loc_t blob_data;
! } BLOBRES;
! #if HAVE_IFX_IUS
! struct {
! ifx_lo_t slob_data;
! ifx_lo_create_spec_t *createspec;
! int lofd;
! } SLOBRES;
! #endif
! } DATARES;
! } IFX_IDRES;
!
+ #define BLOB DATARES.BLOBRES
+
#if HAVE_IFX_IUS
! #define SLOB DATARES.SLOBRES
#endif
+
+
+
+
#ifndef THREAD_SAFE
--
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