diff options
| author | Frank M. Kromann <fmk@php.net> | 2001-04-03 18:09:02 +0000 |
|---|---|---|
| committer | Frank M. Kromann <fmk@php.net> | 2001-04-03 18:09:02 +0000 |
| commit | 8003b3aa9dbf2ca5ce15559c53c8d74130cb90fa (patch) | |
| tree | fbe62b8bc96fb176313c8a6d1f3b755df0224470 /ext/fbsql/php_fbsql.c | |
| parent | 83b5a2fb0c77b3d508c82c8838d080e120a01159 (diff) | |
| download | php-git-8003b3aa9dbf2ca5ce15559c53c8d74130cb90fa.tar.gz | |
Fixing crash when listing databsaes
Fixing rowcount to woirk when the result contains an array og data.
Diffstat (limited to 'ext/fbsql/php_fbsql.c')
| -rw-r--r-- | ext/fbsql/php_fbsql.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c index f1bcf7ceee..d079448842 100644 --- a/ext/fbsql/php_fbsql.c +++ b/ext/fbsql/php_fbsql.c @@ -1745,6 +1745,7 @@ PHP_FUNCTION(fbsql_list_dbs) phpResult->connection = NULL; phpResult->fetchHandle = NULL; phpResult->rowHandler = NULL; + phpResult->ResultmetaData = NULL; phpResult->metaData = NULL; phpResult->batchSize = FB_SQL_G(batchSize); phpResult->columnCount = 1; @@ -1763,11 +1764,11 @@ PHP_FUNCTION(fbsql_list_dbs) phpLink->results = realloc(phpLink->results,sizeof(PHPFBResult*)* phpLink->resultCount); for (j=i; j < phpLink->resultCount ; j++)phpLink->results[j] = NULL; } - phpLink->results[i] = phpResult; + phpLink->results[i] = phpResult; return_value->value.lval = phpResult->index; - return_value->type = IS_LONG; - FB_SQL_G(resultIndex) = phpResult->index; - FB_SQL_G(linkIndex) = phpLink->index; + return_value->type = IS_LONG; + FB_SQL_G(resultIndex) = phpResult->index; + FB_SQL_G(linkIndex) = phpLink->index; } /* }}} */ @@ -2447,11 +2448,15 @@ PHP_FUNCTION(fbsql_num_rows) result = phpfbGetResult(resultIndex); if (result == NULL) RETURN_FALSE; - rowCount = fbcmdRowCount (result->metaData); - if (rowCount == -1) - { - phpfbFetchRow(result,0x7fffffff); + if (result->array) rowCount = result->rowCount; + else { + rowCount = fbcmdRowCount(result->metaData); + if (rowCount == -1) + { + phpfbFetchRow(result,0x7fffffff); + rowCount = result->rowCount; + } } return_value->value.lval = rowCount; return_value->type = IS_LONG; |
