Skip to content

Commit d5d7cf7

Browse files
committed
Changed length of BIT string.
Changed return value of fbsql_field_length to long
1 parent 399885c commit d5d7cf7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ext/fbsql/php_fbsql.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ static void phpfbReleaseLink (zend_rsrc_list_entry *rsrc)
271271
fbcdcClose(link->connection);
272272
fbcdcRelease(link->connection);
273273
}
274+
if (link->execHandler) fbcehRelease(link->execHandler);
274275
efree(link);
275276
FB_SQL_G(linkCount)--;
276277
}
@@ -292,6 +293,7 @@ static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc)
292293
fbcdcClose(link->connection);
293294
fbcdcRelease(link->connection);
294295
}
296+
if (link->execHandler) fbcehRelease(link->execHandler);
295297
free(link);
296298
FB_SQL_G(linkCount)--;
297299
FB_SQL_G(persistantCount)--;
@@ -2036,7 +2038,7 @@ void phpfbColumnAsString (PHPFBResult* result, int column, void* data ,int* leng
20362038
{
20372039
unsigned i;
20382040
unsigned int l = nBits / 8;
2039-
*length = l + 5;
2041+
*length = l*2+3+1;
20402042
if (value)
20412043
{
20422044
char* r = emalloc(l*2+3+1);
@@ -2058,7 +2060,7 @@ void phpfbColumnAsString (PHPFBResult* result, int column, void* data ,int* leng
20582060
{
20592061
unsigned i;
20602062
unsigned int l = nBits;
2061-
*length = l + 5;
2063+
*length = l*2+3+1;
20622064
if (value)
20632065
{
20642066
char* r = emalloc(l*2+3+1);
@@ -2847,10 +2849,7 @@ PHP_FUNCTION(fbsql_field_len)
28472849
}
28482850
else if (result->metaData)
28492851
{
2850-
unsigned int length = fbcdmdLength(fbccmdDatatype(fbcmdColumnMetaDataAtIndex(result->metaData,column)));
2851-
char buffer[50];
2852-
sprintf(buffer,"%d",length);
2853-
RETURN_STRING(buffer, 1);
2852+
RETURN_LONG(fbcdmdLength(fbccmdDatatype(fbcmdColumnMetaDataAtIndex(result->metaData,column))));
28542853
}
28552854
else
28562855
{

0 commit comments

Comments
 (0)