Skip to content

Commit 925d48d

Browse files
author
Danny Heijl
committed
Blobs now working too.
1 parent dc7cffc commit 925d48d

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

MODULES_STATUS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ ldap Working
1414
oci8 Working (but no blob-support yet)
1515
oracle Working
1616
iptc Working
17-
informix Working (except blobs, and php_ini stuff needs rewriting)
17+
informix Working (including blobs, php_ini stuff still needs rewriting)

ext/informix/ifx.ec

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -746,18 +746,19 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
746746
(void **) &index_ptr) == SUCCESS) {
747747
int type,link;
748748
void *ptr;
749-
749+
#ifdef THREAD_SAFE
750+
if (index_ptr->type != _php3_le_index_ptr()) {
751+
#else
750752
if (index_ptr->type != le_index_ptr) {
753+
#endif
751754
RETURN_FALSE;
752755
}
753756
link = (int) index_ptr->ptr;
754757
ptr = php3_list_find(link,&type); /* check if the link is still there */
755-
if (ptr && (type==IFXG(le_link) ||
756-
type==IFXG(le_plink))) {
757-
return_value->value.lval =
758-
IFXG(default_link) =
759-
link;
760-
return_value->type = IS_LONG;
758+
if (ptr && (type==IFXG(le_link) || type==IFXG(le_plink))) {
759+
zend_list_addref(link);
760+
return_value->value.lval = IFXG(default_link) = link;
761+
return_value->type = IS_RESOURCE;
761762
efree(hashed_details);
762763
return;
763764
} else {
@@ -790,13 +791,16 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
790791
}
791792

792793
/* add it to the list */
793-
return_value->value.lval =
794-
php3_list_insert(ifx,IFXG(le_link));
795-
return_value->type = IS_LONG;
794+
return_value->value.lval = php3_list_insert(ifx,IFXG(le_link));
795+
return_value->type = IS_RESOURCE;
796796

797797
/* add it to the hash */
798798
new_index_ptr.ptr = (void *) return_value->value.lval;
799+
#ifdef THREAD_SAFE
800+
new_index_ptr.type = _php3_le_index_ptr();
801+
#else
799802
new_index_ptr.type = le_index_ptr;
803+
#endif
800804
if (_php3_hash_update(list,
801805
hashed_details,
802806
hashed_details_length+1,
@@ -1083,7 +1087,7 @@ EXEC SQL END DECLARE SECTION;
10831087
## NONSELECT-STATEMENT
10841088
##
10851089
*/
1086-
pval *pblobidarr, *tmp;
1090+
pval *pblobidarr, **tmp;
10871091

10881092
Ifx_Result->iscursory = 0;
10891093

@@ -1115,16 +1119,16 @@ EXEC SQL END DECLARE SECTION;
11151119
i=1;
11161120
while (_php3_hash_get_current_data(pblobidarr->value.ht,
11171121
(void **) &tmp) == SUCCESS) {
1118-
convert_to_long(tmp);
1122+
convert_to_long(*tmp);
11191123
if ((query_type == SQ_UPDATE) || (query_type == SQ_UPDALL)) {
11201124
EXEC SQL SET DESCRIPTOR :descrpid COUNT = :i;
11211125
}
11221126
/* TEXT/BYTE */
1123-
if(php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLTEXT || php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLBYTE) {
1124-
locator=php3_intifx_get_blobloc((int)tmp->value.lval,list);
1127+
if(php3_intifx_getType((int)(*tmp)->value.lval,list)==TYPE_BLTEXT || php3_intifx_getType((int)(*tmp)->value.lval,list)==TYPE_BLBYTE) {
1128+
locator=php3_intifx_get_blobloc((int)((*tmp)->value.lval),list);
11251129
if(locator==NULL) {
11261130
php3_error(E_WARNING,"%d is not a Informix blob-result index",
1127-
(int)tmp->value.lval);
1131+
(int)((*tmp)->value.lval));
11281132
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
11291133
EXEC SQL free :statemid;
11301134
efree(Ifx_Result);
@@ -1139,8 +1143,8 @@ EXEC SQL END DECLARE SECTION;
11391143
}
11401144

11411145
/* CHAR */
1142-
if(php3_intifx_getType((int)tmp->value.lval,list)==TYPE_CHAR) {
1143-
len=php3_intifx_get_char((int)tmp->value.lval,list,&char_tmp);
1146+
if(php3_intifx_getType((int)(*tmp)->value.lval,list)==TYPE_CHAR) {
1147+
len=php3_intifx_get_char((int)((*tmp)->value.lval),list,&char_tmp);
11441148
indicator=0;
11451149
if(char_tmp==NULL || len<0)
11461150
indicator=-1;
@@ -1485,7 +1489,7 @@ EXEC SQL END DECLARE SECTION;
14851489
## NONSELECT-STATEMENT
14861490
##
14871491
*/
1488-
pval *pblobidarr, *tmp;
1492+
pval *pblobidarr, **tmp;
14891493

14901494
Ifx_Result->iscursory = 0;
14911495

@@ -1517,16 +1521,16 @@ EXEC SQL END DECLARE SECTION;
15171521
i=1;
15181522
while (_php3_hash_get_current_data(pblobidarr->value.ht,
15191523
(void **) &tmp) == SUCCESS) {
1520-
convert_to_long(tmp);
1524+
convert_to_long(*tmp);
15211525
if ((query_type == SQ_UPDATE) || (query_type == SQ_UPDALL)) {
15221526
EXEC SQL SET DESCRIPTOR :descrpid COUNT = :i;
15231527
}
15241528
/* TEXT/BYTE */
1525-
if(php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLTEXT || php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLBYTE) {
1526-
locator=php3_intifx_get_blobloc((int)tmp->value.lval,list);
1529+
if(php3_intifx_getType((int)((*tmp)->value.lval),list)==TYPE_BLTEXT || php3_intifx_getType((int)((*tmp)->value.lval),list)==TYPE_BLBYTE) {
1530+
locator=php3_intifx_get_blobloc((int)((*tmp)->value.lval),list);
15271531
if(locator==NULL) {
15281532
php3_error(E_WARNING,"%d is not a Informix blob-result index",
1529-
(int)tmp->value.lval);
1533+
(int)((*tmp)->value.lval));
15301534
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
15311535
EXEC SQL free :statemid;
15321536
efree(Ifx_Result);
@@ -1540,8 +1544,8 @@ EXEC SQL END DECLARE SECTION;
15401544
TYPE=:loc_t_type;
15411545
}
15421546
/* CHAR */
1543-
if(php3_intifx_getType((int)tmp->value.lval,list)==TYPE_CHAR) {
1544-
len=php3_intifx_get_char((int)tmp->value.lval,list,&char_tmp);
1547+
if(php3_intifx_getType((int)((*tmp)->value.lval),list)==TYPE_CHAR) {
1548+
len=php3_intifx_get_char((int)((*tmp)->value.lval),list,&char_tmp);
15451549
indicator=0;
15461550
if(char_tmp==NULL || len<0)
15471551
indicator=-1;

0 commit comments

Comments
 (0)