cvs: php4 /ext/interbase/
| From: | Jouni Ahto | Date: | Fri, 12 May 2000 08:37:03 +0000 |
| Subject: | cvs: php4 /ext/interbase/ | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-14884@lists.php.net to get a copy of this message | ||
jah Fri May 12 10:37:03 2000 EDT
Modified files:
/php4/ext/interbase interbase.c php_interbase.h
Log:
Changed ibase_num_fields to use high-performance api (which fixed a *very*
obscure bug).
Index: php4/ext/interbase/interbase.c
diff -u php4/ext/interbase/interbase.c:1.29 php4/ext/interbase/interbase.c:1.30
--- php4/ext/interbase/interbase.c:1.29 Fri May 12 05:02:14 2000
+++ php4/ext/interbase/interbase.c Fri May 12 10:37:03 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interbase.c,v 1.29 2000/05/12 03:02:14 jah Exp $ */
+/* $Id: interbase.c,v 1.30 2000/05/12 08:37:03 jah Exp $ */
/* TODO: Arrays, roles?
@@ -52,7 +52,7 @@
#endif
/*
-#define IBDEBUG(a) printf("::: %s\n", a);
+#define IBDEBUG(a) printf("::: %s (%d)\n", a, __LINE__);
*/
#define IBDEBUG(a)
@@ -342,6 +342,7 @@
/* {{{ _php_ibase_free_result() */
static void _php_ibase_free_result(ibase_result *ib_result)
{
+ IBDEBUG("Freeing result...");
if (ib_result){
_php_ibase_free_xsqlda(ib_result->out_sqlda);
if (ib_result->drop_stmt && ib_result->stmt) {
@@ -367,7 +368,7 @@
/* {{{ _php_ibase_free_query() */
static void _php_ibase_free_query(ibase_query *ib_query)
{
-
+ IBDEBUG("Freeing query...");
if (ib_query) {
if (ib_query->in_sqlda) {
efree(ib_query->in_sqlda);
@@ -387,7 +388,6 @@
if (ib_query->out_array) {
efree(ib_query->out_array);
}
- IBDEBUG("Freeing query...");
efree(ib_query);
}
}
@@ -519,7 +519,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "Interbase Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.29 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.30 $");
#if defined(COMPILE_DL) || defined(COMPILE_DL_INTERBASE)
php_info_print_table_row(2, "Dynamic Module", "yes");
#endif
@@ -1297,7 +1297,7 @@
if (ib_query->in_sqlda) { /* has placeholders */
if (ib_query->in_sqlda->sqld != argc) {
- _php_ibase_module_error("placeholders (%d) and variables (%d)
mismatch",ib_query->in_sqlda->sqld, argc);
+ _php_ibase_module_error("placeholders (%d) and variables (%d) mismatch",
ib_query->in_sqlda->sqld, argc);
goto _php_ibase_exec_error; /* yes mommy, goto! */
}
in_sqlda = emalloc(XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
@@ -2236,24 +2236,18 @@
Get the number of fields in result */
PHP_FUNCTION(ibase_num_fields)
{
- pval *result;
+ pval **result;
int type;
ibase_result *ib_result;
RESET_ERRMSG;
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &result)==FAILURE) {
+ if (ARG_COUNT(ht)!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
WRONG_PARAM_COUNT;
}
-
- convert_to_long(result);
- ib_result = (ibase_result *) zend_list_find(result->value.lval, &type);
- if (type!=IBG(le_result)) {
- _php_ibase_module_error("%d is not result index", result->value.lval);
- RETURN_FALSE;
- }
+ ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result, -1, "InterBase result",
IBG(le_result));
if (ib_result->out_sqlda == NULL) {
_php_ibase_module_error("trying to get num fields from a non-select query");
@@ -2283,11 +2277,7 @@
if (ARG_COUNT(ht)!=2 || zend_get_parameters_ex(2, &result_arg, &field_arg)==FAILURE) {
WRONG_PARAM_COUNT;
}
- /*
- convert_to_long(result_arg);
- GET_RESULT(result_arg->value.lval, ib_result);
- */
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result",
IBG(le_result));
if (ib_result->out_sqlda == NULL) {
Index: php4/ext/interbase/php_interbase.h
diff -u php4/ext/interbase/php_interbase.h:1.9 php4/ext/interbase/php_interbase.h:1.10
--- php4/ext/interbase/php_interbase.h:1.9 Fri May 12 05:02:14 2000
+++ php4/ext/interbase/php_interbase.h Fri May 12 10:37:03 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_interbase.h,v 1.9 2000/05/12 03:02:14 jah Exp $ */
+/* $Id: php_interbase.h,v 1.10 2000/05/12 08:37:03 jah Exp $ */
#ifndef _PHP_IBASE_H
#define _PHP_IBASE_H
@@ -122,6 +122,7 @@
isc_db_handle link; /* db link for this result */
isc_tr_handle trans;
isc_stmt_handle stmt;
+ int drop_stmt;
XSQLDA *in_sqlda, *out_sqlda;
ibase_array *in_array, *out_array;
int in_array_cnt, out_array_cnt;