CVS update: php3/functions
| From: | danny | Date: | Tue, 09 Mar 1999 21:16:34 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-4554@lists.php.net to get a copy of this message | ||
Date: Tuesday March 9, 1999 @ 16:16
Author: danny
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv23226/functions
Modified Files:
ifx.ec php3_ifx.h
Log Message:
- suppress ESQLC BLOB memory leak fix for ESQLC versions > 7.23
(Informix finally fixed it). Fixes segmentation violation with 7.30.
- code cleanup
Index: php3/functions/ifx.ec
diff -c php3/functions/ifx.ec:1.40 php3/functions/ifx.ec:1.41
*** php3/functions/ifx.ec:1.40 Sat Mar 6 14:13:47 1999
--- php3/functions/ifx.ec Tue Mar 9 16:16:33 1999
***************
*** 30,36 ****
+----------------------------------------------------------------------+
*/
! /* $Id: ifx.ec,v 1.40 1999/03/06 19:13:47 danny Exp $ */
/* -------------------------------------------------------------------
* if you want a function reference : "grep '^\*\*' ifx.ec" will give
--- 30,36 ----
+----------------------------------------------------------------------+
*/
! /* $Id: ifx.ec,v 1.41 1999/03/09 21:16:33 danny Exp $ */
/* -------------------------------------------------------------------
* if you want a function reference : "grep '^\*\*' ifx.ec" will give
***************
*** 114,119 ****
--- 114,126 ----
gives access to affected rows and serial insert values
- made all internal functions static
+
+ Changes 09/03/1999 (danny.heijl@cevi.be)
+ - suppressed ESQL/C BLOB memory leak fix for ESQL/C 7.24 and higher
+ this is the same fix as in Perl DBD::Informix
+ - really free an Ifx_Result now, do not wait for script termination
+ - code cleanup
+
*/
***************
*** 146,153 ****
--- 153,185 ----
#include "build-defs.h"
#include "php3_ifx.h"
+
#if HAVE_IFX
+ /* local function prototypes */
+ static long php3_intifx_getType(long id, HashTable *list);
+ static long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list);
+ static long php3_intifx_free_blob(long id, HashTable *list);
+ static long php3_intifx2_free_blob(long id, HashTable *list);
+ static long php3_intifx_get_blob(long bid, HashTable *list, char** content);
+ static long php3_intifx_update_blob(long bid, char* param, long len, HashTable *list);
+ static loc_t *php3_intifx_get_blobloc(long bid, HashTable *list);
+ static char* php3_intifx_create_tmpfile(long bid);
+ static long php3_intifx_copy_blob(long bid, HashTable *list);
+ static char* php3_intifx_null();
+ static long php3_intifx_create_char(char* param, long len, HashTable *list);
+ static long php3_intifx_free_char(long id, HashTable *list);
+ static long php3_intifx_update_char(long bid, char* param, long len, HashTable *list);
+ static long php3_intifx_get_char(long bid, HashTable *list, char** content);
+ #if HAVE_IFX_IUS
+ static long php3_intifxus_create_slob(long create_mode, HashTable *list);
+ static long php3_intifxus_free_slob(long bid, HashTable *list);
+ static long php3_intifxus_close_slob(long bid, HashTable *list);
+ static long php3_intifxus_open_slob(long bid, long create_mode, HashTable *list);
+ static long php3_intifxus_new_slob(HashTable *list);
+ static ifx_lo_t *php3_intifxus_get_slobloc(long bid, HashTable *list);
+ #endif
+
#ifndef CLIENT_SQLI_VER /* 7.10 on (at least) AIX is missing this */
#define CLIENT_SQLI_VER IFX_VERSION
#endif
***************
*** 432,437 ****
--- 464,474 ----
&Informix_GLOBAL(php3_ifx_module).nullformat)==FAILURE) {
Informix_GLOBAL(php3_ifx_module).nullformat=0;
}
+
+ Informix_GLOBAL(php3_ifx_module).nullvalue = malloc(1);
+ Informix_GLOBAL(php3_ifx_module).nullvalue[0] = 0;
+ Informix_GLOBAL(php3_ifx_module).nullstring = malloc(5);
+ strcpy(Informix_GLOBAL(php3_ifx_module).nullstring, "NULL");
if (cfg_get_long("ifx.allow_persistent",
&Informix_GLOBAL(php3_ifx_module).allow_persistent)==FAILURE) {
***************
*** 581,587 ****
char *ifx;
EXEC SQL END DECLARE SECTION;
- char *tmp;
char *hashed_details;
int hashed_details_length;
Informix_TLS_VARS;
--- 618,623 ----
***************
*** 1339,1345 ****
char *statement; /* query text */
int fieldcount; /* field count */
int i; /* field index */
- short fieldtype;
loc_t *locator;
int loc_t_type=CLOCATORTYPE; /* WORKAROUND: TYPE=CLOCATORTYPE doesn't work, */
int sqlchar_type=SQLCHAR; /* don't ask me, why. */
--- 1375,1380 ----
***************
*** 1355,1362 ****
EXEC SQL END DECLARE SECTION;
- char *blobfilename;
- int locind;
int ctype;
int affected_rows;
int query_type;
--- 1390,1395 ----
***************
*** 1625,1631 ****
loc_t *locator;
int e;
- long sqlerrd[6];
$ifdef HAVE_IFX_IUS;
fixed binary 'blob' ifx_lo_t *slocator;
--- 1658,1663 ----
***************
*** 1635,1641 ****
int locind;
char *blobfilename;
- char *blobdir;
Informix_TLS_VARS;
--- 1667,1672 ----
***************
*** 1790,1797 ****
void php3_ifx_error(INTERNAL_FUNCTION_PARAMETERS)
{
pval *ifx_link;
! int id,type;
! IFX *ifx;
Informix_TLS_VARS;
--- 1821,1827 ----
void php3_ifx_error(INTERNAL_FUNCTION_PARAMETERS)
{
pval *ifx_link;
! int id;
Informix_TLS_VARS;
***************
*** 1811,1826 ****
break;
}
- /* connection id is no longer checked
- * ifx = (IFX *) php3_list_find(id,&type);
- * if (type!=Informix_GLOBAL(php3_ifx_module).le_link
- * && type!=Informix_GLOBAL(php3_ifx_module).le_plink) {
- * php3_error(E_WARNING,
- * "ifx_error : %d (type %d) is not an Informix link index",
- * id,
- * type);
- * }
- */
RETURN_STRING(ifx_error(0),0); /* ifx_error returns emalloced string */
}
/* }}} */
--- 1841,1846 ----
***************
*** 1964,1978 ****
char *cursorid; /* query cursor id */
char *statemid; /* statement id */
char *descrpid; /* descriptor id */
- char *statement; /* query text */
int fieldcount; /* field count */
int i; /* an index */
char fieldname[64]; /* fieldname */
- char ifx_bug; /* pad for ifx bug */
short fieldtype; /* field type */
int fieldleng; /* field length */
- int field_ind; /* the field index */
- char *field; /* the field data */
$ifdef HAVE_IFX_IUS;
ifx_int8_t int8_var;
--- 1984,1994 ----
***************
*** 1987,1993 ****
datetime dt_data = {0};
decimal dec_data = {0};
short short_data;
! loc_t *locator, *locator_b;
$ifdef HAVE_IFX_IUS;
fixed binary 'blob' ifx_lo_t *slocator;
--- 2003,2009 ----
datetime dt_data = {0};
decimal dec_data = {0};
short short_data;
! loc_t *locator_b;
$ifdef HAVE_IFX_IUS;
fixed binary 'blob' ifx_lo_t *slocator;
***************
*** 2005,2011 ****
char string_data[256];
long long_data;
char *p;
- FILE *fp;
char *blobfilename;
char *fetch_pos;
--- 2021,2026 ----
***************
*** 2334,2340 ****
continue;
}
- efree(nullstr);
}
/* }}} */
--- 2349,2354 ----
***************
*** 2362,2375 ****
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 */
$ifdef HAVE_IFX_IUS;
ifx_int8_t int8_var;
--- 2376,2386 ----
***************
*** 2403,2415 ****
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;
switch (ARG_COUNT(ht)) {
--- 2414,2422 ----
long long_data;
char *p;
int locind,bid_b;
char *table_options;
int moredata;
!
Informix_TLS_VARS;
switch (ARG_COUNT(ht)) {
***************
*** 2701,2707 ****
} /* endwhile (moredata); */
php3_printf("</table>\n");
- efree(nullstr);
RETURN_LONG(Ifx_Result->rowid);
}
--- 2708,2713 ----
***************
*** 2730,2769 ****
char *cursorid; /* query cursor id */
char *statemid; /* statement id */
char *descrpid; /* descriptor id */
- char *statement; /* query text */
int fieldcount; /* field count */
int i; /* an index */
char fieldname[64]; /* fieldname */
short fieldtype; /* field type */
- int field_ind; /* the field index */
- int fieldleng; /* field length */
- char *field; /* the field */
- short indicator;
- int int_data;
char *char_data = NULL;
! long date_data;
! interval intvl_data = {0};
! datetime dt_data = {0};
! decimal dec_data = {0};
! short short_data;
! float float_data;
! double double_data;
! loc_t *locator;
EXEC SQL END DECLARE SECTION;
int type;
int num_fields;
- char string_data[256];
- long long_data;
char *p;
- int locind;
- FILE *fp;
- char *blobfilename;
- char *blobdir;
char *table_options;
- int moredata;
Informix_TLS_VARS;
--- 2736,2755 ----
char *cursorid; /* query cursor id */
char *statemid; /* statement id */
char *descrpid; /* descriptor id */
int fieldcount; /* field count */
int i; /* an index */
char fieldname[64]; /* fieldname */
short fieldtype; /* field type */
char *char_data = NULL;
!
EXEC SQL END DECLARE SECTION;
int type;
int num_fields;
char *p;
char *table_options;
Informix_TLS_VARS;
***************
*** 2942,2967 ****
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;
int size;
int precision;
int scale;
--- 2928,2938 ----
***************
*** 2972,2985 ****
int num_fields;
char string_data[256];
- long long_data;
char *p;
- int locind;
- FILE *fp;
- char *blobfilename;
- char *blobdir;
char *table_options;
- int moredata;
Informix_TLS_VARS;
--- 2943,2950 ----
***************
*** 3356,3361 ****
--- 3321,3328 ----
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
+ efree(Ifx_Result); /* this can be safely done now */
+
php3_list_delete(result->value.lval);
RETURN_TRUE;
}
***************
*** 3705,3710 ****
--- 3672,3681 ----
bid);
return -1;
}
+ #if IFX_VERSION < 724 /* this Informix memory leak is
fixed from 7.24 on */
+ /* according to the current PERL
DBD::Informix */
+ /* and otherwise I get segmenation
violations with 7.30 */
+
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 {
***************
*** 3715,3721 ****
efree(Ifx_blob->BLOB.blob_data.loc_fname);
}
}
!
php3_list_delete(bid);
efree(Ifx_blob);
return 0;
--- 3686,3694 ----
efree(Ifx_blob->BLOB.blob_data.loc_fname);
}
}
!
! #endif
!
php3_list_delete(bid);
efree(Ifx_blob);
return 0;
***************
*** 4060,4070 ****
char* tmp;
if(Informix_GLOBAL(php3_ifx_module).nullformat==0) {
! tmp=emalloc(1);
! tmp[0]=0;
} else {
! tmp=emalloc(5);
! strcpy(tmp,"NULL");
}
return tmp;
}
--- 4033,4041 ----
char* tmp;
if(Informix_GLOBAL(php3_ifx_module).nullformat==0) {
! tmp=Informix_GLOBAL(php3_ifx_module).nullvalue;
} else {
! tmp=Informix_GLOBAL(php3_ifx_module).nullstring;
}
return tmp;
}
Index: php3/functions/php3_ifx.h
diff -c php3/functions/php3_ifx.h:1.18 php3/functions/php3_ifx.h:1.19
*** php3/functions/php3_ifx.h:1.18 Sat Mar 6 14:13:47 1999
--- php3/functions/php3_ifx.h Tue Mar 9 16:16:34 1999
***************
*** 30,36 ****
+----------------------------------------------------------------------+
*/
! /* $Id: php3_ifx.h,v 1.18 1999/03/06 19:13:47 danny Exp $ */
#ifndef _PHP3_IFX_H
#define _PHP3_IFX_H
--- 30,36 ----
+----------------------------------------------------------------------+
*/
! /* $Id: php3_ifx.h,v 1.19 1999/03/09 21:16:34 danny Exp $ */
#ifndef _PHP3_IFX_H
#define _PHP3_IFX_H
***************
*** 75,121 ****
extern void php3_ifx_fieldproperties(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_getsqlca(INTERNAL_FUNCTION_PARAMETERS);
- static long php3_intifx_getType(long id, HashTable *list);
extern void php3_ifx_create_blob(INTERNAL_FUNCTION_PARAMETERS);
- static long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list);
extern void php3_ifx_free_blob(INTERNAL_FUNCTION_PARAMETERS) ;
- static long php3_intifx_free_blob(long id, HashTable *list);
- static long php3_intifx2_free_blob(long id, HashTable *list);
extern void php3_ifx_get_blob(INTERNAL_FUNCTION_PARAMETERS);
- static long php3_intifx_get_blob(long bid, HashTable *list, char** content);
extern void php3_ifx_update_blob(INTERNAL_FUNCTION_PARAMETERS);
- static long php3_intifx_update_blob(long bid, char* param, long len, HashTable *list);
- static loc_t *php3_intifx_get_blobloc(long bid, HashTable *list);
- static 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);
- static long php3_intifx_copy_blob(long bid, HashTable *list);
extern void php3_ifx_textasvarchar(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_byteasvarchar(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ifx_nullformat(INTERNAL_FUNCTION_PARAMETERS);
- static char* php3_intifx_null();
extern void php3_ifx_create_char(INTERNAL_FUNCTION_PARAMETERS);
- static long php3_intifx_create_char(char* param, long len, HashTable *list);
extern void php3_ifx_free_char(INTERNAL_FUNCTION_PARAMETERS) ;
- static long php3_intifx_free_char(long id, HashTable *list);
extern void php3_ifx_update_char(INTERNAL_FUNCTION_PARAMETERS);
- static long php3_intifx_update_char(long bid, char* param, long len, HashTable *list);
extern void php3_ifx_get_char(INTERNAL_FUNCTION_PARAMETERS);
- static long php3_intifx_get_char(long bid, HashTable *list, char** content);
#if HAVE_IFX_IUS
extern void php3_ifxus_create_slob(INTERNAL_FUNCTION_PARAMETERS);
- static long php3_intifxus_create_slob(long create_mode, HashTable *list);
extern void php3_ifxus_free_slob(INTERNAL_FUNCTION_PARAMETERS) ;
- static long php3_intifxus_free_slob(long bid, HashTable *list);
extern void php3_ifxus_close_slob(INTERNAL_FUNCTION_PARAMETERS) ;
- static long php3_intifxus_close_slob(long bid, HashTable *list);
extern void php3_ifxus_open_slob(INTERNAL_FUNCTION_PARAMETERS) ;
- static long php3_intifxus_open_slob(long bid, long create_mode, HashTable *list);
- static long php3_intifxus_new_slob(HashTable *list);
- static 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);
--- 75,101 ----
***************
*** 137,142 ****
--- 117,124 ----
long byteasvarchar; /* 0=as id, 1=as varchar */
long charasvarchar; /* 0=don't strip trailing blanks, 1=strip */
long nullformat; /* 0=NULL as "", 1= NULL as "NULL" */
+ char *nullvalue; /* "" */
+ char *nullstring; /* "NULL" */
} ifx_module;
#define MAX_RESID 64
--
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