summaryrefslogtreecommitdiff
path: root/ext/fbsql
diff options
context:
space:
mode:
authorFrank M. Kromann <fmk@php.net>2001-10-15 17:33:14 +0000
committerFrank M. Kromann <fmk@php.net>2001-10-15 17:33:14 +0000
commitdbe9e0bfc2ad42ff7a5e7eee6cd8cd39df00eff1 (patch)
treee76ac52d6fa01b6031e3e539423745d7a18ea36f /ext/fbsql
parentd7acbbe2c3b822599a349b53822bc28f08a5504b (diff)
downloadphp-git-dbe9e0bfc2ad42ff7a5e7eee6cd8cd39df00eff1.tar.gz
Fixing problem with indirect blobs
Diffstat (limited to 'ext/fbsql')
-rw-r--r--ext/fbsql/php_fbsql.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c
index 1647443396..bd28ef90b7 100644
--- a/ext/fbsql/php_fbsql.c
+++ b/ext/fbsql/php_fbsql.c
@@ -932,12 +932,13 @@ static void php_fbsql_create_lob(INTERNAL_FUNCTION_PARAMETERS, int lob_type)
}
ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
+ convert_to_string_ex(lob_data);
switch (lob_type) {
case 0 : // BLOB
- lobHandle = fbcdcWriteBLOB(phpLink->connection, Z_STRVAL_PP(lob_data), Z_STRLEN_PP(lob_data));
+ lobHandle = fbcdcWriteBLOB(phpLink->connection, Z_STRVAL_PP(lob_data), Z_STRLEN_PP(lob_data));
break;
case 1 : // CLOB
- lobHandle = fbcdcWriteCLOB(phpLink->connection, Z_STRVAL_PP(lob_data));
+ lobHandle = fbcdcWriteCLOB(phpLink->connection, Z_STRVAL_PP(lob_data));
break;
}
if (lobHandle) {
@@ -2200,22 +2201,20 @@ void phpfbColumnAsString (PHPFBResult* result, int column, void* data , int* len
{ // Direct
*length = ((FBCBlobDirect *)data)->blobSize;
- *value = emalloc(*length + 1);
- strncpy(*value, (char *)((FBCBlobDirect *)data)->blobData, *length);
+ *value = estrndup((char *)((FBCBlobDirect *)data)->blobData, *length);
}
else
{
FBCBlobHandle *lobHandle;
- char *handle = (char *)(&((unsigned char*)data)[1]);
-
+ unsigned char *bytes = (unsigned char *)data;
+ char *handle = (char *)(&bytes[1]);
lobHandle = fbcbhInitWithHandle(handle);
*length = fbcbhBlobSize(lobHandle);
- *value = emalloc(*length + 1);
if (dtc == FB_BLOB)
- strncpy(*value, (char *)fbcdcReadBLOB(result->link->connection, lobHandle), *length);
+ *value = estrndup((char *)fbcdcReadBLOB(result->link->connection, lobHandle), *length);
else
- strncpy(*value, (char *)fbcdcReadCLOB(result->link->connection, lobHandle), *length);
+ *value = estrndup((char *)fbcdcReadCLOB(result->link->connection, lobHandle), *length);
fbcbhRelease(lobHandle);
}
}