[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2008-11-11 Thread Felipe Pena
felipe  Tue Nov 11 17:52:48 2008 UTC

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  - New parameter parsing API
  
http://cvs.php.net/viewvc.cgi/php-src/ext/interbase/interbase.c?r1=1.242r2=1.243diff_format=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.242 
php-src/ext/interbase/interbase.c:1.243
--- php-src/ext/interbase/interbase.c:1.242 Tue Nov 11 13:26:26 2008
+++ php-src/ext/interbase/interbase.c   Tue Nov 11 17:52:47 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.242 2008/11/11 13:26:26 felipe Exp $ */
+/* $Id: interbase.c,v 1.243 2008/11/11 17:52:47 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1098,30 +1098,24 @@
Close an InterBase connection */
 PHP_FUNCTION(ibase_close)
 {
-   zval **link_arg = NULL;
+   zval *link_arg = NULL;
ibase_db_link *ib_link;
int link_id;
 
RESET_ERRMSG;

-   switch (ZEND_NUM_ARGS()) {
-   case 0:
-   link_id = IBG(default_link);
-   IBG(default_link) = -1;
-   break;
-   case 1:
-   if (zend_get_parameters_ex(1, link_arg) == FAILURE) {
-   RETURN_FALSE;
-   }
-   convert_to_long_ex(link_arg);
-   link_id = Z_LVAL_PP(link_arg);
-   break;
-   default:
-   WRONG_PARAM_COUNT;
-   break;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |r, link_arg) 
== FAILURE) {
+   return;
+   }
+   
+   if (ZEND_NUM_ARGS() == 0) {
+   link_id = IBG(default_link);
+   IBG(default_link) = -1;
+   } else {
+   link_id = Z_RESVAL_P(link_arg);
}
 
-   ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, 
LE_LINK, le_link, le_plink);
+   ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, 
LE_LINK, le_link, le_plink);
zend_list_delete(link_id);
RETURN_TRUE;
 }
@@ -1131,31 +1125,25 @@
Drop an InterBase database */
 PHP_FUNCTION(ibase_drop_db)
 {
-   zval **link_arg = NULL;
+   zval *link_arg = NULL;
ibase_db_link *ib_link;
ibase_tr_list *l;
int link_id;
 
RESET_ERRMSG;
-
-   switch (ZEND_NUM_ARGS()) {
-   case 0:
-   link_id = IBG(default_link);
-   IBG(default_link) = -1;
-   break;
-   case 1:
-   if (zend_get_parameters_ex(1, link_arg) == FAILURE) {
-   RETURN_FALSE;
-   }
-   convert_to_long_ex(link_arg);
-   link_id = Z_LVAL_PP(link_arg);
-   break;
-   default:
-   WRONG_PARAM_COUNT;
-   break;
+   
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |r, link_arg) 
== FAILURE) {
+   return;
}

-   ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, 
LE_LINK, le_link, le_plink);
+   if (ZEND_NUM_ARGS() == 0) {
+   link_id = IBG(default_link);
+   IBG(default_link) = -1;
+   } else {
+   link_id = Z_RESVAL_P(link_arg);
+   }
+   
+   ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, 
LE_LINK, le_link, le_plink);
 
if (isc_drop_database(IB_STATUS, ib_link-handle)) {
_php_ibase_error(TSRMLS_C);
@@ -1197,9 +1185,9 @@
long trans_argl = 0;
char *tpb;
ISC_TEB *teb;
-   zval ***args = (zval ***) safe_emalloc(sizeof(zval **),argn,0);
+   zval ***args = NULL;
 
-   if (zend_get_parameters_array_ex(argn, args) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, +, 
args, argn) == FAILURE) {
efree(args);
efree(ib_link);
RETURN_FALSE;
@@ -1367,55 +1355,42 @@
ibase_trans *trans = NULL;
int res_id = 0;
ISC_STATUS result;
+   ibase_db_link *ib_link;
+   zval *arg = NULL;
+   int type;
 
RESET_ERRMSG;
+   
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |r, arg) == 
FAILURE) {
+   return;
+   }
 
-   switch (ZEND_NUM_ARGS()) {
-
-   ibase_db_link *ib_link;
-   zval **arg;
-   int type;
+   if (ZEND_NUM_ARGS() == 0) {
+   ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, 
IBG(default_link), LE_LINK, le_link, le_plink);
+   if (ib_link-tr_list == NULL || ib_link-tr_list-trans == 
NULL) {
+   

[PHP-CVS] cvs: php-src /ext/interbase interbase.c /ext/interbase/tests bug46543.phpt ZendEngine2 zend_list.h

2008-11-11 Thread Felipe Pena
felipe  Tue Nov 11 13:26:26 2008 UTC

  Added files: 
/php-src/ext/interbase/testsbug46543.phpt 

  Modified files:  
/ZendEngine2zend_list.h 
/php-src/ext/interbase  interbase.c 
  Log:
  - Added ZEND_FETCH_RESOURCE2_NO_RETURN() (a version of ZEND_FETCH_RESOURCE2 
but without the ZEND_VERIFY_RESOURCE() which contains RETURN_FALSE)
  - Fixed bug #46543 (ibase_trans() memory leaks when using wrong parameters)
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_list.h?r1=1.52r2=1.53diff_format=u
Index: ZendEngine2/zend_list.h
diff -u ZendEngine2/zend_list.h:1.52 ZendEngine2/zend_list.h:1.53
--- ZendEngine2/zend_list.h:1.52Mon Dec 31 07:12:07 2007
+++ ZendEngine2/zend_list.h Tue Nov 11 13:26:26 2008
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: zend_list.h,v 1.52 2007/12/31 07:12:07 sebastian Exp $ */
+/* $Id: zend_list.h,v 1.53 2008/11/11 13:26:26 felipe Exp $ */
 
 #ifndef ZEND_LIST_H
 #define ZEND_LIST_H
@@ -99,6 +99,9 @@
 #define ZEND_FETCH_RESOURCE2(rsrc, rsrc_type, passed_id, default_id, 
resource_type_name, resource_type1, resource_type2)   \
rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, 
resource_type_name, NULL, 2, resource_type1, resource_type2);   \
ZEND_VERIFY_RESOURCE(rsrc);
+   
+#define ZEND_FETCH_RESOURCE2_NO_RETURN(rsrc, rsrc_type, passed_id, default_id, 
resource_type_name, resource_type1, resource_type2) \
+   (rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, 
default_id, resource_type_name, NULL, 2, resource_type1, resource_type2))
 
 #define ZEND_REGISTER_RESOURCE(rsrc_result, rsrc_pointer, rsrc_type)  \
 zend_register_resource(rsrc_result, rsrc_pointer, rsrc_type);
http://cvs.php.net/viewvc.cgi/php-src/ext/interbase/interbase.c?r1=1.241r2=1.242diff_format=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.241 
php-src/ext/interbase/interbase.c:1.242
--- php-src/ext/interbase/interbase.c:1.241 Sun Nov  2 21:10:08 2008
+++ php-src/ext/interbase/interbase.c   Tue Nov 11 13:26:26 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.241 2008/11/02 21:10:08 felipe Exp $ */
+/* $Id: interbase.c,v 1.242 2008/11/11 13:26:26 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1214,8 +1214,13 @@

if (Z_TYPE_PP(args[i]) == IS_RESOURCE) {

-   ZEND_FETCH_RESOURCE2(ib_link[link_cnt], 
ibase_db_link *, args[i], -1, 
-   LE_LINK, le_link, le_plink);
+   if 
(!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link[link_cnt], ibase_db_link *, args[i], 
-1, LE_LINK, le_link, le_plink)) {
+   efree(teb);
+   efree(tpb);
+   efree(ib_link);
+   efree(args);
+   RETURN_FALSE;
+   }

/* copy the most recent modifier string into 
tbp[] */
memcpy(tpb[TPB_MAX_SIZE * link_cnt], last_tpb, 
TPB_MAX_SIZE);
@@ -1279,8 +1284,10 @@
 
if (link_cnt == 0) {
link_cnt = 1;
-   ZEND_FETCH_RESOURCE2(ib_link[0], ibase_db_link *, NULL, 
IBG(default_link), LE_LINK, 
-   le_link, le_plink);
+   if (!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link[0], ibase_db_link 
*, NULL, IBG(default_link), LE_LINK, le_link, le_plink)) {
+   efree(ib_link);
+   RETURN_FALSE;
+   }
result = isc_start_transaction(IB_STATUS, tr_handle, 1, 
ib_link[0]-handle, tpb_len, last_tpb);
}


http://cvs.php.net/viewvc.cgi/php-src/ext/interbase/tests/bug46543.phpt?view=markuprev=1.1
Index: php-src/ext/interbase/tests/bug46543.phpt
+++ php-src/ext/interbase/tests/bug46543.phpt
--TEST--
Bug #46543 (ibase_trans() memory leaks when using wrong parameters)
--SKIPIF--
?php include(skipif.inc); ?
--FILE--
?php

require(interbase.inc);

@ibase_close();

ibase_trans(1);
ibase_trans();
ibase_trans('foo');
ibase_trans(fopen(__FILE__, 'r'));

$x = ibase_connect($test_base);
ibase_trans(1, 2, $x, $x, 3);

?
--EXPECTF--
Warning: ibase_trans(): no Firebird/InterBase link resource supplied in %s on 
line %d

Warning: ibase_trans(): no Firebird/InterBase link resource supplied in %s on 
line %d

Warning: ibase_trans(): no Firebird/InterBase link resource supplied in %s on 
line %d

Warning: ibase_trans(): supplied resource is not a valid Firebird/InterBase 
link resource in %s on line %d



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2008-07-07 Thread Felipe Pena
felipe  Mon Jul  7 17:34:07 2008 UTC

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  MFB: - Added arginfo
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/interbase/interbase.c?r1=1.238r2=1.239diff_format=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.238 
php-src/ext/interbase/interbase.c:1.239
--- php-src/ext/interbase/interbase.c:1.238 Thu Feb 28 14:16:12 2008
+++ php-src/ext/interbase/interbase.c   Mon Jul  7 17:34:07 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.238 2008/02/28 14:16:12 felipe Exp $ */
+/* $Id: interbase.c,v 1.239 2008/07/07 17:34:07 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -46,64 +46,384 @@
 ZEND_DECLARE_MODULE_GLOBALS(ibase)
 static PHP_GINIT_FUNCTION(ibase);
 
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO(arginfo_ibase_errmsg, 0)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO(arginfo_ibase_errcode, 0)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_connect, 0, 0, 1)
+   ZEND_ARG_INFO(0, database)
+   ZEND_ARG_INFO(0, username)
+   ZEND_ARG_INFO(0, password)
+   ZEND_ARG_INFO(0, charset)
+   ZEND_ARG_INFO(0, buffers)
+   ZEND_ARG_INFO(0, dialect)
+   ZEND_ARG_INFO(0, role)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_pconnect, 0, 0, 1)
+   ZEND_ARG_INFO(0, database)
+   ZEND_ARG_INFO(0, username)
+   ZEND_ARG_INFO(0, password)
+   ZEND_ARG_INFO(0, charset)
+   ZEND_ARG_INFO(0, buffers)
+   ZEND_ARG_INFO(0, dialect)
+   ZEND_ARG_INFO(0, role)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_close, 0, 0, 0)
+   ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_drop_db, 0, 0, 0)
+   ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_trans, 0, 0, 0)
+   ZEND_ARG_INFO(0, trans_args)
+   ZEND_ARG_INFO(0, link_identifier)
+   ZEND_ARG_INFO(0, trans_args)
+   ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_commit, 0, 0, 1)
+   ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_rollback, 0, 0, 1)
+   ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_commit_ret, 0, 0, 1)
+   ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_rollback_ret, 0, 0, 1)
+   ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_gen_id, 0, 0, 1)
+   ZEND_ARG_INFO(0, generator)
+   ZEND_ARG_INFO(0, increment)
+   ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_blob_create, 0, 0, 0)
+   ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_blob_open, 0, 0, 0)
+   ZEND_ARG_INFO(0, link_identifier)
+   ZEND_ARG_INFO(0, blob_id)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_blob_add, 0, 0, 2)
+   ZEND_ARG_INFO(0, blob_handle)
+   ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_blob_get, 0, 0, 2)
+   ZEND_ARG_INFO(0, blob_handle)
+   ZEND_ARG_INFO(0, len)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_blob_close, 0, 0, 1)
+   ZEND_ARG_INFO(0, blob_handle)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_blob_cancel, 0, 0, 1)
+   ZEND_ARG_INFO(0, blob_handle)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_blob_info, 0, 0, 0)
+   ZEND_ARG_INFO(0, link_identifier)
+   ZEND_ARG_INFO(0, blob_id)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_blob_echo, 0, 0, 0)
+   ZEND_ARG_INFO(0, link_identifier)
+   ZEND_ARG_INFO(0, blob_id)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_blob_import, 0, 0, 0)
+   ZEND_ARG_INFO(0, link_identifier)
+   ZEND_ARG_INFO(0, file)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_query, 0, 0, 0)
+   ZEND_ARG_INFO(0, link_identifier)
+   ZEND_ARG_INFO(0, link_identifier)
+   ZEND_ARG_INFO(0, query)
+   ZEND_ARG_INFO(0, bind_arg)
+   ZEND_ARG_INFO(0, bind_arg)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_affected_rows, 0, 0, 0)
+   ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+#if abies_0
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_num_rows, 0, 0, 1)
+   ZEND_ARG_INFO(0, result_identifier)
+ZEND_END_ARG_INFO()
+#endif
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ibase_fetch_row, 0, 0, 1)
+   ZEND_ARG_INFO(0, result)
+   ZEND_ARG_INFO(0, fetch_flags)

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2007-02-28 Thread Hannes Magnusson
bjori   Wed Feb 28 10:46:16 2007 UTC

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Typo
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/interbase/interbase.c?r1=1.234r2=1.235diff_format=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.234 
php-src/ext/interbase/interbase.c:1.235
--- php-src/ext/interbase/interbase.c:1.234 Sat Feb 24 16:25:54 2007
+++ php-src/ext/interbase/interbase.c   Wed Feb 28 10:46:16 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.234 2007/02/24 16:25:54 helly Exp $ */
+/* $Id: interbase.c,v 1.235 2007/02/28 10:46:16 bjori Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1193,7 +1193,7 @@
 #if SIZEOF_LONG  8
if (result  LONG_MIN || result  LONG_MAX) {
char *res;
-   int l
+   int l;
 
l = spprintf(res, 0, % LL_MASK d, result);
RETURN_STRINGL(res, l, 0);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2007-01-18 Thread Antony Dovgal
tony2001Thu Jan 18 15:40:54 2007 UTC

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  use snprintf()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/interbase/interbase.c?r1=1.231r2=1.232diff_format=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.231 
php-src/ext/interbase/interbase.c:1.232
--- php-src/ext/interbase/interbase.c:1.231 Mon Jan  1 09:29:24 2007
+++ php-src/ext/interbase/interbase.c   Thu Jan 18 15:40:54 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.231 2007/01/01 09:29:24 sebastian Exp $ */
+/* $Id: interbase.c,v 1.232 2007/01/18 15:40:54 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -588,22 +588,28 @@

 int _php_ibase_attach_db(char **args, int *len, long *largs, isc_db_handle *db 
TSRMLS_DC)
 {
-   short i;
+   short i, dpb_len, buf_len = 256;
char dpb_buffer[256] = { isc_dpb_version1 }, *dpb;
 
dpb = dpb_buffer + 1;
 
for (i = 0; i  sizeof(dpb_args); ++i) {
-   if (dpb_args[i]  args[i]  len[i]) {
-   dpb += sprintf(dpb, %c%c%s, dpb_args[i],(unsigned 
char)len[i],args[i]);
+   if (dpb_args[i]  args[i]  len[i]  buf_len  0) {
+   dpb_len += snprintf(dpb, buf_len, %c%c%s, 
dpb_args[i],(unsigned char)len[i],args[i]);
+   dpb += dpb_len;
+   buf_len -= dpb_len;
}
}
-   if (largs[BUF]) {
-   dpb += sprintf(dpb, %c\2%c%c, isc_dpb_num_buffers, 
+   if (largs[BUF]  buf_len  0) {
+   dpb_len += snprintf(dpb, buf_len, %c\2%c%c, 
isc_dpb_num_buffers, 
(char)(largs[BUF]  8), (char)(largs[BUF]  0xff));
+   dpb += dpb_len;
+   buf_len -= dpb_len;
}
-   if (largs[SYNC]) {
-   dpb += sprintf(dpb, %c\1%c, isc_dpb_force_write, largs[SYNC] 
== isc_spb_prp_wm_sync ? 1 : 0);
+   if (largs[SYNC]  buf_len  0) {
+   dpb_len += sprintf(dpb, buf_len, %c\1%c, isc_dpb_force_write, 
largs[SYNC] == isc_spb_prp_wm_sync ? 1 : 0);
+   dpb += dpb_len;
+   buf_len -= dpb_len;
}
if (isc_attach_database(IB_STATUS, (short)len[DB], args[DB], db, 
(short)(dpb-dpb_buffer), dpb_buffer)) {
_php_ibase_error(TSRMLS_C);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2007-01-18 Thread Antony Dovgal
tony2001Thu Jan 18 15:53:54 2007 UTC

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  fix the previous patch
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/interbase/interbase.c?r1=1.232r2=1.233diff_format=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.232 
php-src/ext/interbase/interbase.c:1.233
--- php-src/ext/interbase/interbase.c:1.232 Thu Jan 18 15:40:54 2007
+++ php-src/ext/interbase/interbase.c   Thu Jan 18 15:53:53 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.232 2007/01/18 15:40:54 tony2001 Exp $ */
+/* $Id: interbase.c,v 1.233 2007/01/18 15:53:53 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -595,19 +595,19 @@
 
for (i = 0; i  sizeof(dpb_args); ++i) {
if (dpb_args[i]  args[i]  len[i]  buf_len  0) {
-   dpb_len += snprintf(dpb, buf_len, %c%c%s, 
dpb_args[i],(unsigned char)len[i],args[i]);
+   dpb_len = snprintf(dpb, buf_len, %c%c%s, 
dpb_args[i],(unsigned char)len[i],args[i]);
dpb += dpb_len;
buf_len -= dpb_len;
}
}
if (largs[BUF]  buf_len  0) {
-   dpb_len += snprintf(dpb, buf_len, %c\2%c%c, 
isc_dpb_num_buffers, 
+   dpb_len = snprintf(dpb, buf_len, %c\2%c%c, 
isc_dpb_num_buffers, 
(char)(largs[BUF]  8), (char)(largs[BUF]  0xff));
dpb += dpb_len;
buf_len -= dpb_len;
}
if (largs[SYNC]  buf_len  0) {
-   dpb_len += sprintf(dpb, buf_len, %c\1%c, isc_dpb_force_write, 
largs[SYNC] == isc_spb_prp_wm_sync ? 1 : 0);
+   dpb_len = sprintf(dpb, buf_len, %c\1%c, isc_dpb_force_write, 
largs[SYNC] == isc_spb_prp_wm_sync ? 1 : 0);
dpb += dpb_len;
buf_len -= dpb_len;
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2005-12-11 Thread Marcus Boerger
helly   Sun Dec 11 12:46:51 2005 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  - Revert accidential 'drop in' from 1.227
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.227r2=1.228ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.227 
php-src/ext/interbase/interbase.c:1.228
--- php-src/ext/interbase/interbase.c:1.227 Tue Dec  6 02:24:34 2005
+++ php-src/ext/interbase/interbase.c   Sun Dec 11 12:46:51 2005
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.227 2005/12/06 02:24:34 sniper Exp $ */
+/* $Id: interbase.c,v 1.228 2005/12/11 12:46:51 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -36,7 +36,7 @@
 #include php_interbase.h
 #include php_ibase_includes.h
 #include SAPI.h
-5B
+
 #include time.h
 
 #define ROLLBACK   0

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2005-02-23 Thread Ard Biesheuvel
abies   Wed Feb 23 15:20:27 2005 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fixed bug #31597: ibase_connect() - incorrect warning
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.223r2=1.224ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.223 
php-src/ext/interbase/interbase.c:1.224
--- php-src/ext/interbase/interbase.c:1.223 Tue Jul  6 09:46:18 2004
+++ php-src/ext/interbase/interbase.c   Wed Feb 23 15:20:25 2005
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.223 2004/07/06 13:46:18 abies Exp $ */
+/* $Id: interbase.c,v 1.224 2005/02/23 20:20:25 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -591,7 +591,7 @@
dpb = dpb_buffer + 1;
 
for (i = 0; i  sizeof(dpb_args); ++i) {
-   if (dpb_args[i]  args[i]) {
+   if (dpb_args[i]  args[i]  len[i]) {
dpb += sprintf(dpb, %c%c%s, dpb_args[i],(unsigned 
char)len[i],args[i]);
}
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-06-30 Thread Ard Biesheuvel
abies   Wed Jun 30 06:55:03 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fixed Ilia's alloca() issue/exploit
  Removed pointless RINIT()
  Use macros for consistent resource type names
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.221r2=1.222ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.221 php-src/ext/interbase/interbase.c:1.222
--- php-src/ext/interbase/interbase.c:1.221 Tue Jun  1 04:38:33 2004
+++ php-src/ext/interbase/interbase.c   Wed Jun 30 06:55:03 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.221 2004/06/01 08:38:33 abies Exp $ */
+/* $Id: interbase.c,v 1.222 2004/06/30 10:55:03 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -174,7 +174,7 @@
ibase_functions,
PHP_MINIT(ibase),
PHP_MSHUTDOWN(ibase),
-   PHP_RINIT(ibase),
+   NULL,
PHP_RSHUTDOWN(ibase),
PHP_MINFO(ibase),
NO_VERSION_YET,
@@ -284,7 +284,7 @@
/* Transaction resource: make sure it refers to one link only, 
then 
   fetch it; database link is stored in ib_trans-db_link[]. */
IBDEBUG(Type is le_trans);
-   ZEND_FETCH_RESOURCE(*trans, ibase_trans *, link_id, -1, 
InterBase transaction, le_trans);
+   ZEND_FETCH_RESOURCE(*trans, ibase_trans *, link_id, -1, 
LE_TRANS, le_trans);
if ((*trans)-link_cnt  1) {
_php_ibase_module_error(Link id is ambiguous: 
transaction spans multiple connections.
TSRMLS_CC);
@@ -297,7 +297,7 @@
IBDEBUG(Type is le_[p]link or id not found);
/* Database link resource, use default transaction. */
*trans = NULL;
-   ZEND_FETCH_RESOURCE2(*ib_link, ibase_db_link *, link_id, -1, InterBase link, 
le_link, le_plink);
+   ZEND_FETCH_RESOURCE2(*ib_link, ibase_db_link *, link_id, -1, LE_LINK, le_link, 
le_plink);
 }
 /* }}} */  
 
@@ -450,8 +450,9 @@
 
 static void php_ibase_init_globals(zend_ibase_globals *ibase_globals)
 {
-   ibase_globals-num_persistent = 0;
-   ibase_globals-sql_code = 0;
+   ibase_globals-num_persistent = ibase_globals-num_links = 0;
+   ibase_globals-sql_code = *ibase_globals-errmsg = 0;
+   ibase_globals-default_link = -1;
 }
 
 PHP_MINIT_FUNCTION(ibase)
@@ -460,9 +461,9 @@
 
REGISTER_INI_ENTRIES();
 
-   le_link = zend_register_list_destructors_ex(_php_ibase_close_link, NULL, 
interbase link, module_number);
-   le_plink = zend_register_list_destructors_ex(php_ibase_commit_link_rsrc, 
_php_ibase_close_plink, interbase link persistent, module_number);
-   le_trans = zend_register_list_destructors_ex(_php_ibase_free_trans, NULL, 
interbase transaction, module_number);
+   le_link = zend_register_list_destructors_ex(_php_ibase_close_link, NULL, 
LE_LINK, module_number);
+   le_plink = zend_register_list_destructors_ex(php_ibase_commit_link_rsrc, 
_php_ibase_close_plink, LE_PLINK, module_number);
+   le_trans = zend_register_list_destructors_ex(_php_ibase_free_trans, NULL, 
LE_TRANS, module_number);
 
REGISTER_LONG_CONSTANT(IBASE_DEFAULT, PHP_IBASE_DEFAULT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(IBASE_CREATE, PHP_IBASE_CREATE, CONST_PERSISTENT);
@@ -490,16 +491,6 @@
return SUCCESS;  
 }
  
-PHP_RINIT_FUNCTION(ibase)
-{
-   IBG(default_link)= -1;
-   IBG(num_links) = IBG(num_persistent);
-
-   RESET_ERRMSG;
-
-   return SUCCESS;
-}
-
 PHP_MSHUTDOWN_FUNCTION(ibase)
 {
 #ifndef PHP_WIN32
@@ -527,6 +518,11 @@
 
 PHP_RSHUTDOWN_FUNCTION(ibase)
 {
+   IBG(num_links) = IBG(num_persistent);
+   IBG(default_link)= -1;
+
+   RESET_ERRMSG;
+
return SUCCESS;
 } 
  
@@ -794,8 +790,7 @@
break;
}
 
-   ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, InterBase 
link,
-   le_link, le_plink);
+   ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, LE_LINK, 
le_link, le_plink);
zend_list_delete(link_id);
RETURN_TRUE;
 }
@@ -829,8 +824,8 @@
break;
}

-   ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, InterBase 
link,
-   le_link, le_plink);
+   ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, LE_LINK, 
le_link, le_plink);
+
if (isc_drop_database(IB_STATUS, ib_link-handle)) {
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
@@ -865,22 +860,22 @@
argn = ZEND_NUM_ARGS();
 
/* (1+argn) is an upper bound for the number of links this trans connects to */
-   ib_link = (ibase_db_link **) 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_ibase_includes.h /ext/interbase/tests 003.phpt 006.phpt 007.phpt

2004-05-30 Thread Ard Biesheuvel
abies   Sun May 30 12:20:25 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_ibase_includes.h 
/php-src/ext/interbase/tests003.phpt 006.phpt 007.phpt 
  Log:
  Removed ibase_timefmt() - use ini_set() instead
  Improved phpinfo() appearance
  
  http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.217r2=1.218ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.217 php-src/ext/interbase/interbase.c:1.218
--- php-src/ext/interbase/interbase.c:1.217 Fri May 28 19:39:33 2004
+++ php-src/ext/interbase/interbase.c   Sun May 30 12:20:24 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.217 2004/05/28 23:39:33 abies Exp $ */
+/* $Id: interbase.c,v 1.218 2004/05/30 16:20:24 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -28,7 +28,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.217 $
+#define FILE_REVISION $Revision: 1.218 $
 
 #if HAVE_IBASE
 
@@ -59,7 +59,6 @@
PHP_FE(ibase_prepare, NULL)
PHP_FE(ibase_execute, NULL)
PHP_FE(ibase_free_query, NULL)
-   PHP_FE(ibase_timefmt, NULL)
PHP_FE(ibase_gen_id, NULL)
PHP_FE(ibase_num_fields, NULL)
PHP_FE(ibase_num_params, NULL)
@@ -124,7 +123,6 @@
PHP_FALIAS(fbird_prepare,ibase_prepare, NULL)
PHP_FALIAS(fbird_execute,ibase_execute, NULL)
PHP_FALIAS(fbird_free_query,ibase_free_query, NULL)
-   PHP_FALIAS(fbird_timefmt,ibase_timefmt, NULL)
PHP_FALIAS(fbird_gen_id,ibase_gen_id, NULL)
PHP_FALIAS(fbird_num_fields,ibase_num_fields, NULL)
PHP_FALIAS(fbird_num_params,ibase_num_params, NULL)
@@ -186,13 +184,6 @@
 
 #ifdef COMPILE_DL_INTERBASE
 ZEND_GET_MODULE(ibase)
-#define DL_MALLOC(size) malloc(size)
-#define DL_STRDUP(str) strdup(str)
-#define DL_FREE(ptr) free(ptr)
-#else
-#define DL_MALLOC(size) emalloc(size)
-#define DL_STRDUP(str) estrdup(str)
-#define DL_FREE(ptr) efree(ptr)
 #endif
 
 /* True globals, no need for thread safety */
@@ -429,6 +420,16 @@
 }
 /* }}} */
 
+static ZEND_INI_DISP(php_ibase_password_displayer_cb)
+{
+   if ((type == ZEND_INI_DISPLAY_ORIG  ini_entry-orig_value) 
+   || (type != ZEND_INI_DISPLAY_ORIG  ini_entry-value)) {
+   ZEND_PUTS();
+   } else {
+   ZEND_PUTS(no value);
+   }
+}
+
 /* {{{ startup, shutdown and info functions */
 PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN(ibase.allow_persistent, 1, PHP_INI_SYSTEM, 
OnUpdateBool, allow_persistent, zend_ibase_globals, ibase_globals)
@@ -436,18 +437,15 @@
STD_PHP_INI_ENTRY_EX(ibase.max_links, -1, PHP_INI_SYSTEM, OnUpdateLong, 
max_links, zend_ibase_globals, ibase_globals, display_link_numbers)
STD_PHP_INI_ENTRY(ibase.default_db, NULL, PHP_INI_SYSTEM, OnUpdateString, 
default_db, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY(ibase.default_user, NULL, PHP_INI_ALL, OnUpdateString, 
default_user, zend_ibase_globals, ibase_globals)
-   STD_PHP_INI_ENTRY(ibase.default_password, NULL, PHP_INI_ALL, OnUpdateString, 
default_password, zend_ibase_globals, ibase_globals)
+   STD_PHP_INI_ENTRY_EX(ibase.default_password, NULL, PHP_INI_ALL, 
OnUpdateString, default_password, zend_ibase_globals, 
ibase_globals,php_ibase_password_displayer_cb)
STD_PHP_INI_ENTRY(ibase.default_charset, NULL, PHP_INI_ALL, OnUpdateString, 
default_charset, zend_ibase_globals, ibase_globals)
-   STD_PHP_INI_ENTRY(ibase.timestampformat, IB_DEF_DATE_FMT   
IB_DEF_TIME_FMT, PHP_INI_ALL, OnUpdateString, cfg_timestampformat, zend_ibase_globals, 
ibase_globals)
-   STD_PHP_INI_ENTRY(ibase.dateformat, IB_DEF_DATE_FMT, PHP_INI_ALL, 
OnUpdateString, cfg_dateformat, zend_ibase_globals, ibase_globals)
-   STD_PHP_INI_ENTRY(ibase.timeformat, IB_DEF_TIME_FMT, PHP_INI_ALL, 
OnUpdateString, cfg_timeformat, zend_ibase_globals, ibase_globals)
+   STD_PHP_INI_ENTRY(ibase.timestampformat, IB_DEF_DATE_FMT   
IB_DEF_TIME_FMT, PHP_INI_ALL, OnUpdateString, timestampformat, zend_ibase_globals, 
ibase_globals)
+   STD_PHP_INI_ENTRY(ibase.dateformat, IB_DEF_DATE_FMT, PHP_INI_ALL, 
OnUpdateString, dateformat, zend_ibase_globals, ibase_globals)
+   STD_PHP_INI_ENTRY(ibase.timeformat, IB_DEF_TIME_FMT, PHP_INI_ALL, 
OnUpdateString, timeformat, zend_ibase_globals, ibase_globals)
 PHP_INI_END()
 
 static void php_ibase_init_globals(zend_ibase_globals *ibase_globals)
 {
-   ibase_globals-timestampformat = NULL;
-   ibase_globals-dateformat = NULL;
-   ibase_globals-timeformat = NULL;
ibase_globals-num_persistent = 0;
ibase_globals-sql_code = 0;
 }
@@ -467,9 +465,6 @@
REGISTER_LONG_CONSTANT(IBASE_FETCH_BLOBS, PHP_IBASE_FETCH_BLOBS, 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(IBASE_FETCH_ARRAYS, PHP_IBASE_FETCH_ARRAYS, 
CONST_PERSISTENT);

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-05-30 Thread Ard Biesheuvel
abies   Sun May 30 12:41:28 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fix HTML/table layout in info() entry
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.218r2=1.219ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.218 php-src/ext/interbase/interbase.c:1.219
--- php-src/ext/interbase/interbase.c:1.218 Sun May 30 12:20:24 2004
+++ php-src/ext/interbase/interbase.c   Sun May 30 12:41:28 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.218 2004/05/30 16:20:24 abies Exp $ */
+/* $Id: interbase.c,v 1.219 2004/05/30 16:41:28 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -28,7 +28,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.218 $
+#define FILE_REVISION $Revision: 1.219 $
 
 #if HAVE_IBASE
 
@@ -37,6 +37,7 @@
 #include ext/standard/md5.h
 #include php_interbase.h
 #include php_ibase_includes.h
+#include SAPI.h
 
 #include time.h
 
@@ -420,13 +421,16 @@
 }
 /* }}} */
 
-static ZEND_INI_DISP(php_ibase_password_displayer_cb)
+/* TODO this function should be part of either Zend or PHP API */
+static PHP_INI_DISP(php_ibase_password_displayer_cb)
 {
-   if ((type == ZEND_INI_DISPLAY_ORIG  ini_entry-orig_value) 
-   || (type != ZEND_INI_DISPLAY_ORIG  ini_entry-value)) {
-   ZEND_PUTS();
+   if ((type == PHP_INI_DISPLAY_ORIG  ini_entry-orig_value) 
+   || (type == PHP_INI_DISPLAY_ACTIVE  ini_entry-value)) {
+   PUTS();
+   } else if (!sapi_module.phpinfo_as_text) {
+   PUTS(ino value/i);
} else {
-   ZEND_PUTS(no value);
+   PUTS(no value);
}
 }
 
@@ -569,10 +573,10 @@
php_info_print_table_row(2, Run-time Client Library Version, s);
} while (0);
 #endif 
+   php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
 
-   php_info_print_table_end();
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-05-28 Thread Ard Biesheuvel
abies   Fri May 28 16:11:35 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fix commit/rollback of multi-link transactions
  Some CS
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.215r2=1.216ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.215 php-src/ext/interbase/interbase.c:1.216
--- php-src/ext/interbase/interbase.c:1.215 Sat May 22 14:50:58 2004
+++ php-src/ext/interbase/interbase.c   Fri May 28 16:11:34 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.215 2004/05/22 18:50:58 abies Exp $ */
+/* $Id: interbase.c,v 1.216 2004/05/28 20:11:34 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -28,7 +28,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.215 $
+#define FILE_REVISION $Revision: 1.216 $
 
 #if HAVE_IBASE
 
@@ -721,65 +721,67 @@
zend_hash_del(EG(regular_list), hash, sizeof(hash));
}
}   
+
/* ... or a persistent one */
-   if (SUCCESS == zend_hash_find(EG(persistent_list), hash, sizeof(hash), (void 
*) le)) {
+   switch (zend_hash_find(EG(persistent_list), hash, sizeof(hash), (void *) 
le)) {
static char info[] = { isc_info_base_level, isc_info_end };
char result[8];
ISC_STATUS status[20];
 
+   case SUCCESS:
+
if (Z_TYPE_P(le) != le_plink) {
RETURN_FALSE;
}
/* check if connection has timed out */
ib_link = (ibase_db_link *) le-ptr;
-   if (isc_database_info(status, ib_link-handle, sizeof(info), info, 
sizeof(result), result)) {
-   zend_hash_del(EG(persistent_list), hash, sizeof(hash));
-   } else {
+   if (!isc_database_info(status, ib_link-handle, sizeof(info), info, 
sizeof(result), result)) {
ZEND_REGISTER_RESOURCE(return_value, ib_link, le_plink);
-   goto register_link_resource;
+   break;
}
-   }
-
-   /* no link found, so we have to open one */
-
-   if (IBG(max_links) != -1  IBG(num_links) = IBG(max_links)) {
-   _php_ibase_module_error(Too many open links (%ld) TSRMLS_CC, 
IBG(num_links));
-   RETURN_FALSE;
-   }
-
-   /* create the ib_link */
-   if (FAILURE == _php_ibase_attach_db(args, len, largs, db_handle TSRMLS_CC)) {
-   RETURN_FALSE;
-   }
-
-   /* use non-persistent if allowed number of persistent links is exceeded */
-   if (!persistent || (IBG(max_persistent) != -1  IBG(num_persistent) = 
IBG(max_persistent))) {
-   ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
-   ZEND_REGISTER_RESOURCE(return_value, ib_link, le_link);
-   } else {
-   list_entry new_le;
-   
-   ib_link = (ibase_db_link *) malloc(sizeof(ibase_db_link));
+   zend_hash_del(EG(persistent_list), hash, sizeof(hash));
+   
+   default:
 
-   /* hash it up */
-   Z_TYPE(new_le) = le_plink;
-   new_le.ptr = ib_link;
-   if (FAILURE == zend_hash_update(EG(persistent_list), hash, 
sizeof(hash),
-   (void *) new_le, sizeof(list_entry), NULL)) {
-   free(ib_link);
+   /* no link found, so we have to open one */
+   
+   if (IBG(max_links) != -1  IBG(num_links) = IBG(max_links)) {
+   _php_ibase_module_error(Too many open links (%ld) TSRMLS_CC, 
IBG(num_links));
RETURN_FALSE;
}
-   ZEND_REGISTER_RESOURCE(return_value, ib_link, le_plink);
-   ++IBG(num_persistent);
+   
+   /* create the ib_link */
+   if (FAILURE == _php_ibase_attach_db(args, len, largs, db_handle 
TSRMLS_CC)) {
+   RETURN_FALSE;
+   }
+   
+   /* use non-persistent if allowed number of persistent links is 
exceeded */
+   if (!persistent || (IBG(max_persistent) != -1  IBG(num_persistent) 
= IBG(max_persistent))) {
+   ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
+   ZEND_REGISTER_RESOURCE(return_value, ib_link, le_link);
+   } else {
+   list_entry new_le;
+   
+   ib_link = (ibase_db_link *) malloc(sizeof(ibase_db_link));
+   
+   /* hash it up */
+   Z_TYPE(new_le) = le_plink;
+   new_le.ptr = ib_link;
+   if (FAILURE == zend_hash_update(EG(persistent_list), hash, 
sizeof(hash),
+   

[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_ibase_includes.h

2004-05-28 Thread Ard Biesheuvel
abies   Fri May 28 19:39:33 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_ibase_includes.h 
  Log:
  Changed default date format to ISO
  Enable sync flag in connect()
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.216r2=1.217ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.216 php-src/ext/interbase/interbase.c:1.217
--- php-src/ext/interbase/interbase.c:1.216 Fri May 28 16:11:34 2004
+++ php-src/ext/interbase/interbase.c   Fri May 28 19:39:33 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.216 2004/05/28 20:11:34 abies Exp $ */
+/* $Id: interbase.c,v 1.217 2004/05/28 23:39:33 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -28,7 +28,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.216 $
+#define FILE_REVISION $Revision: 1.217 $
 
 #if HAVE_IBASE
 
@@ -431,16 +431,16 @@
 
 /* {{{ startup, shutdown and info functions */
 PHP_INI_BEGIN()
-   STD_PHP_INI_BOOLEAN(ibase.allow_persistent, 1, PHP_INI_SYSTEM, 
OnUpdateLong, allow_persistent, zend_ibase_globals, ibase_globals)
+   STD_PHP_INI_BOOLEAN(ibase.allow_persistent, 1, PHP_INI_SYSTEM, 
OnUpdateBool, allow_persistent, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY_EX(ibase.max_persistent, -1, PHP_INI_SYSTEM, 
OnUpdateLong, max_persistent, zend_ibase_globals, ibase_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX(ibase.max_links, -1, PHP_INI_SYSTEM, OnUpdateLong, 
max_links, zend_ibase_globals, ibase_globals, display_link_numbers)
STD_PHP_INI_ENTRY(ibase.default_db, NULL, PHP_INI_SYSTEM, OnUpdateString, 
default_db, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY(ibase.default_user, NULL, PHP_INI_ALL, OnUpdateString, 
default_user, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY(ibase.default_password, NULL, PHP_INI_ALL, OnUpdateString, 
default_password, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY(ibase.default_charset, NULL, PHP_INI_ALL, OnUpdateString, 
default_charset, zend_ibase_globals, ibase_globals)
-   STD_PHP_INI_ENTRY(ibase.timestampformat, %m/%d/%Y %H:%M:%S, PHP_INI_ALL, 
OnUpdateString, cfg_timestampformat, zend_ibase_globals, ibase_globals)
-   STD_PHP_INI_ENTRY(ibase.dateformat, %m/%d/%Y, PHP_INI_ALL, OnUpdateString, 
cfg_dateformat, zend_ibase_globals, ibase_globals)
-   STD_PHP_INI_ENTRY(ibase.timeformat, %H:%M:%S, PHP_INI_ALL, OnUpdateString, 
cfg_timeformat, zend_ibase_globals, ibase_globals)
+   STD_PHP_INI_ENTRY(ibase.timestampformat, IB_DEF_DATE_FMT   
IB_DEF_TIME_FMT, PHP_INI_ALL, OnUpdateString, cfg_timestampformat, zend_ibase_globals, 
ibase_globals)
+   STD_PHP_INI_ENTRY(ibase.dateformat, IB_DEF_DATE_FMT, PHP_INI_ALL, 
OnUpdateString, cfg_dateformat, zend_ibase_globals, ibase_globals)
+   STD_PHP_INI_ENTRY(ibase.timeformat, IB_DEF_TIME_FMT, PHP_INI_ALL, 
OnUpdateString, cfg_timeformat, zend_ibase_globals, ibase_globals)
 PHP_INI_END()
 
 static void php_ibase_init_globals(zend_ibase_globals *ibase_globals)
@@ -628,10 +628,10 @@
 }
 /* }}} */
 
-enum connect_args { DB = 0, USER = 1, PASS = 2, CSET = 3, ROLE = 4, BUF = 0, DLECT = 
1 };
+enum connect_args { DB = 0, USER = 1, PASS = 2, CSET = 3, ROLE = 4, BUF = 0, DLECT = 
1, SYNC = 2 };

 static char const dpb_args[] = { 
-   0, isc_dpb_user_name, isc_dpb_password, isc_dpb_lc_ctype, isc_dpb_sql_role_name
+   0, isc_dpb_user_name, isc_dpb_password, isc_dpb_lc_ctype, 
isc_dpb_sql_role_name, 0
 };

 int _php_ibase_attach_db(char **args, int *len, long *largs, isc_db_handle *db 
TSRMLS_DC)
@@ -650,6 +650,9 @@
dpb += sprintf(dpb, %c\2%c%c, isc_dpb_num_buffers, 
(char)(largs[BUF]  8), (char)(largs[BUF]  0xff));
}
+   if (largs[SYNC]) {
+   dpb += sprintf(dpb, %c\1%c, isc_dpb_force_write, largs[SYNC] == 
isc_spb_prp_wm_sync ? 1 : 0);
+   }
if (isc_attach_database(IB_STATUS, (short)len[DB], args[DB], db, 
(short)(dpb-dpb_buffer), dpb_buffer)) {
_php_ibase_error(TSRMLS_C);
return FAILURE;
@@ -662,7 +665,7 @@
 {
char hash[16], *args[] = { NULL, NULL, NULL, NULL, NULL };
int i, len[] = { 0, 0, 0, 0, 0 };
-   long largs[] = { 0, 0 };
+   long largs[] = { 0, 0, 0 };
PHP_MD5_CTX hash_context;
list_entry new_index_ptr, *le;
isc_db_handle db_handle = NULL;
@@ -670,9 +673,10 @@
 
RESET_ERRMSG;
 
-   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |lls,
+   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |llsl,
args[DB], len[DB], args[USER], len[USER], args[PASS], 
len[PASS],
-   args[CSET], len[CSET], largs[BUF], largs[DLECT], 
args[ROLE], len[ROLE])) {
+   args[CSET], 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-05-22 Thread Ard Biesheuvel
abies   Sat May 22 14:50:59 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Use dummy status vector in ibase_connect()
  Added fbird_ aliases for all ibase_ functions
  # See comment in code for more info
  # Please let me know if there are any namespace issues involved
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.214r2=1.215ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.214 php-src/ext/interbase/interbase.c:1.215
--- php-src/ext/interbase/interbase.c:1.214 Wed May 12 10:29:42 2004
+++ php-src/ext/interbase/interbase.c   Sat May 22 14:50:58 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.214 2004/05/12 14:29:42 abies Exp $ */
+/* $Id: interbase.c,v 1.215 2004/05/22 18:50:58 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -28,7 +28,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.214 $
+#define FILE_REVISION $Revision: 1.215 $
 
 #if HAVE_IBASE
 
@@ -103,6 +103,71 @@
PHP_FE(ibase_wait_event, NULL)
PHP_FE(ibase_set_event_handler, NULL)
PHP_FE(ibase_free_event_handler, NULL)
+
+   /**
+   * These aliases are provided in order to maintain forward compatibility. As 
Firebird
+   * and InterBase are developed independently, functionality might be different 
between
+   * the two branches in future versions.
+   * Firebird users should use the aliases, so future InterBase-specific changes 
will
+   * not affect their code
+   */
+   PHP_FALIAS(fbird_connect,ibase_connect, NULL)
+   PHP_FALIAS(fbird_pconnect,ibase_pconnect, NULL)
+   PHP_FALIAS(fbird_close,ibase_close, NULL)
+   PHP_FALIAS(fbird_drop_db,ibase_drop_db, NULL)
+   PHP_FALIAS(fbird_query,ibase_query, NULL)
+   PHP_FALIAS(fbird_fetch_row,ibase_fetch_row, NULL)
+   PHP_FALIAS(fbird_fetch_assoc,ibase_fetch_assoc, NULL)
+   PHP_FALIAS(fbird_fetch_object,ibase_fetch_object, NULL)
+   PHP_FALIAS(fbird_free_result,ibase_free_result, NULL)
+   PHP_FALIAS(fbird_name_result,ibase_name_result, NULL)
+   PHP_FALIAS(fbird_prepare,ibase_prepare, NULL)
+   PHP_FALIAS(fbird_execute,ibase_execute, NULL)
+   PHP_FALIAS(fbird_free_query,ibase_free_query, NULL)
+   PHP_FALIAS(fbird_timefmt,ibase_timefmt, NULL)
+   PHP_FALIAS(fbird_gen_id,ibase_gen_id, NULL)
+   PHP_FALIAS(fbird_num_fields,ibase_num_fields, NULL)
+   PHP_FALIAS(fbird_num_params,ibase_num_params, NULL)
+#if abies_0
+   PHP_FALIAS(fbird_num_rows,ibase_num_rows, NULL)
+#endif
+   PHP_FALIAS(fbird_affected_rows,ibase_affected_rows, NULL)
+   PHP_FALIAS(fbird_field_info,ibase_field_info, NULL)
+   PHP_FALIAS(fbird_param_info,ibase_param_info, NULL)
+
+   PHP_FALIAS(fbird_trans,ibase_trans, NULL)
+   PHP_FALIAS(fbird_commit,ibase_commit, NULL)
+   PHP_FALIAS(fbird_rollback,ibase_rollback, NULL)
+   PHP_FALIAS(fbird_commit_ret,ibase_commit_ret, NULL)
+   PHP_FALIAS(fbird_rollback_ret,ibase_rollback_ret, NULL)
+
+   PHP_FALIAS(fbird_blob_info,ibase_blob_info, NULL)
+   PHP_FALIAS(fbird_blob_create,ibase_blob_create, NULL)
+   PHP_FALIAS(fbird_blob_add,ibase_blob_add, NULL)
+   PHP_FALIAS(fbird_blob_cancel,ibase_blob_cancel, NULL)
+   PHP_FALIAS(fbird_blob_close,ibase_blob_close, NULL)
+   PHP_FALIAS(fbird_blob_open,ibase_blob_open, NULL)
+   PHP_FALIAS(fbird_blob_get,ibase_blob_get, NULL)
+   PHP_FALIAS(fbird_blob_echo,ibase_blob_echo, NULL)
+   PHP_FALIAS(fbird_blob_import,ibase_blob_import, NULL)
+   PHP_FALIAS(fbird_errmsg,ibase_errmsg, NULL)
+   PHP_FALIAS(fbird_errcode,ibase_errcode, NULL)
+
+   PHP_FALIAS(fbird_add_user,ibase_add_user, NULL)
+   PHP_FALIAS(fbird_modify_user,ibase_modify_user, NULL)
+   PHP_FALIAS(fbird_delete_user,ibase_delete_user, NULL)
+
+   PHP_FALIAS(fbird_service_attach,ibase_service_attach, NULL)
+   PHP_FALIAS(fbird_service_detach,ibase_service_detach, NULL)
+   PHP_FALIAS(fbird_backup,ibase_backup, NULL)
+   PHP_FALIAS(fbird_restore,ibase_restore, NULL)
+   PHP_FALIAS(fbird_maintain_db,ibase_maintain_db, NULL)
+   PHP_FALIAS(fbird_db_info,ibase_db_info, NULL)
+   PHP_FALIAS(fbird_server_info,ibase_server_info, NULL)
+
+   PHP_FALIAS(fbird_wait_event,ibase_wait_event, NULL)
+   PHP_FALIAS(fbird_set_event_handler,ibase_set_event_handler, NULL)
+   PHP_FALIAS(fbird_free_event_handler,ibase_free_event_handler, NULL)
{NULL, NULL, NULL}
 };
 
@@ -660,13 +725,14 @@
if (SUCCESS == zend_hash_find(EG(persistent_list), hash, sizeof(hash), (void 
*) le)) {
static char info[] = { isc_info_base_level, isc_info_end };
char result[8];
+   ISC_STATUS status[20];
 
if (Z_TYPE_P(le) != le_plink) {
RETURN_FALSE;

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-05-12 Thread Ard Biesheuvel
abies   Wed May 12 09:14:55 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Made ibase_timefmt() check its args more thoroughly and nuked a pointless malloc()
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.212r2=1.213ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.212 php-src/ext/interbase/interbase.c:1.213
--- php-src/ext/interbase/interbase.c:1.212 Wed May 12 09:07:35 2004
+++ php-src/ext/interbase/interbase.c   Wed May 12 09:14:55 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.212 2004/05/12 13:07:35 abies Exp $ */
+/* $Id: interbase.c,v 1.213 2004/05/12 13:14:55 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -30,7 +30,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.212 $
+#define FILE_REVISION $Revision: 1.213 $
 
 #if HAVE_IBASE
 
@@ -1136,34 +1136,18 @@
 #endif
 /* }}} */
 
-#if HAVE_STRFTIME
 /* {{{ proto bool ibase_timefmt(string format [, int type ])
Sets the format of timestamp, date and time columns returned from queries */
 PHP_FUNCTION(ibase_timefmt)
 {
-   zval ***args;
-   char *fmt = NULL;
-   int type = PHP_IBASE_TIMESTAMP;
-   
-   if (ZEND_NUM_ARGS()  1 || ZEND_NUM_ARGS()  2) {
-   WRONG_PARAM_COUNT;
-   }
+   char *fmt;
+   int fmt_len;
+   long type = PHP_IBASE_TIMESTAMP;

-   args = (zval ***) safe_emalloc(sizeof(zval **), ZEND_NUM_ARGS(), 0);
-   if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
-   efree(args);
+   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|l, fmt, 
fmt_len, type)) {
RETURN_FALSE;
}
 
-   switch (ZEND_NUM_ARGS()) {
-   case 2:
-   convert_to_long_ex(args[1]);
-   type = Z_LVAL_PP(args[1]);
-   case 1:
-   convert_to_string_ex(args[0]);
-   fmt = Z_STRVAL_PP(args[0]);
-   }
-
switch (type) {
case PHP_IBASE_TIMESTAMP:
if (IBG(timestampformat)) {
@@ -1183,13 +1167,13 @@
}
IBG(timeformat) = DL_STRDUP(fmt);
break;
+   default:
+   RETURN_FALSE;
}
 
-   efree(args);
RETURN_TRUE;
 }
 /* }}} */
-#endif
 
 /* {{{ proto int ibase_gen_id(string generator [, int increment [, resource 
link_identifier ]])
Increments the named generator and returns its new value */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_ibase_includes.h

2004-03-08 Thread Ard Biesheuvel
abies   Mon Mar  8 05:32:31 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_ibase_includes.h 
  Log:
  Cleaned up array handling and optimize for the case where no array fields are used
  Fix timestamp binding for Win32 (which doesn't have gmtime_r())
  CS
  
  
  http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.205r2=1.206ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.205 php-src/ext/interbase/interbase.c:1.206
--- php-src/ext/interbase/interbase.c:1.205 Sun Mar  7 13:01:12 2004
+++ php-src/ext/interbase/interbase.c   Mon Mar  8 05:32:23 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.205 2004/03/07 18:01:12 abies Exp $ */
+/* $Id: interbase.c,v 1.206 2004/03/08 10:32:23 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -30,7 +30,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.205 $
+#define FILE_REVISION $Revision: 1.206 $
 
 #if HAVE_IBASE
 
@@ -488,8 +488,7 @@
 }
 /* }}} */
 
-/* {{{ php_ibase_free_query_rsrc() */
-static void php_ibase_free_query_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+static void php_ibase_free_query_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
 {
ibase_query *ib_query = (ibase_query *)rsrc-ptr;
 
@@ -785,17 +784,16 @@
 
 #if defined(__GNUC__) || defined(PHP_WIN32)
do {
+   info_func_t info_func = NULL;
 #ifdef __GNUC__
-   void (*info_func)(char*) = (void(*)(char*))dlsym(RTLD_DEFAULT, 
isc_get_client_version);
+   info_func = (info_func_t)dlsym(RTLD_DEFAULT, isc_get_client_version);
 #else
-   void (__stdcall *info_func)(char*);
-
HMODULE l = GetModuleHandle(fbclient);
 
if (!l  !(l = GetModuleHandle(gds32))) {
break;
}
-   info_func = (void (__stdcall *)(char*))GetProcAddress(l, 
isc_get_client_version);
+   info_func = (info_func_t)GetProcAddress(l, isc_get_client_version);
 #endif
if (info_func) {
info_func(s = tmp);
@@ -984,7 +982,7 @@
++IBG(num_persistent);
}
ib_link-handle = db_handle;
-   ib_link-dialect = (unsigned short)largs[DLECT];
+   ib_link-dialect = largs[DLECT] ? (unsigned short)largs[DLECT] : 
SQL_DIALECT_CURRENT;
ib_link-tr_list = NULL;
ib_link-event_head = NULL;
 
@@ -1061,9 +1059,9 @@
ibase_db_link *ib_link;
ibase_tr_list *l;
int link_id;
-   
+
RESET_ERRMSG;
-   
+
switch (ZEND_NUM_ARGS()) {
case 0:
link_id = IBG(default_link);
@@ -1099,75 +1097,82 @@
 /* }}} */
 
 static int _php_ibase_alloc_array(ibase_array **ib_arrayp, XSQLDA *sqlda, /* {{{ */
-   isc_db_handle link, isc_tr_handle trans TSRMLS_DC)
+   isc_db_handle link, isc_tr_handle trans, unsigned short *array_cnt TSRMLS_DC)
 {
-#define IB_ARRAY (*ib_arrayp)
-
-   unsigned short i;
-   XSQLVAR *var = sqlda-sqlvar;
+   unsigned short i, n;
+   ibase_array *ar;
 
-   IB_ARRAY = safe_emalloc(sizeof(ibase_array), sqlda-sqld, 0);
+   /* first check if we have any arrays at all */
+   for (i = *array_cnt = 0; i  sqlda-sqld; ++i) {
+   if ((sqlda-sqlvar[i].sqltype  ~1) == SQL_ARRAY) {
+   ++*array_cnt;
+   }
+   }
+   if (! *array_cnt) return SUCCESS;

-   for (i = 0; i  sqlda-sqld; i++, var++) {
+   ar = safe_emalloc(sizeof(ibase_array), *array_cnt, 0);
+   
+   for (i = n = 0; i  sqlda-sqld; ++i) {
unsigned short dim;
unsigned long ar_size = 1;
+   XSQLVAR *var = sqlda-sqlvar[i];

if ((var-sqltype  ~1) == SQL_ARRAY) {
-   ISC_ARRAY_DESC *ar_desc = IB_ARRAY[i].ar_desc;
+   ibase_array *a = ar[n++];
+   ISC_ARRAY_DESC *ar_desc = a-ar_desc;

if (isc_array_lookup_bounds(IB_STATUS, link, trans, 
var-relname,
var-sqlname, ar_desc)) {
_php_ibase_error(TSRMLS_C);
-   efree(IB_ARRAY);
-   IB_ARRAY = NULL;
+   efree(ar);
return FAILURE;
}
 
switch (ar_desc-array_desc_dtype) {
case blr_text:
case blr_text2:
-   IB_ARRAY[i].el_type = SQL_TEXT;
-   IB_ARRAY[i].el_size = 
ar_desc-array_desc_length;
+   a-el_type = SQL_TEXT;
+   

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-03-08 Thread Ard Biesheuvel
abies   Mon Mar  8 05:49:21 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Merged some more odd fixes from my own branch
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.206r2=1.207ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.206 php-src/ext/interbase/interbase.c:1.207
--- php-src/ext/interbase/interbase.c:1.206 Mon Mar  8 05:32:23 2004
+++ php-src/ext/interbase/interbase.c   Mon Mar  8 05:49:17 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.206 2004/03/08 10:32:23 abies Exp $ */
+/* $Id: interbase.c,v 1.207 2004/03/08 10:49:17 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -30,7 +30,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.206 $
+#define FILE_REVISION $Revision: 1.207 $
 
 #if HAVE_IBASE
 
@@ -860,7 +860,7 @@
dpb += sprintf(dpb, %c\2%c%c, isc_dpb_num_buffers, 
(char)(largs[BUF]  8), (char)(largs[BUF]  0xff));
}
-   if (isc_attach_database(IB_STATUS, len[DB], args[DB], db, 
(short)(dpb-dpb_buffer), dpb_buffer)) {
+   if (isc_attach_database(IB_STATUS, (short)len[DB], args[DB], db, 
(short)(dpb-dpb_buffer), dpb_buffer)) {
_php_ibase_error(TSRMLS_C);
return FAILURE;
}
@@ -1757,15 +1757,16 @@
 static void _php_ibase_alloc_xsqlda(XSQLDA *sqlda) /* {{{ */
 {
int i;
-   XSQLVAR *var = sqlda-sqlvar;
 
-   for (i = 0; i  sqlda-sqld; i++, var++) {
+   for (i = 0; i  sqlda-sqld; i++) {
+   XSQLVAR *var = sqlda-sqlvar[i];
+
switch (var-sqltype  ~1) {
case SQL_TEXT:
-   var-sqldata = safe_emalloc(sizeof(char), 
(var-sqllen), 0);
+   var-sqldata = safe_emalloc(sizeof(char), var-sqllen, 
0);
break;
case SQL_VARYING:
-   var-sqldata = safe_emalloc(sizeof(char), (var-sqllen 
+ sizeof(short)), 0);
+   var-sqldata = safe_emalloc(sizeof(char), var-sqllen 
+ sizeof(short), 0);
break;
case SQL_SHORT:
var-sqldata = emalloc(sizeof(short));
@@ -2316,17 +2317,20 @@
 
/* use stack to avoid leaks */
args = (zval ***) do_alloca(sizeof(zval **) * ZEND_NUM_ARGS());
+
+   RETVAL_FALSE;
+
if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
-   free_alloca(args);
-   RETURN_FALSE;
+   goto ibase_query_end;
+
}

i = 0;
while (Z_TYPE_PP(args[i++]) != IS_STRING) {
if (i = ZEND_NUM_ARGS()) {
_php_ibase_module_error(Query argument missing TSRMLS_CC);
-   free_alloca(args);
-   RETURN_FALSE;
+   goto ibase_query_end;
+
}
}
 
@@ -2347,8 +2351,7 @@
if (isc_dsql_execute_immediate(IB_STATUS, db, trans, 
0, query, 
SQL_DIALECT_CURRENT, NULL)) {
_php_ibase_error(TSRMLS_C);
-   free_alloca(args);
-   RETURN_FALSE;
+   goto ibase_query_end;
}

/* has a new database been created ? */
@@ -2359,8 +2362,7 @@
/* too many links already ? = close 
it up immediately */
if (isc_detach_database(IB_STATUS, 
db)) {
_php_ibase_error(TSRMLS_C);
-   free_alloca(args);
-   RETURN_FALSE;
+   goto ibase_query_end;
}
} else {

@@ -2375,9 +2377,7 @@

zend_list_addref(Z_LVAL_P(return_value));
IBG(default_link) = 
Z_LVAL_P(return_value);
IBG(num_links)++;
-
-   free_alloca(args);
-   return;
+   goto ibase_query_end;
}
}
RETURN_TRUE;
@@ -2409,40 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-03-07 Thread Ard Biesheuvel
abies   Sun Mar  7 09:25:09 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Added missing support for binding timestamps
  # Returning timestamps was already supported
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.203r2=1.204ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.203 php-src/ext/interbase/interbase.c:1.204
--- php-src/ext/interbase/interbase.c:1.203 Fri Feb 20 05:59:23 2004
+++ php-src/ext/interbase/interbase.c   Sun Mar  7 09:25:08 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.203 2004/02/20 10:59:23 abies Exp $ */
+/* $Id: interbase.c,v 1.204 2004/03/07 14:25:08 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -30,7 +30,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.203 $
+#define FILE_REVISION $Revision: 1.204 $
 
 #if HAVE_IBASE
 
@@ -252,7 +252,7 @@
float fval;
ISC_LONG lval;
ISC_QUAD qval;
-#ifdef ISC_TIMESTAMP
+#ifdef SQL_TIMESTAMP
ISC_TIMESTAMP tsval;
ISC_DATE dtval;
ISC_TIME tmval;
@@ -796,7 +796,7 @@
break;
}
info_func = (void (__stdcall *)(char*))GetProcAddress(l, 
isc_get_client_version);
-#endif 
+#endif
if (info_func) {
info_func(s = tmp);
} else {
@@ -1026,7 +1026,7 @@
zval **link_arg = NULL;
ibase_db_link *ib_link;
int link_id;
-   
+
RESET_ERRMSG;

switch (ZEND_NUM_ARGS()) {
@@ -1200,7 +1200,7 @@

/* calculate elements count */
for (dim = 0; dim  ar_desc-array_desc_dimensions; dim++) {
-   ar_size *= 1 + 
ar_desc-array_desc_bounds[dim].array_bound_upper 
+   ar_size *= 1 + 
ar_desc-array_desc_bounds[dim].array_bound_upper

-ar_desc-array_desc_bounds[dim].array_bound_lower;
}
IB_ARRAY[i].ar_size = IB_ARRAY[i].el_size * ar_size;
@@ -1347,8 +1347,8 @@
{
subval = pnull_val;
}
-   
-   if (_php_ibase_bind_array(*subval, buf, slice_size, array, 
dim+1 TSRMLS_CC) == FAILURE) 
+
+   if (_php_ibase_bind_array(*subval, buf, slice_size, array, 
dim+1 TSRMLS_CC) == FAILURE)
{
return FAILURE;
}
@@ -1549,16 +1549,16 @@
XSQLVAR *var = sqlda-sqlvar;
 
for (i = 0; i  sqlda-sqld; ++var, ++i) { /* bound vars */
-   
+
zval *b_var = b_vars[i];
 
var-sqlind = buf[i].sqlind;
-   
+
if (Z_TYPE_P(b_var) == IS_NULL) {
-   if ((var-sqltype  1) != 1) {
-   _php_ibase_module_error(Parameter %d must have a 
value TSRMLS_CC, i+1);
-   rv = FAILURE;
-   }
+   if ((var-sqltype  1) != 1) {
+   _php_ibase_module_error(Parameter %d must have a 
value TSRMLS_CC, i+1);
+   rv = FAILURE;
+   }
buf[i].sqlind = -1;
} else {
buf[i].sqlind = 0;
@@ -1570,8 +1570,10 @@
*/
var-sqltype = SQL_TEXT;
}
-   
+
switch (var-sqltype  ~1) {
+   struct tm t;
+
case SQL_SHORT:
convert_to_long(b_var);
if (Z_LVAL_P(b_var)  SHRT_MAX || 
Z_LVAL_P(b_var)  SHRT_MIN) {
@@ -1608,80 +1610,91 @@
convert_to_double(b_var);
var-sqldata = (void *) Z_DVAL_P(b_var);
break;
+
+   case SQL_DATE: /* == SQL_TIMESTAMP: */
+#ifdef SQL_TIMESTAMP
+   case SQL_TYPE_DATE:
+   case SQL_TYPE_TIME:
+#endif
+   if (Z_TYPE_P(b_var) == IS_LONG) {
+   /* insert timestamp directly */
+   gmtime_r(Z_LVAL_P(b_var),t);
+   } else {
+#ifndef HAVE_STRPTIME
 #ifndef SQL_TIMESTAMP
-   case SQL_DATE:
-   

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-03-07 Thread Ard Biesheuvel
abies   Sun Mar  7 13:01:14 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Simplify / fix
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.204r2=1.205ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.204 php-src/ext/interbase/interbase.c:1.205
--- php-src/ext/interbase/interbase.c:1.204 Sun Mar  7 09:25:08 2004
+++ php-src/ext/interbase/interbase.c   Sun Mar  7 13:01:12 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.204 2004/03/07 14:25:08 abies Exp $ */
+/* $Id: interbase.c,v 1.205 2004/03/07 18:01:12 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -30,7 +30,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.204 $
+#define FILE_REVISION $Revision: 1.205 $
 
 #if HAVE_IBASE
 
@@ -1571,6 +1571,8 @@
var-sqltype = SQL_TEXT;
}
 
+   var-sqldata = (void*)buf[i];
+   
switch (var-sqltype  ~1) {
struct tm t;
 
@@ -1579,9 +1581,9 @@
if (Z_LVAL_P(b_var)  SHRT_MAX || 
Z_LVAL_P(b_var)  SHRT_MIN) {
_php_ibase_module_error(Parameter %d 
exceeds field width TSRMLS_CC, i+1);
rv = FAILURE;
+   break;
}
buf[i].val.sval = (short) Z_LVAL_P(b_var);
-   var-sqldata = (void *) buf[i].val.sval;
break;
case SQL_LONG:
convert_to_long(b_var);
@@ -1590,10 +1592,10 @@
if (Z_LVAL_P(b_var)  ISC_LONG_MAX || 
Z_LVAL_P(b_var)  ISC_LONG_MIN) {
_php_ibase_module_error(Parameter %d 
exceeds field width TSRMLS_CC, i+1);
rv = FAILURE;
+   break;
}
 #endif
buf[i].val.lval = (ISC_LONG) Z_LVAL_P(b_var);
-   var-sqldata = (void *) buf[i].val.lval;
break;
 #if defined(SQL_INT64)  (SIZEOF_LONG == 8)
case SQL_INT64:
@@ -1604,7 +1606,6 @@
case SQL_FLOAT:
convert_to_double(b_var);
buf[i].val.fval = (float) Z_DVAL_P(b_var);
-   var-sqldata = (void *) buf[i].val.fval;
break;
case SQL_DOUBLE:
convert_to_double(b_var);
@@ -1660,22 +1661,16 @@
 
 #ifndef SQL_TIMESTAMP
isc_encode_date(t, buf[i].val.qval);
-   var-sqldata = (void *) (buf[i].val.qval);
 #else
switch (var-sqltype  ~1) {
default: /* == case SQL_TIMESTAMP */
isc_encode_timestamp(t, 
buf[i].val.tsval);
-   var-sqldata = (void *) 
(buf[i].val.tsval);
break;
case SQL_TYPE_DATE:
-   strptime(Z_STRVAL_P(b_var), 
IBG(dateformat), t);
isc_encode_sql_date(t, 
buf[i].val.dtval);
-   var-sqldata = (void *) 
(buf[i].val.dtval);
break;
case SQL_TYPE_TIME:
-   strptime(Z_STRVAL_P(b_var), 
IBG(timeformat), t);
isc_encode_sql_time(t, 
buf[i].val.tmval);
-   var-sqldata = (void *) 
(buf[i].val.tmval);
break;
 #endif
}
@@ -1705,7 +1700,6 @@
}
buf[i].val.qval = ib_blob.bl_qd;
}
-   var-sqldata = (void *) buf[i].val.qval;
break;
  

[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_ibase_includes.h

2004-02-20 Thread Ard Biesheuvel
abies   Fri Feb 20 05:59:24 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_ibase_includes.h 
  Log:
  Fix some issues with persistent links
  
  http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.202r2=1.203ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.202 php-src/ext/interbase/interbase.c:1.203
--- php-src/ext/interbase/interbase.c:1.202 Tue Feb 17 07:53:53 2004
+++ php-src/ext/interbase/interbase.c   Fri Feb 20 05:59:23 2004
@@ -14,11 +14,11 @@
+--+
| Authors: Jouni Ahto [EMAIL PROTECTED]|
|  Andrew Avdeev [EMAIL PROTECTED]  |
-   |  Ard Biesheuvel [EMAIL PROTECTED]  |
+   |  Ard Biesheuvel [EMAIL PROTECTED]  |
+--+
  */
 
-/* $Id: interbase.c,v 1.202 2004/02/17 12:53:53 abies Exp $ */
+/* $Id: interbase.c,v 1.203 2004/02/20 10:59:23 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -30,12 +30,13 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.202 $
+#define FILE_REVISION $Revision: 1.203 $
 
 #if HAVE_IBASE
 
 #include php_ini.h
 #include ext/standard/php_standard.h
+#include ext/standard/md5.h
 #include php_interbase.h
 #include php_ibase_includes.h
 
@@ -49,10 +50,8 @@
 #define IBDEBUG(a)
 #endif
 
-#define SAFE_STRING(s) ((s)?(s):)
-
-#define ISC_LONG_MIN (-ISC_LONG_MAX - 1)
-#define ISC_LONG_MAX 2147483647
+#define ISC_LONG_MIN   (1  (8*sizeof(ISC_LONG)-1))
+#define ISC_LONG_MAX   ~ISC_LONG_MIN
 
 #define QUERY_RESULT   1
 #define EXECUTE_RESULT 2
@@ -64,8 +63,6 @@
 #define FETCH_ROW  1
 #define FETCH_ARRAY2
 
-#define HASH_MASK  ibase_%s_%s_%s_%s_%s_%s_%s
-
 /* {{{ extension definition structures */
 function_entry ibase_functions[] = {
PHP_FE(ibase_connect, NULL)
@@ -581,8 +578,10 @@
STD_PHP_INI_BOOLEAN(ibase.allow_persistent, 1, PHP_INI_SYSTEM, 
OnUpdateLong, allow_persistent, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY_EX(ibase.max_persistent, -1, PHP_INI_SYSTEM, 
OnUpdateLong, max_persistent, zend_ibase_globals, ibase_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX(ibase.max_links, -1, PHP_INI_SYSTEM, OnUpdateLong, 
max_links, zend_ibase_globals, ibase_globals, display_link_numbers)
+   STD_PHP_INI_ENTRY(ibase.default_db, NULL, PHP_INI_SYSTEM, OnUpdateString, 
default_db, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY(ibase.default_user, NULL, PHP_INI_ALL, OnUpdateString, 
default_user, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY(ibase.default_password, NULL, PHP_INI_ALL, OnUpdateString, 
default_password, zend_ibase_globals, ibase_globals)
+   STD_PHP_INI_ENTRY(ibase.default_charset, NULL, PHP_INI_ALL, OnUpdateString, 
default_charset, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY(ibase.timestampformat, %m/%d/%Y %H:%M:%S, PHP_INI_ALL, 
OnUpdateString, cfg_timestampformat, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY(ibase.dateformat, %m/%d/%Y, PHP_INI_ALL, OnUpdateString, 
cfg_dateformat, zend_ibase_globals, ibase_globals)
STD_PHP_INI_ENTRY(ibase.timeformat, %H:%M:%S, PHP_INI_ALL, OnUpdateString, 
cfg_timeformat, zend_ibase_globals, ibase_globals)
@@ -839,60 +838,31 @@
 }
 /* }}} */
 
-int _php_ibase_attach_db(char *server, char *uname, char *passwd, char *charset, /* 
{{{ */
-   int buffers, char *role, isc_db_handle *db TSRMLS_DC)
+enum connect_args { DB = 0, USER = 1, PASS = 2, CSET = 3, ROLE = 4, BUF = 0, DLECT = 
1 };
+   
+static char const dpb_args[] = { 0, isc_dpb_user_name, isc_dpb_password, 
isc_dpb_lc_ctype
+#ifdef isc_dpb_sql_role_name
+   , isc_dpb_sql_role_name
+#endif
+};
+   
+int _php_ibase_attach_db(char **args, int *len, long *largs, isc_db_handle *db 
TSRMLS_DC)
 {
-   char dpb_buffer[256], *dpb, *p;
-   int dpb_length, len;
-
-   dpb = dpb_buffer;
-
-   *dpb++ = isc_dpb_version1;
-
-   if (uname != NULL  (len = strlen(uname))) {
-   *dpb++ = isc_dpb_user_name;
-   *dpb++ = len;
-   for (p = uname; *p;) {
-   *dpb++ = *p++;
-   }
-   }
+   short i;
+   char dpb_buffer[256] = { isc_dpb_version1 }, *dpb;
 
-   if (passwd != NULL  (len = strlen(passwd))) {
-   *dpb++ = isc_dpb_password;
-   *dpb++ = strlen(passwd);
-   for (p = passwd; *p;) {
-   *dpb++ = *p++;
-   }
-   }
+   dpb = dpb_buffer + 1;
 
-   if (charset != NULL  (len = strlen(charset))) {
-   *dpb++ = isc_dpb_lc_ctype;
-   *dpb++ = strlen(charset);
-   for (p = charset; *p;) {
-   *dpb++ = *p++;
+   for (i = 0; i  

[PHP-CVS] cvs: php-src /ext/interbase interbase.c /ext/interbase/tests 003.phpt

2004-02-15 Thread Ard Biesheuvel
abies   Sun Feb 15 13:34:48 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
/php-src/ext/interbase/tests003.phpt 
  Log:
  Reintroduce param NULL testing (see bug #26777)
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.200r2=1.201ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.200 php-src/ext/interbase/interbase.c:1.201
--- php-src/ext/interbase/interbase.c:1.200 Wed Feb 11 07:08:44 2004
+++ php-src/ext/interbase/interbase.c   Sun Feb 15 13:34:46 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.200 2004/02/11 12:08:44 abies Exp $ */
+/* $Id: interbase.c,v 1.201 2004/02/15 18:34:46 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -30,7 +30,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.200 $
+#define FILE_REVISION $Revision: 1.201 $
 
 #if HAVE_IBASE
 
@@ -754,7 +754,7 @@
 #ifdef __GNUC__
void (*info_func)(char*) = dlsym(RTLD_DEFAULT, 
isc_get_client_version);
 #else
-   void (__stdcall *info_func)(char*) = NULL;
+   void (__stdcall *info_func)(char*);
 
HMODULE l = GetModuleHandle(fbclient);
 
@@ -1615,8 +1615,8 @@
 }  
 /* }}} */
 
-static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf,
-   ibase_query *ib_query TSRMLS_DC) /* {{{ */
+static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf, /* {{{ */
+   ibase_query *ib_query TSRMLS_DC)
 {
int i, rv = SUCCESS;
XSQLVAR *var = sqlda-sqlvar;
@@ -1628,6 +1628,10 @@
var-sqlind = buf[i].sqlind;

if (Z_TYPE_P(b_var) == IS_NULL) {
+   if ((var-sqltype  1) != 1) {
+   _php_ibase_module_error(Parameter %d must have a 
value TSRMLS_CC, i+1);
+   rv = FAILURE;
+   }
buf[i].sqlind = -1;
} else {
buf[i].sqlind = 0;
http://cvs.php.net/diff.php/php-src/ext/interbase/tests/003.phpt?r1=1.5r2=1.6ty=u
Index: php-src/ext/interbase/tests/003.phpt
diff -u php-src/ext/interbase/tests/003.phpt:1.5 
php-src/ext/interbase/tests/003.phpt:1.6
--- php-src/ext/interbase/tests/003.phpt:1.5Fri Sep  5 13:02:02 2003
+++ php-src/ext/interbase/tests/003.phptSun Feb 15 13:34:47 2004
@@ -5,14 +5,14 @@
 --POST--
 --GET--
 --FILE--
-?php /* $Id: 003.phpt,v 1.5 2003/09/05 17:02:02 abies Exp $ */
+?php /* $Id: 003.phpt,v 1.6 2004/02/15 18:34:47 abies Exp $ */
 
 require(interbase.inc);
 ibase_connect($test_base);
 
 ibase_query(
create table test3 (
-iter   integer,
+iter   integer not null,
 v_char char(1000),
 v_date  timestamp,
v_decimal4_2decimal(4,2),
@@ -29,6 +29,9 @@
 ));
 ibase_commit();
 
+   /* should fail, but gracefully */
+   @ibase_query(insert into test3 (iter) values (?), null);
+   
 /* if timefmt is not supported, suppress error here */
 @ibase_timefmt(%m/%d/%Y %H:%M:%S);
 
@@ -41,7 +44,7 @@
$v_decimal7_2 = rand_number(7,2); 
$v_decimal7_0 = rand_number(7,0);
$v_numeric15_15 = rand_number(15,15);
-   $v_numeric15_0 = rand_number(15,0);
+   $v_numeric15_0 = $iter ? rand_number(15,0) : 0;
$v_double  = rand_number(18);
$v_float   = rand_number(7);
$v_integer = rand_number(9,0);
@@ -88,7 +91,7 @@
 echo  in:  $v_numeric15_15\n;
 echo  out: $row-V_NUMERIC15_15\n;
 }
-if($row-V_NUMERIC15_0 != $v_numeric15_0){
+if($row-V_NUMERIC15_0 != (string)$v_numeric15_0){
 echo  NUMERIC15_0 fail\n;
 echo  in:  $v_numeric15_0\n;
 echo  out: $row-V_NUMERIC15_0\n;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-02-11 Thread Ard Biesheuvel
abies   Wed Feb 11 07:08:45 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Add version info about run-time client library
  # A number of user crashes appear to be caused
  # by using incorrect combinations of libraries
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.199r2=1.200ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.199 php-src/ext/interbase/interbase.c:1.200
--- php-src/ext/interbase/interbase.c:1.199 Fri Feb  6 10:11:17 2004
+++ php-src/ext/interbase/interbase.c   Wed Feb 11 07:08:44 2004
@@ -18,15 +18,19 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.199 2004/02/06 15:11:17 abies Exp $ */
+/* $Id: interbase.c,v 1.200 2004/02/11 12:08:44 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
 #endif
 
+#ifdef __GNUC__
+#define _GNU_SOURCE
+#endif
+
 #include php.h
 
-#define FILE_REVISION $Revision: 1.199 $
+#define FILE_REVISION $Revision: 1.200 $
 
 #if HAVE_IBASE
 
@@ -727,21 +731,50 @@
  
 PHP_MINFO_FUNCTION(ibase)
 {
-   char tmp[64];
+   char tmp[64], *s;
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
 
-#if (SQLDA_CURRENT_VERSION  1) || defined(FB_SQLDA)
-   isc_get_client_version(tmp);
-   php_info_print_table_row(2, Client Library, tmp);
+#ifdef FB_API_VER
+   sprintf( (s = tmp), Firebird API version %d, FB_API_VER);
+#elif (SQLDA_CURRENT_VERSION  1)
+   s =  Interbase 7.0 and up;
 #elif (SQL_DIALECT_CURRENT == 1)
-   php_info_print_table_row(2, Client Library, Interbase 5.6 or earlier);
+   s =  Interbase 5.6 or earlier;
 #elif !defined(DSC_null)
-   php_info_print_table_row(2, Client Library, Interbase 6);
+   s = Interbase 6;
+#else
+   s = Firebird 1.0;
+#endif
+   php_info_print_table_row(2, Compile-time Client Library Version, s);
+
+#if defined(__GNUC__) || defined(PHP_WIN32)
+   do {
+#ifdef __GNUC__
+   void (*info_func)(char*) = dlsym(RTLD_DEFAULT, 
isc_get_client_version);
+#else
+   void (__stdcall *info_func)(char*) = NULL;
+
+   HMODULE l = GetModuleHandle(fbclient);
+
+   if (!l  !(l = GetModuleHandle(gds32))) {
+   break;
+   }
+   info_func = (void (__stdcall *)(char*))GetProcAddress(l, 
isc_get_client_version);
+#endif 
+   if (info_func) {
+   info_func(s = tmp);
+   } else {
+#if HAVE_IBASE6_API
+   s = Firebird 1.0/Interbase 6;
 #else
-   php_info_print_table_row(2, Client Library, Firebird 1.0);
+   s = Firebird 1.0/Interbase 6 or earlier;
 #endif
+   }
+   php_info_print_table_row(2, Run-time Client Library Version, s);
+   } while (0);
+#endif 
 
php_info_print_table_row(2, Revision, FILE_REVISION);
 #ifdef COMPILE_DL_INTERBASE

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-01-21 Thread Ard Biesheuvel
abies   Wed Jan 21 05:22:05 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  MFB
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.193r2=1.194ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.193 php-src/ext/interbase/interbase.c:1.194
--- php-src/ext/interbase/interbase.c:1.193 Mon Jan 12 15:03:49 2004
+++ php-src/ext/interbase/interbase.c   Wed Jan 21 05:22:04 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.193 2004/01/12 20:03:49 abies Exp $ */
+/* $Id: interbase.c,v 1.194 2004/01/21 10:22:04 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.193 $
+#define FILE_REVISION $Revision: 1.194 $
 
 #if HAVE_IBASE
 
@@ -696,6 +696,25 @@
 
 PHP_MSHUTDOWN_FUNCTION(ibase)
 {
+#ifndef PHP_WIN32
+   /**
+* When the Interbase client API library libgds.so is first loaded, it 
registers a call to 
+* gds__cleanup() with atexit(), in order to clean up after itself when the 
process exits.
+* This means that the library is called at process shutdown, and cannot be 
unloaded beforehand.
+* PHP tries to unload modules after every request [dl()'ed modules], and 
right before the 
+* process shuts down [modules loaded from php.ini]. This results in a 
segfault for this module.
+* By NULLing the dlopen() handle in the module entry, Zend omits the call to 
dlclose(),
+* ensuring that the module will remain present until the process exits. 
However, the functions
+* and classes exported by the module will not be available until the module 
is 'reloaded'. 
+* When reloaded, dlopen() will return the handle of the already loaded 
module. The module will
+* be unloaded automatically when the process exits.
+*/
+   zend_module_entry *ibase_entry;
+   if (SUCCESS == zend_hash_find(module_registry, ibase_module_entry.name, 
strlen(ibase_module_entry.name) +1, (void*) ibase_entry))
+   {
+   ibase_entry-handle = NULL;
+   }
+#endif
UNREGISTER_INI_ENTRIES();
return SUCCESS;
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-01-12 Thread Ard Biesheuvel
abies   Mon Jan 12 14:47:29 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Added sanity check on ibase_[p]connect() dialect argument (fixes obscure 
unregistered bug)
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.191 php-src/ext/interbase/interbase.c:1.192
--- php-src/ext/interbase/interbase.c:1.191 Thu Jan  8 03:15:50 2004
+++ php-src/ext/interbase/interbase.c   Mon Jan 12 14:47:28 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.191 2004/01/08 08:15:50 andi Exp $ */
+/* $Id: interbase.c,v 1.192 2004/01/12 19:47:28 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.191 $
+#define FILE_REVISION $Revision: 1.192 $
 
 #if HAVE_IBASE
 
@@ -940,7 +940,10 @@
 
ib_link = (ibase_db_link *) malloc(sizeof(ibase_db_link));
ib_link-handle = db_handle;
-   ib_link-dialect = (ib_dialect ? (unsigned short) 
strtoul(ib_dialect, NULL, 10) : SQL_DIALECT_CURRENT);
+   if (ib_dialect) {
+   unsigned short d = (unsigned short)strtoul(ib_dialect, 
NULL, 10);
+   ib_link-dialect = (d ? d : SQL_DIALECT_CURRENT);
+   }
ib_link-tr_list = NULL;
 
/* hash it up */
@@ -1002,7 +1005,10 @@
 
ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
ib_link-handle = db_handle;
-   ib_link-dialect = (ib_dialect ? (unsigned short) strtoul(ib_dialect, 
NULL, 10) : SQL_DIALECT_CURRENT);
+   if (ib_dialect) {
+   unsigned short d = (unsigned short)strtoul(ib_dialect, NULL, 
10);
+   ib_link-dialect = (d ? d : SQL_DIALECT_CURRENT);
+   }
ib_link-tr_list = NULL;

ZEND_REGISTER_RESOURCE(return_value, ib_link, le_link);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-01-12 Thread Ard Biesheuvel
abies   Mon Jan 12 15:03:50 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  More handsome solution for previous fix
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.192 php-src/ext/interbase/interbase.c:1.193
--- php-src/ext/interbase/interbase.c:1.192 Mon Jan 12 14:47:28 2004
+++ php-src/ext/interbase/interbase.c   Mon Jan 12 15:03:49 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.192 2004/01/12 19:47:28 abies Exp $ */
+/* $Id: interbase.c,v 1.193 2004/01/12 20:03:49 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.192 $
+#define FILE_REVISION $Revision: 1.193 $
 
 #if HAVE_IBASE
 
@@ -831,6 +831,7 @@
 {
zval ***args;
char *ib_server = NULL, *ib_uname, *ib_passwd, *ib_charset = NULL, *ib_buffers 
= NULL, *ib_dialect = NULL, *ib_role = NULL;
+   unsigned short sql_dialect = SQL_DIALECT_CURRENT;
int ib_uname_len, ib_passwd_len;
isc_db_handle db_handle = NULL;
char *hashed_details;
@@ -855,6 +856,8 @@
}
 
switch (ZEND_NUM_ARGS()) {
+   unsigned short d;
+   
case 7:
convert_to_string_ex(args[6]);
ib_role = Z_STRVAL_PP(args[6]);
@@ -863,6 +866,10 @@
case 6:
convert_to_string_ex(args[5]);
ib_dialect = Z_STRVAL_PP(args[5]);
+   if ((d = (unsigned short)strtoul(ib_dialect, NULL, 10))) 
+   {
+   sql_dialect = d;
+   }
hashed_details_length += Z_STRLEN_PP(args[5]);
/* fallout */
case 5:
@@ -940,10 +947,7 @@
 
ib_link = (ibase_db_link *) malloc(sizeof(ibase_db_link));
ib_link-handle = db_handle;
-   if (ib_dialect) {
-   unsigned short d = (unsigned short)strtoul(ib_dialect, 
NULL, 10);
-   ib_link-dialect = (d ? d : SQL_DIALECT_CURRENT);
-   }
+   ib_link-dialect = sql_dialect;
ib_link-tr_list = NULL;
 
/* hash it up */
@@ -1005,10 +1009,7 @@
 
ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
ib_link-handle = db_handle;
-   if (ib_dialect) {
-   unsigned short d = (unsigned short)strtoul(ib_dialect, NULL, 
10);
-   ib_link-dialect = (d ? d : SQL_DIALECT_CURRENT);
-   }
+   ib_link-dialect = sql_dialect;
ib_link-tr_list = NULL;

ZEND_REGISTER_RESOURCE(return_value, ib_link, le_link);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2004-01-07 Thread Ard Biesheuvel
abies   Wed Jan  7 04:43:56 2004 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Let DB handle NULL params, fixes bug #26777
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.189 php-src/ext/interbase/interbase.c:1.190
--- php-src/ext/interbase/interbase.c:1.189 Fri Sep 26 06:06:22 2003
+++ php-src/ext/interbase/interbase.c   Wed Jan  7 04:43:55 2004
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.189 2003/09/26 10:06:22 abies Exp $ */
+/* $Id: interbase.c,v 1.190 2004/01/07 09:43:55 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.189 $
+#define FILE_REVISION $Revision: 1.190 $
 
 #if HAVE_IBASE
 
@@ -1578,12 +1578,6 @@
var-sqlind = buf[i].sqlind;

if (Z_TYPE_P(b_var) == IS_NULL) {
-
-   if ((var-sqltype  1) != 1) {
-   _php_ibase_module_error(Parameter %d must have a 
value TSRMLS_CC, i+1);
-   rv = FAILURE;
-   }
-
buf[i].sqlind = -1;
} else {
buf[i].sqlind = 0;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-09-26 Thread Ard Biesheuvel
abies   Fri Sep 26 06:06:23 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Let client library pick its own transaction param defaults
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.188 php-src/ext/interbase/interbase.c:1.189
--- php-src/ext/interbase/interbase.c:1.188 Tue Sep 23 19:08:59 2003
+++ php-src/ext/interbase/interbase.c   Fri Sep 26 06:06:22 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.188 2003/09/23 23:08:59 abies Exp $ */
+/* $Id: interbase.c,v 1.189 2003/09/26 10:06:22 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.188 $
+#define FILE_REVISION $Revision: 1.189 $
 
 #if HAVE_IBASE
 
@@ -2068,7 +2068,7 @@
convert_to_long_ex(args[i]);
trans_argl = Z_LVAL_PP(args[i]);
 
-   if (trans_argl) {
+   if (trans_argl != PHP_IBASE_DEFAULT) {
last_tpb[tpb_len++] = isc_tpb_version3;
 
/* access mode */
Index: php-src/ext/interbase/php_interbase.h
diff -u php-src/ext/interbase/php_interbase.h:1.62 
php-src/ext/interbase/php_interbase.h:1.63
--- php-src/ext/interbase/php_interbase.h:1.62  Tue Sep 23 16:58:14 2003
+++ php-src/ext/interbase/php_interbase.h   Fri Sep 26 06:06:22 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: php_interbase.h,v 1.62 2003/09/23 20:58:14 abies Exp $ */
+/* $Id: php_interbase.h,v 1.63 2003/09/26 10:06:22 abies Exp $ */
 
 #ifndef PHP_INTERBASE_H
 #define PHP_INTERBASE_H
@@ -186,17 +186,17 @@
PHP_IBASE_DATE  = 2,
PHP_IBASE_TIME  = 4,
/* transaction access mode */   
-   PHP_IBASE_WRITE = 0, /* default */
-   PHP_IBASE_READ  = 1,
+   PHP_IBASE_WRITE = 1,
+   PHP_IBASE_READ  = 2,
/* transaction isolation level */
-   PHP_IBASE_CONCURRENCY   = 0, /* default */
-   PHP_IBASE_COMMITTED = 2,
- PHP_IBASE_REC_NO_VERSION  = 0, /* default */
- PHP_IBASE_REC_VERSION = 4,
-   PHP_IBASE_CONSISTENCY   = 8,
+   PHP_IBASE_CONCURRENCY   = 4,
+   PHP_IBASE_COMMITTED = 8,
+ PHP_IBASE_REC_NO_VERSION  = 32,
+ PHP_IBASE_REC_VERSION = 64,
+   PHP_IBASE_CONSISTENCY   = 16,
/* transaction lock resolution */
-   PHP_IBASE_WAIT  = 0, /* default */
-   PHP_IBASE_NOWAIT= 16
+   PHP_IBASE_WAIT  = 128,
+   PHP_IBASE_NOWAIT= 256
 };
 
 #ifdef ZTS

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-23 Thread Jani Taskinen
sniper  Tue Sep 23 18:17:41 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  ws fix
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.186 php-src/ext/interbase/interbase.c:1.187
--- php-src/ext/interbase/interbase.c:1.186 Tue Sep 23 16:58:13 2003
+++ php-src/ext/interbase/interbase.c   Tue Sep 23 18:17:40 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.186 2003/09/23 20:58:13 abies Exp $ */
+/* $Id: interbase.c,v 1.187 2003/09/23 22:17:40 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.186 $
+#define FILE_REVISION $Revision: 1.187 $
 
 #if HAVE_IBASE
 
@@ -116,7 +116,7 @@
 #if HAVE_STRFTIME
PHP_FE(ibase_timefmt, NULL)
 #endif
-PHP_FE(ibase_gen_id, NULL)
+   PHP_FE(ibase_gen_id, NULL)
PHP_FE(ibase_num_fields, NULL)
PHP_FE(ibase_num_params, NULL)
 #if abies_0
@@ -267,9 +267,9 @@
 /* {{{ internal macros, functions and structures */
 
 typedef struct {
-isc_db_handle *db_ptr;
-long tpb_len;
-char *tpb_ptr;
+   isc_db_handle *db_ptr;
+   long tpb_len;
+   char *tpb_ptr;
 } ISC_TEB;
 
 typedef struct {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-23 Thread Ard Biesheuvel
abies   Tue Sep 23 19:09:08 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Always return long from ibase_gen_id() on IB  6 
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.187 php-src/ext/interbase/interbase.c:1.188
--- php-src/ext/interbase/interbase.c:1.187 Tue Sep 23 18:17:40 2003
+++ php-src/ext/interbase/interbase.c   Tue Sep 23 19:08:59 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.187 2003/09/23 22:17:40 sniper Exp $ */
+/* $Id: interbase.c,v 1.188 2003/09/23 23:08:59 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.187 $
+#define FILE_REVISION $Revision: 1.188 $
 
 #if HAVE_IBASE
 
@@ -3306,7 +3306,7 @@
precision = 9;
break;
 #ifdef SQL_INT64
-   case SQL_INT64: 
+   case SQL_INT64:
precision = 18;
break;
 #endif
@@ -3317,8 +3317,8 @@
} else {
switch (var-sqltype  ~1) {
case SQL_TEXT:
-   s = CHAR; 
-   break;
+   s = CHAR; 
+   break;
case SQL_VARYING:
s = VARCHAR; 
break;
@@ -3328,13 +3328,13 @@
case SQL_LONG:
s = INTEGER; 
break;
-   case SQL_FLOAT: 
+   case SQL_FLOAT:
s = FLOAT; break;
-   case SQL_DOUBLE:
-   case SQL_D_FLOAT:   
+   case SQL_DOUBLE:
+   case SQL_D_FLOAT:
s = DOUBLE PRECISION; break;
 #ifdef SQL_INT64
-   case SQL_INT64: 
+   case SQL_INT64: 
s = BIGINT; 
break;
 #endif
@@ -4412,14 +4412,14 @@
zval **arg1, **arg2, **arg3, **query_arg;
ibase_db_link *ib_link;
ibase_trans *trans = NULL;
-   long increment;
-#ifdef SQL_INT64
-   ISC_INT64 result;
-#else
-   ISC_LONG result;
-#endif
-
-   XSQLDA out_sqlda;
+   long increment;
+#ifdef SQL_INT64
+   ISC_INT64 result;
+#else
+   ISC_LONG result;
+#endif
+
+   XSQLDA out_sqlda;
 
RESET_ERRMSG;
 
@@ -4429,8 +4429,8 @@
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, 
IBG(default_link), InterBase link, le_link, le_plink);
-   query_arg = arg1;
-   increment = 1;
+   query_arg = arg1;
+   increment = 1;
break;
case 2:
if (zend_get_parameters_ex(2, arg1, arg2) == FAILURE) {
@@ -4438,14 +4438,14 @@
}
 
if (Z_TYPE_PP(arg1) == IS_STRING) /* first param is generator, 
second is inc */
-   {
+   {
query_arg = arg1;
convert_to_long_ex(arg2);
increment = Z_LVAL_PP(arg2);
 
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, 
IBG(default_link), InterBase link, le_link, le_plink);
} else {
-   
_php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, arg1, ib_link, trans);
+   
_php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, arg1, ib_link, trans);
query_arg = arg2;
increment = 1;
}
@@ -4455,7 +4455,7 @@
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link*, arg1, -1, 
InterBase link, le_link, le_plink);
-   
+   
query_arg = arg2;
convert_to_long_ex(arg3);
increment = Z_LVAL_PP(arg3);
@@ -4467,45 +4467,45 @@
}

convert_to_string_ex(query_arg);
-   sprintf(query, SELECT GEN_ID(%s,%ld) FROM rdb$database, 
Z_STRVAL_PP(query_arg), increment);
+   sprintf(query, SELECT GEN_ID(%s,%ld) FROM rdb$database, 
Z_STRVAL_PP(query_arg), increment);
 
/* open default transaction */
if (_php_ibase_def_trans(ib_link, trans TSRMLS_CC) == FAILURE) {
RETURN_FALSE;
 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-22 Thread Hartmut Holzgraefe
hholzgraMon Sep 22 02:54:30 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  proto thiko fix
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.184 php-src/ext/interbase/interbase.c:1.185
--- php-src/ext/interbase/interbase.c:1.184 Tue Sep 16 21:25:08 2003
+++ php-src/ext/interbase/interbase.c   Mon Sep 22 02:54:29 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.184 2003/09/17 01:25:08 abies Exp $ */
+/* $Id: interbase.c,v 1.185 2003/09/22 06:54:29 hholzgra Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.184 $
+#define FILE_REVISION $Revision: 1.185 $
 
 #if HAVE_IBASE
 
@@ -2508,7 +2508,7 @@
 }
 /* }}} */
 
-/* {{{ proto ibase_num_rows( resource result_identifier ) 
+/* {{{ proto int ibase_num_rows( resource result_identifier ) 
  */
 #if abies_0
 PHP_FUNCTION(ibase_num_rows) 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-16 Thread Hartmut Holzgraefe
hholzgraTue Sep 16 15:44:56 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  proto fix
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.181 php-src/ext/interbase/interbase.c:1.182
--- php-src/ext/interbase/interbase.c:1.181 Fri Sep 12 17:02:43 2003
+++ php-src/ext/interbase/interbase.c   Tue Sep 16 15:44:56 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.181 2003/09/12 21:02:43 abies Exp $ */
+/* $Id: interbase.c,v 1.182 2003/09/16 19:44:56 hholzgra Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.181 $
+#define FILE_REVISION $Revision: 1.182 $
 
 #if HAVE_IBASE  !defined(VERSION_INFO_ONLY)
 
@@ -2505,7 +2505,8 @@
 }
 /* }}} */
 
-/* {{{ ibase_num_rows( resource result_identifier ) */
+/* {{{ proto ibase_num_rows( resource result_identifier ) 
+ */
 #if abies_0
 PHP_FUNCTION(ibase_num_rows) 
 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-16 Thread Ard Biesheuvel
abies   Tue Sep 16 16:28:29 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Use isc_get_version() for client lib info if available
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.182 php-src/ext/interbase/interbase.c:1.183
--- php-src/ext/interbase/interbase.c:1.182 Tue Sep 16 15:44:56 2003
+++ php-src/ext/interbase/interbase.c   Tue Sep 16 16:28:27 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.182 2003/09/16 19:44:56 hholzgra Exp $ */
+/* $Id: interbase.c,v 1.183 2003/09/16 20:28:27 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.182 $
+#define FILE_REVISION $Revision: 1.183 $
 
 #if HAVE_IBASE  !defined(VERSION_INFO_ONLY)
 
@@ -69,6 +69,9 @@
 #ifdef PHP_WIN32
 #define LL_MASK I64
 #define LL_LIT(lit) lit ## I64
+#ifdef FB_SQLDA
+#pragma comment(lib, fbclient_ms.lib)
+#endif
 #else
 #define LL_MASK ll
 #define LL_LIT(lit) lit ## ll
@@ -717,22 +720,20 @@
  
 PHP_MINFO_FUNCTION(ibase)
 {
-   char tmp[32];
+   char tmp[64];
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
 
-   php_info_print_table_row(2, Client Library,
-#if (SQLDA_CURRENT_VERSION == 1  SQL_DIALECT_CURRENT == 1)
-   Interbase 5.6 or earlier);
-#elif (SQLDA_CURRENT_VERSION == 2  SQL_DIALECT_CURRENT == 3)
-   Interbase 7 or later);
+#if (SQLDA_CURRENT_VERSION  1) || defined(FB_SQLDA)
+   isc_get_client_version(tmp);
+   php_info_print_table_row(2, Client Library, tmp);
+#elif (SQL_DIALECT_CURRENT == 1)
+   php_info_print_table_row(2, Client Library, Interbase 5.6 or earlier);
 #elif !defined(DSC_null)
-   Interbase 6);
-#elif !defined(FB_SQLDA)
-   Firebird 1.0);
+   php_info_print_table_row(2, Client Library, Interbase 6);
 #else
-   Firebird 1.5 or later);
+   php_info_print_table_row(2, Client Library, Firebird 1.0);
 #endif
 
php_info_print_table_row(2, Revision, FILE_REVISION);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c interbase.dsp interbase.rc

2003-09-16 Thread Ard Biesheuvel
abies   Tue Sep 16 21:25:09 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c interbase.dsp interbase.rc 
  Log:
  Link to fbclient.dll if available
  Add client lib name to dll version info
  Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.183 php-src/ext/interbase/interbase.c:1.184
--- php-src/ext/interbase/interbase.c:1.183 Tue Sep 16 16:28:27 2003
+++ php-src/ext/interbase/interbase.c   Tue Sep 16 21:25:08 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.183 2003/09/16 20:28:27 abies Exp $ */
+/* $Id: interbase.c,v 1.184 2003/09/17 01:25:08 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,9 +26,9 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.183 $
+#define FILE_REVISION $Revision: 1.184 $
 
-#if HAVE_IBASE  !defined(VERSION_INFO_ONLY)
+#if HAVE_IBASE
 
 #include php_ini.h
 #include ext/standard/php_standard.h
@@ -71,6 +71,8 @@
 #define LL_LIT(lit) lit ## I64
 #ifdef FB_SQLDA
 #pragma comment(lib, fbclient_ms.lib)
+#else
+#pragma comment(lib, gds32_ms.lib)
 #endif
 #else
 #define LL_MASK ll
Index: php-src/ext/interbase/interbase.dsp
diff -u php-src/ext/interbase/interbase.dsp:1.9 
php-src/ext/interbase/interbase.dsp:1.10
--- php-src/ext/interbase/interbase.dsp:1.9 Sun Sep  7 20:41:03 2003
+++ php-src/ext/interbase/interbase.dsp Tue Sep 16 21:25:08 2003
@@ -54,7 +54,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 
ib_util_ms.lib gds32_ms.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 
/pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib 
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib gds32_ms.lib 
php4ts_debug.lib /nologo /dll /debug /machine:I386 
/out:..\..\Debug_TS/php_interbase.dll /pdbtype:sept 
/libpath:..\..\..\php_build\Interbase SDK\lib_ms /libpath:..\..\Debug_TS
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib 
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib 
/nologo /dll /debug /machine:I386 /out:..\..\Debug_TS/php_interbase.dll 
/pdbtype:sept /libpath:..\..\..\php_build\Interbase SDK\lib_ms 
/libpath:..\..\Debug_TS
 
 !ELSEIF  $(CFG) == interbase - Win32 Release_TS
 
@@ -81,7 +81,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib 
odbccp32.lib ib_util_ms.lib gds32_ms.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 
gds32_ms.lib /nologo /dll /machine:I386 /out:..\..\Release_TS/php_interbase.dll 
/libpath:..\..\..\php_build\Interbase SDK\lib_ms /libpath:..\..\Release_TS 
/libpath:..\..\Release_TS_Inline
+# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 
/nologo /dll /machine:I386 /out:..\..\Release_TS/php_interbase.dll 
/libpath:..\..\..\php_build\Interbase SDK\lib_ms /libpath:..\..\Release_TS 
/libpath:..\..\Release_TS_Inline
 
 !ENDIF 
 
@@ -111,9 +111,7 @@
 # Begin Source File
 
 SOURCE=.\interbase.rc
-
-# ADD RSC /i ..\..\main /i ..\..\win32
-
+# ADD RSC /i ..\..\main /i ..\..\win32 /d PHP_H
 # End Source File
 # End Group
 # End Target
Index: php-src/ext/interbase/interbase.rc
diff -u php-src/ext/interbase/interbase.rc:1.3 php-src/ext/interbase/interbase.rc:1.4
--- php-src/ext/interbase/interbase.rc:1.3  Sun Sep  7 20:32:22 2003
+++ php-src/ext/interbase/interbase.rc  Tue Sep 16 21:25:08 2003
@@ -1,76 +1,82 @@
-/*
-   +--+
-   | PHP Version 4|
-   +--+
-   | Copyright (c) 1997-2003 The PHP Group|
-   +--+
-   | This source file is subject to version 3.0 of the PHP license,   |
-   | that is bundled with this package in the file LICENSE, and is|
-   | available through the world-wide-web at the following url:   |
-   | http://www.php.net/license/3_0.txt.  |
-   | If you did not receive a copy of the PHP license and are unable to   |
-   | obtain it through the world-wide-web, please send a note to  |
-   | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
-   

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-12 Thread Ard Biesheuvel
abies   Fri Sep 12 17:02:44 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Pointer size fix
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.180 php-src/ext/interbase/interbase.c:1.181
--- php-src/ext/interbase/interbase.c:1.180 Thu Sep 11 19:11:18 2003
+++ php-src/ext/interbase/interbase.c   Fri Sep 12 17:02:43 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.180 2003/09/11 23:11:18 abies Exp $ */
+/* $Id: interbase.c,v 1.181 2003/09/12 21:02:43 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.180 $
+#define FILE_REVISION $Revision: 1.181 $
 
 #if HAVE_IBASE  !defined(VERSION_INFO_ONLY)
 
@@ -963,12 +963,14 @@
 * and add a pointer to it with hashed_details as the key.
 */
if ( (zend_hash_find(EG(regular_list), hashed_details, 
hashed_details_length + 1, (void *) index_ptr) == SUCCESS) ) {
-   int type, xlink;
+   int type;
+   long xlink;
void *ptr;
+   
if (Z_TYPE_P(index_ptr) != le_index_ptr) {
RETURN_FALSE;
}
-   xlink = (int) index_ptr-ptr;
+   xlink = (long) index_ptr-ptr;
ptr = zend_list_find(xlink, type);  /* check if the xlink 
is still there */
if (ptr  (type == le_link || type == le_plink)) {
zend_list_addref(xlink);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-11 Thread Ard Biesheuvel
abies   Thu Sep 11 04:50:31 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Changed unsigned ISC_LONG to ISC_LONG
  # Build fix for FB 1.5
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.177 php-src/ext/interbase/interbase.c:1.178
--- php-src/ext/interbase/interbase.c:1.177 Sun Sep  7 15:59:55 2003
+++ php-src/ext/interbase/interbase.c   Thu Sep 11 04:50:30 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.177 2003/09/07 19:59:55 abies Exp $ */
+/* $Id: interbase.c,v 1.178 2003/09/11 08:50:30 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -26,7 +26,7 @@
 
 #include php.h
 
-#define FILE_REVISION $Revision: 1.177 $
+#define FILE_REVISION $Revision: 1.178 $
 
 #if HAVE_IBASE  !defined(VERSION_INFO_ONLY)
 
@@ -325,7 +325,7 @@
unsigned ISC_INT64 res;
if (sscanf(id, BLOB_ID_MASK, res)) {
qd-gds_quad_high = (ISC_LONG) (res  0x20);
-   qd-gds_quad_low = (unsigned ISC_LONG) (res  0x);
+   qd-gds_quad_low = (ISC_LONG) (res  0x);
return 1;
}
return 0;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-09-04 Thread Ard Biesheuvel
abies   Thu Sep  4 07:09:47 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Fixed fetching of arrays
  # Untested for multidimensional arrays
  Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.171 php-src/ext/interbase/interbase.c:1.172
--- php-src/ext/interbase/interbase.c:1.171 Wed Sep  3 21:26:36 2003
+++ php-src/ext/interbase/interbase.c   Thu Sep  4 07:09:46 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.171 2003/09/04 01:26:36 abies Exp $ */
+/* $Id: interbase.c,v 1.172 2003/09/04 11:09:46 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -708,7 +708,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.171 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.172 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1086,117 +1086,101 @@
 /* }}} */
 
 /* {{{ _php_ibase_alloc_array() */
-static int _php_ibase_alloc_array(ibase_array **ib_arrayp, int *array_cntp, XSQLDA 
*sqlda, isc_db_handle link, isc_tr_handle trans TSRMLS_DC)
+static int _php_ibase_alloc_array(ibase_array **ib_arrayp, XSQLDA *sqlda, 
isc_db_handle link, isc_tr_handle trans TSRMLS_DC)
 {
 #define IB_ARRAY (*ib_arrayp)
 
-   int i, dim, ar_cnt, ar_length;
-   XSQLVAR *var;
+   unsigned short i;
+   XSQLVAR *var = sqlda-sqlvar;
 
-   IB_ARRAY = NULL;
+   IB_ARRAY = safe_emalloc(sizeof(ibase_array), sqlda-sqld, 0);

-   ar_cnt = 0; /* find arrays */
-   var = sqlda-sqlvar;
for (i = 0; i  sqlda-sqld; i++, var++) {
+   unsigned short dim;
+   unsigned long ar_length;
+   
if ((var-sqltype  ~1) == SQL_ARRAY) {
-   ar_cnt++;
-   }
-   }
-
-   if (ar_cnt) { /* have  arrays ? */
-   *array_cntp = ar_cnt;
-   IB_ARRAY = safe_emalloc(sizeof(ibase_array), ar_cnt, 0);
-   ar_cnt = 0;
-   var = sqlda-sqlvar;
-   for (i = 0; i  sqlda-sqld; i++, var++) {
-   if ((var-sqltype  ~1) == SQL_ARRAY) {
+   ISC_ARRAY_DESC *ar_desc = IB_ARRAY[i].ar_desc;

-   ISC_ARRAY_DESC *ar_desc = IB_ARRAY[ar_cnt].ar_desc;
-   
-   if (isc_array_lookup_bounds(IB_STATUS, link, trans, 
var-relname, var-sqlname, ar_desc)) {
-   _php_ibase_error(TSRMLS_C);
-   efree(IB_ARRAY);
-   IB_ARRAY = NULL;
-   return FAILURE;
-   }
+   if (isc_array_lookup_bounds(IB_STATUS, link, trans, 
var-relname, var-sqlname, ar_desc)) {
+   _php_ibase_error(TSRMLS_C);
+   efree(IB_ARRAY);
+   IB_ARRAY = NULL;
+   return FAILURE;
+   }
 
-   switch (ar_desc-array_desc_dtype) {
-   case blr_text:
-   case blr_text2:
-   IB_ARRAY[ar_cnt].el_type = SQL_TEXT;
-   IB_ARRAY[ar_cnt].el_size = 
ar_desc-array_desc_length + 1;
-   break;
-   case blr_short:
-   IB_ARRAY[ar_cnt].el_type = SQL_SHORT;
-   IB_ARRAY[ar_cnt].el_size = 
sizeof(short);
-   break;
-   case blr_long:
-   IB_ARRAY[ar_cnt].el_type = SQL_LONG;
-   IB_ARRAY[ar_cnt].el_size = 
sizeof(ISC_LONG);
-   break;
-   case blr_float:
-   IB_ARRAY[ar_cnt].el_type = SQL_FLOAT;
-   IB_ARRAY[ar_cnt].el_size = 
sizeof(float);
-   break;
-   case blr_double:
-   IB_ARRAY[ar_cnt].el_type = SQL_DOUBLE;
-   IB_ARRAY[ar_cnt].el_size = 
sizeof(double);
-   break;
+   switch (ar_desc-array_desc_dtype) {
+  

[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-09-04 Thread Ard Biesheuvel
abies   Thu Sep  4 10:18:40 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Fix inter-op with IB  6
  Fixes for 64-bit archs
  Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.172 php-src/ext/interbase/interbase.c:1.173
--- php-src/ext/interbase/interbase.c:1.172 Thu Sep  4 07:09:46 2003
+++ php-src/ext/interbase/interbase.c   Thu Sep  4 10:18:39 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.172 2003/09/04 11:09:46 abies Exp $ */
+/* $Id: interbase.c,v 1.173 2003/09/04 14:18:39 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -39,7 +39,7 @@
 #endif
 
 #ifndef SQL_DIALECT_CURRENT
-#define SQL_DIALECT_CURRENT SQL_DIALECT_V5
+#define SQL_DIALECT_CURRENT 1 /* == SQL_DIALECT_V5 */
 #endif
 
 #ifdef ZEND_DEBUG_
@@ -53,11 +53,17 @@
 #define SAFE_STRING(s) ((s)?(s):)
 
 #ifdef PHP_WIN32
-#define LL_MASK I64
-#define LL_LIT(lit) lit ## I64
+# ifndef ISC_UINT64
+#  define ISC_UINT64 unsigned __int64
+# endif
+# define LL_MASK I64
+# define LL_LIT(lit) lit ## I64
 #else
-#define LL_MASK ll
-#define LL_LIT(lit) lit ## ll
+# ifndef ISC_UINT64
+#  define ISC_UINT64 unsigned long long int
+# endif
+# define LL_MASK ll
+# define LL_LIT(lit) lit ## ll
 #endif
 
 #define QUERY_RESULT   1
@@ -111,7 +117,6 @@
PHP_FE(ibase_commit, NULL)
PHP_FE(ibase_rollback, NULL)
PHP_FE(ibase_commit_ret, NULL)
-   PHP_FE(ibase_rollback_ret, NULL)
 
PHP_FE(ibase_blob_info, NULL)
PHP_FE(ibase_blob_create, NULL)
@@ -129,6 +134,8 @@
PHP_FE(ibase_add_user, NULL)
PHP_FE(ibase_modify_user, NULL)
PHP_FE(ibase_delete_user, NULL)
+
+   PHP_FE(ibase_rollback_ret, NULL)
 #endif
PHP_FE(ibase_wait_event, NULL)
PHP_FE(ibase_set_event_handler, NULL)
@@ -253,7 +260,7 @@
 } ISC_TEB;
 
 typedef struct {
-   ISC_USHORT vary_length;
+   unsigned short vary_length;
char vary_string[1];
 } IBVARY;
 
@@ -293,6 +300,7 @@
union {
short sval;
float fval;
+   ISC_LONG lval;
ISC_QUAD qval;
 #ifdef ISC_TIMESTAMP
ISC_TIMESTAMP tsval;
@@ -312,7 +320,7 @@
ISC_UINT64 res;
if (sscanf(id, BLOB_ID_MASK, res)) {
qd-gds_quad_high = (ISC_LONG) (res  0x20);
-   qd-gds_quad_low = (ISC_ULONG) (res  0x);
+   qd-gds_quad_low = (unsigned ISC_LONG) (res  0x);
return 1;
}
return 0;
@@ -466,9 +474,6 @@
IBDEBUG(Dropping statement handle (free_result dtor)...);
isc_dsql_free_statement(IB_STATUS, ib_result-stmt, 
DSQL_drop);
}
-   if (ib_result-out_array) {
-   efree(ib_result-out_array);
-   }
efree(ib_result);
}
 }
@@ -708,7 +713,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.172 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.173 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1356,8 +1361,22 @@
break;
case SQL_LONG:
convert_to_long(b_var);
+#if (SIZEOF_LONG  4)
+   /* ISC_LONG is always 32-bit */
+   if (Z_LVAL_P(b_var)  INT_MAX || 
Z_LVAL_P(b_var)  INT_MIN) {
+   _php_ibase_module_error(Parameter %d 
exceeds field width TSRMLS_CC, i+1);
+   rv = FAILURE;
+   }
+#endif
+   buf[i].val.lval = (ISC_LONG) Z_LVAL_P(b_var);
+   var-sqldata = (void *) buf[i].val.lval;
+   break;
+#if defined(SQL_INT64)  (SIZEOF_LONG == 8)
+   case SQL_INT64:
+   convert_to_long(b_var);
var-sqldata = (void *) Z_LVAL_P(b_var);
break;
+#endif
case SQL_FLOAT:
convert_to_double(b_var);
buf[i].val.fval = (float) Z_DVAL_P(b_var);
@@ -1602,7 +1621,7 @@
/* allocate sqlda and output buffers */
if (ib_query-out_sqlda) { /* output variables in select, select for update */
IBDEBUG(Query wants XSQLDA for output);
-   IB_RESULT = 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-04 Thread Ard Biesheuvel
abies   Thu Sep  4 10:44:35 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Don't rely on sizeof(int) == 4
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.173 php-src/ext/interbase/interbase.c:1.174
--- php-src/ext/interbase/interbase.c:1.173 Thu Sep  4 10:18:39 2003
+++ php-src/ext/interbase/interbase.c   Thu Sep  4 10:44:34 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.173 2003/09/04 14:18:39 abies Exp $ */
+/* $Id: interbase.c,v 1.174 2003/09/04 14:44:34 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -52,6 +52,9 @@
 
 #define SAFE_STRING(s) ((s)?(s):)
 
+#define ISC_LONG_MIN (-ISC_LONG_MAX - 1)
+#define ISC_LONG_MAX 2147483647
+
 #ifdef PHP_WIN32
 # ifndef ISC_UINT64
 #  define ISC_UINT64 unsigned __int64
@@ -713,7 +716,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.173 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.174 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1363,7 +1366,7 @@
convert_to_long(b_var);
 #if (SIZEOF_LONG  4)
/* ISC_LONG is always 32-bit */
-   if (Z_LVAL_P(b_var)  INT_MAX || 
Z_LVAL_P(b_var)  INT_MIN) {
+   if (Z_LVAL_P(b_var)  ISC_LONG_MAX || 
Z_LVAL_P(b_var)  ISC_LONG_MIN) {
_php_ibase_module_error(Parameter %d 
exceeds field width TSRMLS_CC, i+1);
rv = FAILURE;
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-04 Thread Ard Biesheuvel
abies   Thu Sep  4 18:37:14 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Added support for binding arrays
  Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.174 php-src/ext/interbase/interbase.c:1.175
--- php-src/ext/interbase/interbase.c:1.174 Thu Sep  4 10:44:34 2003
+++ php-src/ext/interbase/interbase.c   Thu Sep  4 18:37:14 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.174 2003/09/04 14:44:34 abies Exp $ */
+/* $Id: interbase.c,v 1.175 2003/09/04 22:37:14 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -56,14 +56,14 @@
 #define ISC_LONG_MAX 2147483647
 
 #ifdef PHP_WIN32
-# ifndef ISC_UINT64
-#  define ISC_UINT64 unsigned __int64
+# ifndef ISC_INT64
+#  define ISC_INT64 __int64
 # endif
 # define LL_MASK I64
 # define LL_LIT(lit) lit ## I64
 #else
-# ifndef ISC_UINT64
-#  define ISC_UINT64 unsigned long long int
+# ifndef ISC_INT64
+#  define ISC_INT64 long long int
 # endif
 # define LL_MASK ll
 # define LL_LIT(lit) lit ## ll
@@ -317,10 +317,10 @@
 static inline int _php_ibase_string_to_quad(char const *id, ISC_QUAD *qd)
 {
/* shortcut for most common case */
-   if (sizeof(ISC_QUAD) == sizeof(ISC_UINT64)) {
-   return sscanf(id, BLOB_ID_MASK, (ISC_UINT64 *) qd);
+   if (sizeof(ISC_QUAD) == sizeof(unsigned ISC_INT64)) {
+   return sscanf(id, BLOB_ID_MASK, (unsigned ISC_INT64 *) qd);
} else {
-   ISC_UINT64 res;
+   unsigned ISC_INT64 res;
if (sscanf(id, BLOB_ID_MASK, res)) {
qd-gds_quad_high = (ISC_LONG) (res  0x20);
qd-gds_quad_low = (unsigned ISC_LONG) (res  0x);
@@ -335,10 +335,10 @@
char *result = (char *) emalloc(BLOB_ID_LEN+1);
 
/* shortcut for most common case */
-   if (sizeof(ISC_QUAD) == sizeof(ISC_UINT64)) {
-   sprintf(result, BLOB_ID_MASK, *(ISC_UINT64*)(void *) qd); 
+   if (sizeof(ISC_QUAD) == sizeof(unsigned ISC_INT64)) {
+   sprintf(result, BLOB_ID_MASK, *(unsigned ISC_INT64*)(void *) qd); 
} else {
-   ISC_UINT64 res = ((ISC_UINT64) qd.gds_quad_high  0x20) | 
qd.gds_quad_low;
+   unsigned ISC_INT64 res = ((unsigned ISC_INT64) qd.gds_quad_high  
0x20) | qd.gds_quad_low;
sprintf(result, BLOB_ID_MASK, res);
}
result[BLOB_ID_LEN] = '\0';
@@ -716,7 +716,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.174 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.175 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1105,7 +1105,7 @@

for (i = 0; i  sqlda-sqld; i++, var++) {
unsigned short dim;
-   unsigned long ar_length;
+   unsigned long ar_size;

if ((var-sqltype  ~1) == SQL_ARRAY) {
ISC_ARRAY_DESC *ar_desc = IB_ARRAY[i].ar_desc;
@@ -1182,11 +1182,11 @@
return FAILURE;
} /* switch array_desc_type */

-   ar_length = 0; /* calculate elements count */
+   ar_size = 1; /* calculate elements count */
for (dim = 0; dim  ar_desc-array_desc_dimensions; dim++) {
-   ar_length += 1 + 
ar_desc-array_desc_bounds[dim].array_bound_upper - 
ar_desc-array_desc_bounds[dim].array_bound_lower;
+   ar_size *= 1 + 
ar_desc-array_desc_bounds[dim].array_bound_upper - 
ar_desc-array_desc_bounds[dim].array_bound_lower;
}
-   IB_ARRAY[i].ar_size = IB_ARRAY[i].el_size * ar_length;
+   IB_ARRAY[i].ar_size = IB_ARRAY[i].el_size * ar_size;
} /* if SQL_ARRAY */
} /* for column */
return SUCCESS;
@@ -1320,11 +1320,206 @@
 }  
 /* }}} */
 
+/* {{{ _php_ibase_bind_array() */
+static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size, 
ibase_array *array, int dim TSRMLS_DC)
+{
+   int 
+   u_bound = array-ar_desc.array_desc_bounds[dim].array_bound_upper,
+   l_bound = array-ar_desc.array_desc_bounds[dim].array_bound_lower,
+   dim_len = 1 + u_bound - l_bound;
+
+   if (dim  array-ar_desc.array_desc_dimensions) {
+   unsigned long slice_size = buf_size / dim_len;
+   unsigned short i;
+   
+   if (Z_TYPE_P(val) != IS_ARRAY || 
zend_hash_num_elements(Z_ARRVAL_P(val)) != dim_len) {
+   _php_ibase_module_error(Array parameter binding argument 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-03 Thread Ard Biesheuvel
abies   Wed Sep  3 11:15:31 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fix binding of 16-bit NUMERIC parameters
  Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.169 php-src/ext/interbase/interbase.c:1.170
--- php-src/ext/interbase/interbase.c:1.169 Tue Sep  2 18:37:26 2003
+++ php-src/ext/interbase/interbase.c   Wed Sep  3 11:15:30 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.169 2003/09/02 22:37:26 abies Exp $ */
+/* $Id: interbase.c,v 1.170 2003/09/03 15:15:30 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -706,7 +706,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.169 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.170 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1311,190 +1311,152 @@
Bind parameter placeholders in a previously prepared query */
 static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf, ibase_query 
*ib_query TSRMLS_DC)
 {
-   XSQLVAR *var;
-   zval *b_var;
-   int i;
+   int i , rv = SUCCESS;
+   XSQLVAR *var = sqlda-sqlvar;
 
-   var = sqlda-sqlvar;
-   for (i = 0; i  sqlda-sqld; var++, i++) { /* bound vars */
+   for (i = 0; i  sqlda-sqld; ++var, ++i) { /* bound vars */

-   buf[i].sqlind = 0;
+   zval *b_var = b_vars[i];
+
var-sqlind = buf[i].sqlind;
-   b_var = b_vars[i];

if (Z_TYPE_P(b_var) == IS_NULL) {
-   static char nothing[64];
-   static short null_flag = -1;
-   var-sqldata = nothing;
-   var-sqltype |= 1;
-   var-sqlind = null_flag;
-   if (var-sqllen  64) {
-   var-sqllen = 64;
+
+   if ((var-sqltype  1) != 1) {
+   _php_ibase_module_error(Parameter %d must have a 
value TSRMLS_CC, i+1);
+   rv = FAILURE;
}
-   } else
-   
-   switch (var-sqltype  ~1) {
-   case SQL_TEXT: /* direct to variable */
-   case SQL_VARYING:
-   convert_to_string(b_var);
-   var-sqldata = (void *) Z_STRVAL_P(b_var);
-   var-sqllen  = Z_STRLEN_P(b_var);
-   var-sqltype = SQL_TEXT + (var-sqltype  1);
-   break;
-   case SQL_SHORT:
-   convert_to_long(b_var);
-   if (Z_LVAL_P(b_var)  SHRT_MAX || Z_LVAL_P(b_var)  
SHRT_MIN) {
-   _php_ibase_module_error(Field %*s overflow 
TSRMLS_CC, var-aliasname_length, var-aliasname);
-   return FAILURE;
-   }
-   buf[i].val.sval = (short) Z_LVAL_P(b_var);
-   var-sqldata = (void *) (buf[i].val.sval);
-   break;
-   case SQL_LONG:
-   if (var-sqlscale  0) {
-   /*
- DECIMAL or NUMERIC field stored internally 
as scaled integer.
- Coerce it to string and let InterBase's 
internal routines
- handle it.
-   */
-   convert_to_string(b_var);
-   var-sqldata = (void *) Z_STRVAL_P(b_var);
-   var-sqllen  = Z_STRLEN_P(b_var);
-   var-sqltype = SQL_TEXT;
-   } else {
-   convert_to_long(b_var);
-   var-sqldata = (void *) (Z_LVAL_P(b_var));
-   }
-   break;
-   case SQL_FLOAT:
-   convert_to_double(b_var);
-   buf[i].val.fval = (float) Z_DVAL_P(b_var);
-   var-sqldata = (void *) (buf[i].val.fval);
-   break;
-   case SQL_DOUBLE:  /* direct to variable */
-   convert_to_double(b_var);
-   var-sqldata = (void *) (Z_DVAL_P(b_var));
-   break;

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-03 Thread Ard Biesheuvel
abies   Wed Sep  3 21:26:36 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  No scaling for double type
  Added missing array types
  Precompute scale factors
  Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.170 php-src/ext/interbase/interbase.c:1.171
--- php-src/ext/interbase/interbase.c:1.170 Wed Sep  3 11:15:30 2003
+++ php-src/ext/interbase/interbase.c   Wed Sep  3 21:26:36 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.170 2003/09/03 15:15:30 abies Exp $ */
+/* $Id: interbase.c,v 1.171 2003/09/04 01:26:36 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -54,8 +54,10 @@
 
 #ifdef PHP_WIN32
 #define LL_MASK I64
+#define LL_LIT(lit) lit ## I64
 #else
 #define LL_MASK ll
+#define LL_LIT(lit) lit ## ll
 #endif
 
 #define QUERY_RESULT   1
@@ -706,7 +708,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.170 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.171 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1130,7 +1132,7 @@
break;
case blr_long:
IB_ARRAY[ar_cnt].el_type = SQL_LONG;
-   IB_ARRAY[ar_cnt].el_size = 
sizeof(long);
+   IB_ARRAY[ar_cnt].el_size = 
sizeof(ISC_LONG);
break;
case blr_float:
IB_ARRAY[ar_cnt].el_type = SQL_FLOAT;
@@ -1140,18 +1142,44 @@
IB_ARRAY[ar_cnt].el_type = SQL_DOUBLE;
IB_ARRAY[ar_cnt].el_size = 
sizeof(double);
break;
+#ifdef blr_int64
+   case blr_int64:
+   IB_ARRAY[ar_cnt].el_type = SQL_INT64;
+   IB_ARRAY[ar_cnt].el_size = 
sizeof(ISC_INT64);
+   break;
+#endif
+#ifndef blr_timestamp
case blr_date:
IB_ARRAY[ar_cnt].el_type = SQL_DATE;
IB_ARRAY[ar_cnt].el_size = 
sizeof(ISC_QUAD);
break;
+#else
+   case blr_timestamp:
+   IB_ARRAY[ar_cnt].el_type = 
SQL_TIMESTAMP;
+   IB_ARRAY[ar_cnt].el_size = 
sizeof(ISC_TIMESTAMP);
+   break;
+   case blr_sql_date:
+   IB_ARRAY[ar_cnt].el_type = 
SQL_TYPE_DATE;
+   IB_ARRAY[ar_cnt].el_size = 
sizeof(ISC_DATE);
+   break;
+   case blr_sql_time:
+   IB_ARRAY[ar_cnt].el_type = 
SQL_TYPE_TIME;
+   IB_ARRAY[ar_cnt].el_size = 
sizeof(ISC_TIME);
+   break;
+#endif 
case blr_varying:
case blr_varying2:  /* changed to SQL_TEXT 
? */
/* sql_type = SQL_VARYING; Why? FIXME: 
??? */
IB_ARRAY[ar_cnt].el_type = SQL_TEXT;
IB_ARRAY[ar_cnt].el_size = 
ar_desc-array_desc_length + sizeof(short);
break;
+   case blr_quad:
+   case blr_blob_id:
+   case blr_cstring:
+   case blr_cstring2:
+   /* FIXME */
default:
-   _php_ibase_module_error(Unexpected 
array type %d in relation '%s' column '%s' TSRMLS_CC, ar_desc-array_desc_dtype, 
var-relname, var-sqlname);
+   _php_ibase_module_error(Unsupported 
array type %d in relation '%s' column '%s' TSRMLS_CC, ar_desc-array_desc_dtype, 
var-relname, var-sqlname);
 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-02 Thread Ard Biesheuvel
abies   Tue Sep  2 09:17:57 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Can't ignore variadic DEBUG macro for compilers
  that don't support them. Revert.
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.165 php-src/ext/interbase/interbase.c:1.166
--- php-src/ext/interbase/interbase.c:1.165 Tue Sep  2 08:46:42 2003
+++ php-src/ext/interbase/interbase.c   Tue Sep  2 09:17:56 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.165 2003/09/02 12:46:42 abies Exp $ */
+/* $Id: interbase.c,v 1.166 2003/09/02 13:17:56 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -43,7 +43,7 @@
 #endif
 
 #ifdef ZEND_DEBUG_
-#define IBDEBUG(fmt, ...) php_printf(::: (%4d)  fmt  \n,  __LINE__, ##__VA_ARGS__)
+#define IBDEBUG(a) php_printf(::: %s (%d)\n, a, __LINE__);
 #endif
 
 #ifndef IBDEBUG
@@ -261,7 +261,7 @@
 {
int type;
 
-   IBDEBUG(Resource #%ld transaction or database link?,Z_LVAL_PP(link_id));
+   IBDEBUG(Transaction or database link?);
if (zend_list_find(Z_LVAL_PP(link_id), type)) {
if (type == le_trans) {
/* Transaction resource: make sure it refers to one link only, 
then 
@@ -706,7 +706,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.165 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.166 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1634,7 +1634,7 @@
 
/* allocate sqlda and output buffers */
if (ib_query-out_sqlda) { /* output variables in select, select for update */
-   IBDEBUG(Query wants XSQLDA with %d field(s) for 
output,ib_query-out_sqlda-sqld);
+   IBDEBUG(Query wants XSQLDA for output);
IB_RESULT = emalloc(sizeof(ibase_result));
IB_RESULT-link = ib_query-link;
IB_RESULT-trans = ib_query-trans;
@@ -1656,7 +1656,7 @@
}
 
if (ib_query-in_sqlda) { /* has placeholders */
-   IBDEBUG(Query wants XSQLDA with %d field(s) for 
input,ib_query-in_sqlda-sqld);
+   IBDEBUG(Query wants XSQLDA for input);
if (ib_query-in_sqlda-sqld != argc) {
_php_ibase_module_error(Placeholders (%d) and variables (%d) 
mismatch TSRMLS_CC, ib_query-in_sqlda-sqld, argc);
goto _php_ibase_exec_error;
@@ -2878,7 +2878,7 @@

/* Have we used this cursor before and it's still open (exec proc has no 
cursor) ? */
if (ib_query-result_res_id != 0  ib_query-statement_type != 
isc_info_sql_stmt_exec_procedure) {
-   IBDEBUG(Implicitly closing a cursor for result resource 
#%d,ib_query-result_res_id);
+   IBDEBUG(Implicitly closing a cursor);
if (isc_dsql_free_statement(IB_STATUS, ib_query-stmt, DSQL_close)) {
_php_ibase_error(TSRMLS_C);
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-02 Thread Ard Biesheuvel
abies   Tue Sep  2 15:30:22 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Make ibase_{param|field}_info() return typenames that actually mean something
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.166 php-src/ext/interbase/interbase.c:1.167
--- php-src/ext/interbase/interbase.c:1.166 Tue Sep  2 09:17:56 2003
+++ php-src/ext/interbase/interbase.c   Tue Sep  2 15:30:20 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.166 2003/09/02 13:17:56 abies Exp $ */
+/* $Id: interbase.c,v 1.167 2003/09/02 19:30:20 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -706,7 +706,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.166 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.167 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -2985,7 +2985,7 @@
 /* }}} */
 #endif
 
-/* {{{ proto int ibase_num_fields(resource {query|result})
+/* {{{ proto int ibase_num_fields(resource query|result)
Get the number of fields in result */
 PHP_FUNCTION(ibase_num_fields)
 {
@@ -3021,14 +3021,78 @@
 }
 /* }}} */
 
-/* {{{ proto array ibase_field_info(resource result, int field_number)
+/* {{{ static char * _php_ibase_field_type() */
+static char * _php_ibase_field_type(XSQLVAR *var)
+{
+   char buf[32], *s;
+   int precision;
+   
+   switch (var-sqltype  ~1) {
+   case SQL_TEXT:  s = CHAR; break;
+   case SQL_VARYING:   s = VARCHAR; break;
+   case SQL_SHORT:
+   if (var-sqlscale  0) {
+   precision = 4;
+   } else {
+   s = SMALLINT; 
+   }
+   break;
+   case SQL_LONG:
+   if (var-sqlscale  0) {
+   precision = 9;
+   } else {
+   s = INTEGER; 
+   }
+   break;
+   case SQL_FLOAT: s = FLOAT; break;
+   case SQL_DOUBLE:
+   case SQL_D_FLOAT:   s = DOUBLE PRECISION; break;
+#ifdef SQL_INT64
+   case SQL_INT64: 
+   if (var-sqlscale  0) {
+   precision = 18;
+   } else {
+   s = BIGINT; 
+   }
+   break;
+#endif
+#ifdef SQL_TIMESTAMP
+   case SQL_TIMESTAMP: s = TIMESTAMP; break;
+   case SQL_TYPE_DATE: s = DATE; break;
+   case SQL_TYPE_TIME: s = TIME; break;
+#else
+   case SQL_DATE:  s = DATE; break;
+#endif
+   case SQL_BLOB:  s = BLOB; break;
+   case SQL_ARRAY: s = ARRAY; break;
+
+   /* TODO provide more detailed information about the 
field type, field size
+  and array dimensions */
+   
+   case SQL_QUAD:  s = QUAD; break;
+
+   default:
+   sprintf(buf, unknown (%d), var-sqltype  ~1);
+   s = buf;
+   break;
+   }
+   if (var-sqlscale  0) {
+   sprintf(buf, NUMERIC(%d,%d), precision, -var-sqlscale);
+   s = buf;
+   }
+   
+   return estrdup(s);
+}
+/* }}} */
+
+/* {{{ proto array ibase_field_info(resource query|result, int field_number)
Get information about a field */
 PHP_FUNCTION(ibase_field_info)
 {
zval **result_arg, **field_arg;
-   ibase_result *ib_result;
-   char buf[30], *s;
-   int len;
+   char buf[8], *s;
+   int len, type;
+   XSQLDA *sqlda;
XSQLVAR *var;
 
RESET_ERRMSG;
@@ -3037,22 +3101,34 @@
WRONG_PARAM_COUNT;
}
 
-   ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, InterBase 
result, le_result);
+   zend_list_find(Z_LVAL_PP(result_arg), type);
+   
+   if (type == le_query) {
+   ibase_query *ib_query;
 
-   if (ib_result-out_sqlda == NULL) {
+   ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result_arg, -1, 
InterBase query, le_query);
+   sqlda = ib_query-out_sqlda;
+   } else {
+   ibase_result *ib_result;
+   
+   ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, 
InterBase result, le_result);
+   sqlda = ib_result-out_sqlda;
+   }   
+
+   if (sqlda == NULL) {
_php_ibase_module_error(Trying to get field info from a non-select 
query 

Re: [PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-02 Thread Ard Biesheuvel
 Please don't use | in parameter names, you couldn't do that in php.
 Make it query_result or something like that.
OK

 And please have a look at CS we prefer case and their statments on
 different lines.
Actually, that's how it was in the original file.
Will fix it.
--
Ard
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-09-02 Thread Ard Biesheuvel
abies   Tue Sep  2 18:19:19 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  CS fixes
  # Boy, these guys are worse than -ansi -pedantic
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.167 php-src/ext/interbase/interbase.c:1.168
--- php-src/ext/interbase/interbase.c:1.167 Tue Sep  2 15:30:20 2003
+++ php-src/ext/interbase/interbase.c   Tue Sep  2 18:19:18 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.167 2003/09/02 19:30:20 abies Exp $ */
+/* $Id: interbase.c,v 1.168 2003/09/02 22:19:18 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -706,7 +706,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.167 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.168 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -2985,7 +2985,7 @@
 /* }}} */
 #endif
 
-/* {{{ proto int ibase_num_fields(resource query|result)
+/* {{{ proto int ibase_num_fields(resource query_result)
Get the number of fields in result */
 PHP_FUNCTION(ibase_num_fields)
 {
@@ -3024,68 +3024,85 @@
 /* {{{ static char * _php_ibase_field_type() */
 static char * _php_ibase_field_type(XSQLVAR *var)
 {
-   char buf[32], *s;
-   int precision;
+   char *s = (unknown type);

-   switch (var-sqltype  ~1) {
-   case SQL_TEXT:  s = CHAR; break;
-   case SQL_VARYING:   s = VARCHAR; break;
-   case SQL_SHORT:
-   if (var-sqlscale  0) {
+   if (var-sqlscale  0) {
+   char buf[16];
+   unsigned short precision;
+
+   switch (var-sqltype  ~1) {
+
+   case SQL_SHORT:
precision = 4;
-   } else {
-   s = SMALLINT; 
-   }
-   break;
-   case SQL_LONG:
-   if (var-sqlscale  0) {
+   break;
+   case SQL_LONG:
precision = 9;
-   } else {
-   s = INTEGER; 
-   }
-   break;
-   case SQL_FLOAT: s = FLOAT; break;
-   case SQL_DOUBLE:
-   case SQL_D_FLOAT:   s = DOUBLE PRECISION; break;
+   break;
 #ifdef SQL_INT64
-   case SQL_INT64: 
-   if (var-sqlscale  0) {
+   case SQL_INT64: 
precision = 18;
-   } else {
+   break;
+#endif
+   }
+   sprintf(buf, NUMERIC(%d,%d), precision, -var-sqlscale);
+   return estrdup(buf);
+   } else {
+   switch (var-sqltype  ~1) {
+   case SQL_TEXT:
+   s = CHAR; 
+   break;
+   case SQL_VARYING:
+   s = VARCHAR; 
+   break;
+   case SQL_SHORT:
+   s = SMALLINT; 
+   break;
+   case SQL_LONG:
+   s = INTEGER; 
+   break;
+   case SQL_FLOAT: 
+   s = FLOAT; break;
+   case SQL_DOUBLE:
+   case SQL_D_FLOAT:   
+   s = DOUBLE PRECISION; break;
+#ifdef SQL_INT64
+   case SQL_INT64: 
s = BIGINT; 
-   }
-   break;
+   break;
 #endif
 #ifdef SQL_TIMESTAMP
-   case SQL_TIMESTAMP: s = TIMESTAMP; break;
-   case SQL_TYPE_DATE: s = DATE; break;
-   case SQL_TYPE_TIME: s = TIME; break;
+   case SQL_TIMESTAMP: 
+   s = TIMESTAMP; 
+   break;
+   case SQL_TYPE_DATE:
+   s = DATE;
+   break;
+   case SQL_TYPE_TIME:
+   s = TIME; 
+   break;
 #else
-   case SQL_DATE:  s = DATE; break;
+   case SQL_DATE:
+   s = DATE; 
+   break;
 #endif
-   case SQL_BLOB:  s = BLOB; break;
-   case SQL_ARRAY: s = ARRAY; break;
-
-  

[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-09-02 Thread Ard Biesheuvel
abies   Tue Sep  2 18:37:26 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Nuke far pointers
  # Unfortunately, this does break compatibility with Windows 3.x :-)
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.168 php-src/ext/interbase/interbase.c:1.169
--- php-src/ext/interbase/interbase.c:1.168 Tue Sep  2 18:19:18 2003
+++ php-src/ext/interbase/interbase.c   Tue Sep  2 18:37:26 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.168 2003/09/02 22:19:18 abies Exp $ */
+/* $Id: interbase.c,v 1.169 2003/09/02 22:37:26 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -706,7 +706,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.168 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.169 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1337,7 +1337,7 @@
case SQL_TEXT: /* direct to variable */
case SQL_VARYING:
convert_to_string(b_var);
-   var-sqldata = (void ISC_FAR *) Z_STRVAL_P(b_var);
+   var-sqldata = (void *) Z_STRVAL_P(b_var);
var-sqllen  = Z_STRLEN_P(b_var);
var-sqltype = SQL_TEXT + (var-sqltype  1);
break;
@@ -1348,7 +1348,7 @@
return FAILURE;
}
buf[i].val.sval = (short) Z_LVAL_P(b_var);
-   var-sqldata = (void ISC_FAR *) (buf[i].val.sval);
+   var-sqldata = (void *) (buf[i].val.sval);
break;
case SQL_LONG:
if (var-sqlscale  0) {
@@ -1358,22 +1358,22 @@
  handle it.
*/
convert_to_string(b_var);
-   var-sqldata = (void ISC_FAR *) 
Z_STRVAL_P(b_var);
+   var-sqldata = (void *) Z_STRVAL_P(b_var);
var-sqllen  = Z_STRLEN_P(b_var);
var-sqltype = SQL_TEXT;
} else {
convert_to_long(b_var);
-   var-sqldata = (void ISC_FAR *) 
(Z_LVAL_P(b_var));
+   var-sqldata = (void *) (Z_LVAL_P(b_var));
}
break;
case SQL_FLOAT:
convert_to_double(b_var);
buf[i].val.fval = (float) Z_DVAL_P(b_var);
-   var-sqldata = (void ISC_FAR *) (buf[i].val.fval);
+   var-sqldata = (void *) (buf[i].val.fval);
break;
case SQL_DOUBLE:  /* direct to variable */
convert_to_double(b_var);
-   var-sqldata = (void ISC_FAR *) (Z_DVAL_P(b_var));
+   var-sqldata = (void *) (Z_DVAL_P(b_var));
break;
 #ifdef SQL_INT64
case SQL_INT64:
@@ -1383,7 +1383,7 @@
  to avoid rounding errors...
*/
convert_to_string(b_var);
-   var-sqldata = (void ISC_FAR *) Z_STRVAL_P(b_var);
+   var-sqldata = (void *) Z_STRVAL_P(b_var);
var-sqllen  = Z_STRLEN_P(b_var);
var-sqltype = SQL_TEXT;
break;
@@ -1415,7 +1415,7 @@
t.tm_year -= 1900;
t.tm_mon--;
isc_encode_date(t, buf[i].val.qval);
-   var-sqldata = (void ISC_FAR *) 
(buf[i].val.qval);
+   var-sqldata = (void *) (buf[i].val.qval);
}
 #else
/*
@@ -1426,7 +1426,7 @@
  ask Sascha?
*/
convert_to_string(b_var);
-   var-sqldata = (void ISC_FAR *) Z_STRVAL_P(b_var);
+   var-sqldata = 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-28 Thread Ard Biesheuvel
abies   Thu Aug 28 12:48:23 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fixed some format strings
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.162 php-src/ext/interbase/interbase.c:1.163
--- php-src/ext/interbase/interbase.c:1.162 Wed Aug 27 20:11:16 2003
+++ php-src/ext/interbase/interbase.c   Thu Aug 28 12:48:22 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.162 2003/08/28 00:11:16 abies Exp $ */
+/* $Id: interbase.c,v 1.163 2003/08/28 16:48:22 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -704,7 +704,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.162 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.163 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -887,12 +887,12 @@
list_entry new_le;

if ((IBG(max_links) != -1)  (IBG(num_links) = 
IBG(max_links))) {
-   _php_ibase_module_error(Too many open links (%d) 
TSRMLS_CC, IBG(num_links));
+   _php_ibase_module_error(Too many open links (%ld) 
TSRMLS_CC, IBG(num_links));
efree(hashed_details);
RETURN_FALSE;
}
if ((IBG(max_persistent) != -1)  (IBG(num_persistent) = 
IBG(max_persistent))) {
-   _php_ibase_module_error(Too many open persistent 
links (%d) TSRMLS_CC, IBG(num_persistent));
+   _php_ibase_module_error(Too many open persistent 
links (%ld) TSRMLS_CC, IBG(num_persistent));
efree(hashed_details);
RETURN_FALSE;
}
@@ -953,7 +953,7 @@
}
}
if ((IBG(max_links) != -1)  (IBG(num_links) = IBG(max_links))) {
-   _php_ibase_module_error(Too many open links (%d) TSRMLS_CC, 
IBG(num_links));
+   _php_ibase_module_error(Too many open links (%ld) TSRMLS_CC, 
IBG(num_links));
efree(hashed_details);
RETURN_FALSE;
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-20 Thread Ard Biesheuvel
abies   Wed Aug 20 08:40:05 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Moved some local vars to stack
  
  
  Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.154 php-src/ext/interbase/interbase.c:1.155
--- php-src/ext/interbase/interbase.c:1.154 Wed Aug 20 08:22:58 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug 20 08:40:05 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.154 2003/08/20 12:22:58 abies Exp $ */
+/* $Id: interbase.c,v 1.155 2003/08/20 12:40:05 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -285,8 +285,8 @@
} else {
ISC_UINT64 res;
int n = sscanf(id, BLOB_ID_MASK, res);
-   qd-gds_quad_high = (SLONG) (res  0x20);
-   qd-gds_quad_low = (ULONG) (res  0x);
+   qd-gds_quad_high = (long) (res  0x20);
+   qd-gds_quad_low = (unsigned long) (res  0x);
return n;
}
 }
@@ -461,29 +461,27 @@
 static void _php_ibase_free_query(ibase_query *ib_query TSRMLS_DC)
 {
IBDEBUG(Freeing query...);
-   if (ib_query) {
-   if (ib_query-in_sqlda) {
-   efree(ib_query-in_sqlda);
-   }
-   if (ib_query-out_sqlda) {
-   efree(ib_query-out_sqlda);
-   }
-   if (ib_query-stmt) {
-   IBDEBUG(Dropping statement handle (free_query)...);
-   if (isc_dsql_free_statement(IB_STATUS, ib_query-stmt, 
DSQL_drop)) {
-   _php_ibase_error(TSRMLS_C);
-   }
-   }
-   if (ib_query-in_array) {
-   efree(ib_query-in_array);
-   }
-   if (ib_query-out_array) {
-   efree(ib_query-out_array);
-   }
-   if (ib_query-query) {
-   efree(ib_query-query);
+
+   if (ib_query-in_sqlda) {
+   efree(ib_query-in_sqlda);
+   }
+   if (ib_query-out_sqlda) {
+   efree(ib_query-out_sqlda);
+   }
+   if (ib_query-stmt) {
+   IBDEBUG(Dropping statement handle (free_query)...);
+   if (isc_dsql_free_statement(IB_STATUS, ib_query-stmt, DSQL_drop)) {
+   _php_ibase_error(TSRMLS_C);
}
-   efree(ib_query);
+   }
+   if (ib_query-in_array) {
+   efree(ib_query-in_array);
+   }
+   if (ib_query-out_array) {
+   efree(ib_query-out_array);
+   }
+   if (ib_query-query) {
+   efree(ib_query-query);
}
 }
 /* }}} */
@@ -491,30 +489,10 @@
 /* {{{ php_ibase_free_query_rsrc() */
 static void php_ibase_free_query_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
 {
-   ibase_query *ib_query = (ibase_query *)rsrc-ptr;
-
-   IBDEBUG(Freeing query by dtor...);
-   if (ib_query) {
-   if (ib_query-in_sqlda) {
-   efree(ib_query-in_sqlda);
-   }
-   if (ib_query-out_sqlda) {
-   efree(ib_query-out_sqlda);
-   }
-   if (ib_query-stmt) {
-   IBDEBUG(Dropping statement handle (free_query dtor)...);
-   isc_dsql_free_statement(IB_STATUS, ib_query-stmt, DSQL_drop);
-   }
-   if (ib_query-in_array) {
-   efree(ib_query-in_array);
-   }
-   if (ib_query-out_array) {
-   efree(ib_query-out_array);
-   }
-   if (ib_query-query) {
-   efree(ib_query-query);
-   }
-   efree(ib_query);
+   if (rsrc-ptr != NULL) {
+   IBDEBUG(Preparing to free query by dtor...);
+   _php_ibase_free_query((ibase_query *)rsrc-ptr);
+   efree(rsrc-ptr);
}
 }
 /* }}} */
@@ -706,7 +684,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.154 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.155 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1176,120 +1154,114 @@
 
 /* {{{ _php_ibase_alloc_query() */
 /* allocate and prepare query */
-static int _php_ibase_alloc_query(ibase_query **ib_queryp, ibase_db_link *link, 
ibase_trans *trans, char *query, unsigned short dialect, int trans_res_id TSRMLS_DC)
+static int _php_ibase_alloc_query(ibase_query *ib_query, ibase_db_link *link, 
ibase_trans *trans, char *query, unsigned short dialect, int trans_res_id TSRMLS_DC)
 {
-#define IB_QUERY (*ib_queryp)
static char info_type[] = {isc_info_sql_stmt_type};
   

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-20 Thread Ard Biesheuvel
abies   Wed Aug 20 08:40:59 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fix Win32 build
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.155 php-src/ext/interbase/interbase.c:1.156
--- php-src/ext/interbase/interbase.c:1.155 Wed Aug 20 08:40:05 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug 20 08:40:59 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.155 2003/08/20 12:40:05 abies Exp $ */
+/* $Id: interbase.c,v 1.156 2003/08/20 12:40:59 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -491,7 +491,7 @@
 {
if (rsrc-ptr != NULL) {
IBDEBUG(Preparing to free query by dtor...);
-   _php_ibase_free_query((ibase_query *)rsrc-ptr);
+   _php_ibase_free_query((ibase_query *)rsrc-ptr TSRMLS_CC);
efree(rsrc-ptr);
}
 }
@@ -684,7 +684,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.155 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.156 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-20 Thread Ard Biesheuvel
abies   Wed Aug 20 09:02:27 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Cleaned up _php_ibase_var_zval()
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.156 php-src/ext/interbase/interbase.c:1.157
--- php-src/ext/interbase/interbase.c:1.156 Wed Aug 20 08:40:59 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug 20 09:02:26 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.156 2003/08/20 12:40:59 abies Exp $ */
+/* $Id: interbase.c,v 1.157 2003/08/20 13:02:26 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -684,7 +684,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.156 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.157 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -2285,6 +2285,8 @@
char string_data[255];

switch (type  ~1) {
+   unsigned short j;
+
case SQL_VARYING:
len = ((PARAMVARY *) data)-vary_length;
data = ((PARAMVARY *) data)-vary_string;
@@ -2299,75 +2301,59 @@
break;
case SQL_LONG:
case SQL_SHORT:
-   if (scale) {
-   short j;
+   if (scale  0) {
long n, f = 1;
+
if ( (type  ~1) == SQL_SHORT) {
-   n = (long) *(short *) (data);
+   n = *(short *) (data);
} else {
-   n = (long) *(long *) (data);
+   n = *(long *) (data);
}
for (j = 0; j  -scale; j++) {
f *= 10;
}
-   if (n  = 0) {
-   Z_STRLEN_P(val) = sprintf(string_data, 
%ld.%0*ld, n / f, -scale,  n % f );
-   } else if ((n/f) != 0) {
-   Z_STRLEN_P(val) = sprintf(string_data, 
%ld.%0*ld, n / f, -scale,  -(n % f) );
+   if (n  = 0 || n  -f) {
+   j = sprintf(string_data, %ld.%0*ld, n / f, 
-scale,  labs(n % f) );
} else {
-   Z_STRLEN_P(val) = sprintf(string_data, 
%s.%0*ld,-0, -scale, -(n % f) );
+   j = sprintf(string_data, %s.%0*ld,-0, 
-scale, -n % f);
}
-   Z_TYPE_P(val) = IS_STRING;
-   Z_STRVAL_P(val) = estrdup(string_data);
+   ZVAL_STRINGL(val,string_data,j,1);
+   } else if ( (type  ~1) == SQL_SHORT) {
+   ZVAL_LONG(val, *(short *) data);
} else {
-   Z_TYPE_P(val) = IS_LONG;
-   if ( (type  ~1) == SQL_SHORT) {
-   Z_LVAL_P(val) = *(short *) (data);
-   } else {
-   Z_LVAL_P(val) = *(long *) (data);
-   }
+   ZVAL_LONG(val, *(long *) data);
}
break;
case SQL_FLOAT:
-   Z_TYPE_P(val) = IS_DOUBLE;
-   Z_DVAL_P(val) = *(float *) (data);
+   ZVAL_DOUBLE(val, *(float *) data);
break;
case SQL_DOUBLE:
-   if (scale) {
-   Z_TYPE_P(val) = IS_STRING;
-   Z_STRLEN_P(val) = sprintf(string_data, %.*f, -scale, 
*(double *) data);
-   Z_STRVAL_P(val) = estrdup(string_data);
+   if (scale  0) {
+   j = sprintf(string_data, %.*f, -scale, *(double *) 
data);
+   ZVAL_STRINGL(val, string_data, j, 1);
} else {
-   Z_TYPE_P(val) = IS_DOUBLE;
-   Z_DVAL_P(val) = *(double *) data;
+   ZVAL_DOUBLE(val, *(double *) data);
}
break;
 #ifdef SQL_INT64
case SQL_INT64:
-   Z_TYPE_P(val) = IS_STRING;
if (scale  0) {
-  

[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-20 Thread Ard Biesheuvel
abies   Wed Aug 20 12:13:51 2003 EDT

  Modified files:  
/php-src/ext/interbase  php_interbase.h interbase.c 
  Log:
  Moved transaction defaults to header file
  
  
Index: php-src/ext/interbase/php_interbase.h
diff -u php-src/ext/interbase/php_interbase.h:1.54 
php-src/ext/interbase/php_interbase.h:1.55
--- php-src/ext/interbase/php_interbase.h:1.54  Wed Aug 20 08:22:58 2003
+++ php-src/ext/interbase/php_interbase.h   Wed Aug 20 12:13:51 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: php_interbase.h,v 1.54 2003/08/20 12:22:58 abies Exp $ */
+/* $Id: php_interbase.h,v 1.55 2003/08/20 16:13:51 abies Exp $ */
 
 #ifndef PHP_INTERBASE_H
 #define PHP_INTERBASE_H
@@ -180,23 +180,26 @@
 
 enum php_interbase_option {
PHP_IBASE_DEFAULT   = 0,
-   PHP_IBASE_UNIXTIME  = 2,
-   PHP_IBASE_TIMESTAMP = 4,
-   PHP_IBASE_DATE  = 8,
-   PHP_IBASE_TIME  = 16,
-   /* fetch args */
+   /* fetch flags */
PHP_IBASE_FETCH_BLOBS   = 1,
PHP_IBASE_FETCH_ARRAYS  = 2,
-   /* transactions */  
-   PHP_IBASE_WRITE = 2,
-   PHP_IBASE_READ  = 4,
-   PHP_IBASE_COMMITTED = 8,
-   PHP_IBASE_CONSISTENCY   = 16,
-   PHP_IBASE_CONCURRENCY   = 32,
-   PHP_IBASE_REC_VERSION   = 64,
-   PHP_IBASE_REC_NO_VERSION= 128,
-   PHP_IBASE_NOWAIT= 256,
-   PHP_IBASE_WAIT  = 512
+   PHP_IBASE_UNIXTIME  = 4,
+   /* timefmt flags */
+   PHP_IBASE_TIMESTAMP = 1,
+   PHP_IBASE_DATE  = 2,
+   PHP_IBASE_TIME  = 4,
+   /* transaction access mode */   
+   PHP_IBASE_WRITE = 0, /* default */
+   PHP_IBASE_READ  = 1,
+   /* transaction isolation level */
+   PHP_IBASE_CONCURRENCY   = 0, /* default */
+   PHP_IBASE_COMMITTED = 2,
+ PHP_IBASE_REC_NO_VERSION  = 0, /* default */
+ PHP_IBASE_REC_VERSION = 4,
+   PHP_IBASE_CONSISTENCY   = 8,
+   /* transaction lock resolution */
+   PHP_IBASE_WAIT  = 0, /* default */
+   PHP_IBASE_NOWAIT= 16
 };
 
 #ifdef ZTS
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.157 php-src/ext/interbase/interbase.c:1.158
--- php-src/ext/interbase/interbase.c:1.157 Wed Aug 20 09:02:26 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug 20 12:13:51 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.157 2003/08/20 13:02:26 abies Exp $ */
+/* $Id: interbase.c,v 1.158 2003/08/20 16:13:51 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -276,7 +276,6 @@
short sqlind;
 } BIND_BUF;
 
-
 static inline int _php_ibase_string_to_quad(char const *id, ISC_QUAD *qd)
 {
/* shortcut for most common case */
@@ -284,10 +283,12 @@
return sscanf(id, BLOB_ID_MASK, (ISC_UINT64 *) qd);
} else {
ISC_UINT64 res;
-   int n = sscanf(id, BLOB_ID_MASK, res);
-   qd-gds_quad_high = (long) (res  0x20);
-   qd-gds_quad_low = (unsigned long) (res  0x);
-   return n;
+   if (sscanf(id, BLOB_ID_MASK, res)) {
+   qd-gds_quad_high = (ISC_LONG) (res  0x20);
+   qd-gds_quad_low = (ISC_ULONG) (res  0x);
+   return 1;
+   }
+   return 0;
}
 }
 
@@ -684,7 +685,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.157 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.158 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1785,31 +1786,31 @@
last_tpb[tpb_len++] = isc_tpb_version3;
 
/* access mode */
-   if (trans_argl  PHP_IBASE_READ) { /* READ 
ONLY TRANSACTION */
+   if (PHP_IBASE_READ == (trans_argl  
PHP_IBASE_READ)) {
last_tpb[tpb_len++] = isc_tpb_read;
-   } else {
-   last_tpb[tpb_len++] = isc_tpb_write;  
/* default access mode */
+   } else if (PHP_IBASE_WRITE == (trans_argl  
PHP_IBASE_WRITE)) {
+ 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-20 Thread Ard Biesheuvel
abies   Wed Aug 20 18:59:34 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fix false warning on zero-size BLOB fetch
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.159 php-src/ext/interbase/interbase.c:1.160
--- php-src/ext/interbase/interbase.c:1.159 Wed Aug 20 15:47:00 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug 20 18:59:33 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.159 2003/08/20 19:47:00 abies Exp $ */
+/* $Id: interbase.c,v 1.160 2003/08/20 22:59:33 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -502,7 +502,8 @@
 
if (ib_blob-bl_handle != NULL) { /* blob open*/
if (isc_cancel_blob(IB_STATUS, ib_blob-bl_handle)) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, You can lose data. 
Close any blob after reading of writing it. Use ibase_blob_close() before calling 
ibase_close());
+   _php_ibase_module_error(You can lose data. Close any blob 
after  
+   reading from or writing to it. Use ibase_blob_close() 
before calling ibase_close());
}
}
efree(ib_blob);
@@ -682,7 +683,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.159 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.160 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -2500,8 +2501,8 @@
 
 /* {{{ _php_ibase_fetch_hash() */
 
-#define FETCH_ROW  2
-#define FETCH_ARRAY 4
+#define FETCH_ROW  1
+#define FETCH_ARRAY 2
 
 static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
 {
@@ -2570,7 +2571,8 @@
ibase_blob blob_handle;
unsigned long max_len = 0;
static char bl_items[] = 
{isc_info_blob_total_length};
-   char bl_info[20], *p;
+   char bl_info[20];
+   unsigned short i;

blob_handle.bl_handle = NULL;
blob_handle.bl_qd = *(ISC_QUAD ISC_FAR 
*) var-sqldata;
@@ -2586,25 +2588,29 @@
}

/* find total length of blob's data */
-   for (p = bl_info; *p != isc_info_end 
 p  bl_info + sizeof(bl_info);) {
+   for (i = 0; i  sizeof(bl_info); ) {
unsigned short item_len;
-   char item = *p++;
+   char item = bl_info[i++];

-   item_len = (unsigned short) 
isc_vax_integer(p, 2);
-   p += 2;
+   if (item == isc_info_end || 
item == isc_info_truncated || 
+   item == isc_info_error 
|| i = sizeof(bl_info)) {
+
+   
_php_ibase_module_error(Could not determine BLOB size (internal error));
+   RETURN_FALSE;
+   }  
 
+
+   item_len = (unsigned short) 
isc_vax_integer(bl_info[i], 2);
+
if (item == 
isc_info_blob_total_length) {
-   max_len = 
isc_vax_integer(p, item_len);
+   max_len = 
isc_vax_integer(bl_info[i+2], item_len);
break;
}
-   p += item_len;
+   i += item_len+2;
}

if (max_len == 0) {
-   _php_ibase_module_error(Could 
not determine BLOB size (internal error));
-   

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-17 Thread Ard Biesheuvel
abies   Sun Aug 17 12:13:52 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fixed leak in _php_ibase_bind()
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.150 php-src/ext/interbase/interbase.c:1.151
--- php-src/ext/interbase/interbase.c:1.150 Sun Aug 17 09:16:54 2003
+++ php-src/ext/interbase/interbase.c   Sun Aug 17 12:13:52 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.150 2003/08/17 13:16:54 abies Exp $ */
+/* $Id: interbase.c,v 1.151 2003/08/17 16:13:52 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -262,6 +262,7 @@
 #endif
} val;
short sqlind;
+   void *allocated;
 } BIND_BUF;
 
 /* get blob identifier from argument
@@ -699,7 +700,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.150 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.151 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1319,6 +1320,7 @@
for (i = 0; i  sqlda-sqld; var++, i++) { /* bound vars */

buf[i].sqlind = 0;
+   buf[i].allocated = NULL;
var-sqlind = buf[i].sqlind;
b_var = b_vars[i];

@@ -1462,40 +1464,35 @@
 #endif
break;
case SQL_BLOB:
-   {
-   ibase_blob_handle *ib_blob_id;
+   if (Z_TYPE_P(b_var) != IS_STRING || Z_STRLEN_P(b_var) 
!= sizeof(ibase_blob_handle) || 
+  ((ibase_blob_handle 
*)(Z_STRVAL_P(b_var)))-bl_handle != 0) {
 
-   if (Z_TYPE_P(b_var) != IS_STRING || 
Z_STRLEN_P(b_var) != sizeof(ibase_blob_handle) || 
-  ((ibase_blob_handle 
*)(Z_STRVAL_P(b_var)))-bl_handle != 0) {
-   ibase_blob_handle *ib_blob;
-
-   ib_blob = (ibase_blob_handle *) 
emalloc(sizeof(ibase_blob_handle));
-   ib_blob-trans_handle = 
ib_query-trans;
-   ib_blob-link = ib_query-link;
-   ib_blob-bl_handle = NULL;
-   if (isc_create_blob(IB_STATUS, 
ib_blob-link, ib_blob-trans_handle, ib_blob-bl_handle, ib_blob-bl_qd)) {
-   efree(ib_blob);
-   _php_ibase_error(TSRMLS_C);
-   return FAILURE;
-   }
+   ibase_blob_handle ib_blob;
 
-   if (_php_ibase_blob_add(b_var, 
ib_blob TSRMLS_CC) != SUCCESS) {
-   efree(ib_blob);
-   return FAILURE;
-   }
-   
-   if (isc_close_blob(IB_STATUS, 
ib_blob-bl_handle)) {
-   _php_ibase_error(TSRMLS_C);
-   efree(ib_blob);
-   return FAILURE;
-   }
-   ib_blob_id = ib_blob;
-   } else {
-   ib_blob_id = (ibase_blob_handle *) 
Z_STRVAL_P(b_var);
+   ib_blob.trans_handle = ib_query-trans-handle;
+   ib_blob.link = ib_query-link-handle;
+   ib_blob.bl_handle = NULL;
+
+   if (isc_create_blob(IB_STATUS, ib_blob.link, 
ib_blob.trans_handle, ib_blob.bl_handle, ib_blob.bl_qd)) {
+   _php_ibase_error(TSRMLS_C);
+   return FAILURE;
+   }
+
+   if (_php_ibase_blob_add(b_var, ib_blob 
TSRMLS_CC) != SUCCESS) {
+   return FAILURE;
}
-   var-sqldata = (void ISC_FAR *) 
ib_blob_id-bl_qd;
+   
+   

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-17 Thread Ard Biesheuvel
abies   Sun Aug 17 12:30:15 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Simplify previous fix
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.151 php-src/ext/interbase/interbase.c:1.152
--- php-src/ext/interbase/interbase.c:1.151 Sun Aug 17 12:13:52 2003
+++ php-src/ext/interbase/interbase.c   Sun Aug 17 12:30:15 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.151 2003/08/17 16:13:52 abies Exp $ */
+/* $Id: interbase.c,v 1.152 2003/08/17 16:30:15 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -262,7 +262,6 @@
 #endif
} val;
short sqlind;
-   void *allocated;
 } BIND_BUF;
 
 /* get blob identifier from argument
@@ -700,7 +699,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.151 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.152 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1320,7 +1319,6 @@
for (i = 0; i  sqlda-sqld; var++, i++) { /* bound vars */

buf[i].sqlind = 0;
-   buf[i].allocated = NULL;
var-sqlind = buf[i].sqlind;
b_var = b_vars[i];

@@ -1486,8 +1484,8 @@
_php_ibase_error(TSRMLS_C);
return FAILURE;
}
-   buf[i].allocated = var-sqldata = (void 
ISC_FAR *) emalloc(sizeof(ISC_QUAD));
-   *(ISC_QUAD ISC_FAR *) var-sqldata = 
ib_blob.bl_qd;
+   buf[i].val.qval = ib_blob.bl_qd;
+   var-sqldata = (void ISC_FAR *) 
buf[i].val.qval;

} else {
var-sqldata = (void ISC_FAR *) 
((ibase_blob_handle *) Z_STRVAL_P(b_var))-bl_qd;
@@ -1727,17 +1725,8 @@
if (in_sqlda) {
efree(in_sqlda);
}
-   if (bind_buf) {
-   int i;
-
-   /* free memory allocated in binding stage */
-   for (i = 0; i  ib_query-in_sqlda-sqld; ++i) {
-   if (bind_buf[i].allocated != NULL) {
-   efree(bind_buf[i].allocated);
-   }
-   }
+   if (bind_buf)
efree(bind_buf);
-   }
 
if (rv == FAILURE) {
if (IB_RESULT) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-17 Thread Ard Biesheuvel
abies   Sun Aug 17 20:14:53 2003 EDT

  Modified files:  
/php-src/ext/interbase  php_interbase.h interbase.c 
  Log:
  Nuke bogus BLOB ids
  # User-space BLOB id no longer contains transaction handle, so BLOB ids
  # now remain valid throughout multiple transactions.
  # Oh, and they look better too :-)
  
  Index: php-src/ext/interbase/php_interbase.h
diff -u php-src/ext/interbase/php_interbase.h:1.52 
php-src/ext/interbase/php_interbase.h:1.53
--- php-src/ext/interbase/php_interbase.h:1.52  Sat Aug 16 11:31:06 2003
+++ php-src/ext/interbase/php_interbase.h   Sun Aug 17 20:14:53 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: php_interbase.h,v 1.52 2003/08/16 15:31:06 abies Exp $ */
+/* $Id: php_interbase.h,v 1.53 2003/08/18 00:14:53 abies Exp $ */
 
 #ifndef PHP_INTERBASE_H
 #define PHP_INTERBASE_H
@@ -114,6 +114,7 @@
char *cfg_timeformat;
char errmsg[MAX_ERRMSG];
long sql_code;
+   HashTable blob_table;
 ZEND_END_MODULE_GLOBALS(ibase)
 
 typedef struct {
@@ -142,10 +143,10 @@
 } ibase_array;
 
 typedef struct {
-   isc_tr_handle trans_handle; 
-   isc_db_handle link;
-   ISC_QUAD bl_qd;
+   ibase_db_link *link;
isc_blob_handle bl_handle;
+   ISC_QUAD bl_qd;
+   unsigned short type;
 } ibase_blob_handle;
 
 typedef struct {
@@ -164,8 +165,8 @@
 } ibase_query;
 
 typedef struct {
-   isc_db_handle link; /* db link for this result */
-   isc_tr_handle trans;
+   ibase_db_link *link;
+   ibase_trans *trans;
isc_stmt_handle stmt;
int drop_stmt;
XSQLDA *out_sqlda;
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.152 php-src/ext/interbase/interbase.c:1.153
--- php-src/ext/interbase/interbase.c:1.152 Sun Aug 17 12:30:15 2003
+++ php-src/ext/interbase/interbase.c   Sun Aug 17 20:14:53 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.152 2003/08/17 16:30:15 abies Exp $ */
+/* $Id: interbase.c,v 1.153 2003/08/18 00:14:53 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -51,6 +51,9 @@
 
 #define SAFE_STRING(s) ((s)?(s):)
 
+#define BLOB_ID_LEN 18
+#define BLOB_ID_MASK 0x%08lx%08lx
+
 /* {{{ extension definition structures */
 function_entry ibase_functions[] = {
PHP_FE(ibase_connect, NULL)
@@ -264,24 +267,6 @@
short sqlind;
 } BIND_BUF;
 
-/* get blob identifier from argument
- * on empty unset argument ib_blob set to NULL
- */
-static int _php_ibase_get_blob_id(zval **blob_arg, ibase_blob_handle **ib_blob)
-{
-   if (Z_TYPE_PP(blob_arg) == IS_STRING  Z_STRLEN_PP(blob_arg) == 0) {
-   *ib_blob = NULL;
-   } else if (Z_TYPE_PP(blob_arg) != IS_STRING
-|| Z_STRLEN_PP(blob_arg) != sizeof(ibase_blob_handle)
-|| ((ibase_blob_handle *)(Z_STRVAL_PP(blob_arg)))-bl_handle 
!= 0) {
-
-   _php_ibase_module_error(Invalid blob id);
-   return FAILURE;
-   } else {
-   *ib_blob = (ibase_blob_handle *)Z_STRVAL_PP(blob_arg);
-   }
-   return SUCCESS;
-}
 
 /* get blob handle from argument
  * note: blob already open when handle active
@@ -582,7 +567,6 @@
}
_php_ibase_event_free(event-event_buffer,event-result_buffer);
 }
-   
 /* }}} */
 
 /* {{{ startup, shutdown and info functions */
@@ -664,6 +648,8 @@
 
RESET_ERRMSG;
 
+   zend_hash_init(IBG(blob_table), 0, NULL, NULL, 0);
+
return SUCCESS;
 }
 
@@ -690,6 +676,8 @@
}
IBG(timeformat) = NULL;
 
+   zend_hash_destroy(IBG(blob_table));
+   
return SUCCESS;
 } 
  
@@ -699,7 +687,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.152 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.153 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -864,15 +852,15 @@
int open_new_connection = 1;

if (zend_hash_find(EG(persistent_list), hashed_details, 
hashed_details_length + 1, (void **) le) != FAILURE) {
-   char tmp_1[] = {isc_info_base_level, isc_info_end};
-   char tmp_2[8]; /* Enough? Hope so... */ 
+   static char info[] = {isc_info_base_level, isc_info_end};
+   char result[8]; /* Enough? Hope so... */ 
 
if (Z_TYPE_P(le) != le_plink) {
RETURN_FALSE;
}
/* Check if connection has timed out */
ib_link = (ibase_db_link *) le-ptr;
-   if (!isc_database_info(IB_STATUS, ib_link-handle, 
sizeof(tmp_1), 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-16 Thread Ard Biesheuvel
abies   Sat Aug 16 11:30:25 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fixed bug #24224
  Some general cleaning up
  Some preliminary changes for extensions to array functions
  
  Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.145 php-src/ext/interbase/interbase.c:1.146
--- php-src/ext/interbase/interbase.c:1.145 Fri Aug 15 21:58:29 2003
+++ php-src/ext/interbase/interbase.c   Sat Aug 16 11:30:22 2003
@@ -18,64 +18,28 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.145 2003/08/16 01:58:29 abies Exp $ */
-
-/*
-   Changes:
-   2003-08-05: Ard Biesheuvel [EMAIL PROTECTED]
-   - Significant changes to layout of internal data structures
- in order to accomodate and carry out the following changes:
- * Removal of arbitrary 'transactions-per-link' limit,
- * Transactions over multiple databases.
-   - Leak fixes in ibase_query() and ibase_execute() by replacing
- emalloc() with do_alloca()
-   - Changes to ibase_query() to enable the use of CREATE 
DATABASE ...
-   - Added ibase_drop_db()
-   - Added ibase_commit_ret() and ibase_rollback_ret()
-   - Added ibase_name_result()
-   2001-05-31: Jeremy Bettis [EMAIL PROTECTED]
-   - If a blob handle was expected and something else was
- received create a blob and add the value to it.
-   - If the incoming argument to a bind parameter is NULL
- then store a NULL in the database.
-   - More verbose date errors.
-   1999-09-21: Ivo Panacek [EMAIL PROTECTED]
-   - added COMPILE_DL section
-   - more verbose php_info_ibase function
- mostly stolen from pgsql.c for now
-   1999-10-05: Ivo Panacek [EMAIL PROTECTED]
-   - safe rinit/rfinish: check for NULL so
- rfinish could be called repeatedly
- emalloc  co. replaced with malloc  co.
-*/
+/* $Id: interbase.c,v 1.146 2003/08/16 15:30:22 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
 #endif
 
 #include php.h
+
+#if HAVE_IBASE
+
 #include php_ini.h
 #include ext/standard/php_standard.h
-#include php_globals.h
 #include php_interbase.h
 
-#if HAVE_IBASE
-#include ibase.h
+#include time.h
 
 #ifndef SQLDA_CURRENT_VERSION
 #define SQLDA_CURRENT_VERSION SQLDA_VERSION1
 #endif
 
-#include time.h
-#include ext/standard/fsock.h
-#include ext/standard/info.h
-
-#ifdef SQL_INT64
-#include math.h
-#endif
-
 #ifndef SQL_DIALECT_CURRENT
-#define SQL_DIALECT_CURRENT 1
+#define SQL_DIALECT_CURRENT SQL_DIALECT_V5
 #endif
 
 #ifdef ZEND_DEBUG
@@ -239,7 +203,9 @@
/* vsnprintf NUL terminates the buf and writes at most n-1 chars+NUL */
vsnprintf(IBG(errmsg), MAX_ERRMSG, msg, ap);
va_end(ap);
-   
+
+   IBG(sql_code) = -999; /* no SQL error */
+
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, IBG(errmsg));
 }
 /* }}} */
@@ -655,7 +621,9 @@
le_event = zend_register_list_destructors_ex(_php_ibase_free_event, NULL, 
interbase event, module_number);
 
REGISTER_LONG_CONSTANT(IBASE_DEFAULT, PHP_IBASE_DEFAULT, CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(IBASE_TEXT, PHP_IBASE_TEXT, CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(IBASE_TEXT, PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); 
/* deprecated, for BC only */
+   REGISTER_LONG_CONSTANT(IBASE_FETCH_BLOBS, PHP_IBASE_FETCH_BLOBS, 
CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(IBASE_FETCH_ARRAYS, PHP_IBASE_FETCH_ARRAYS, 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(IBASE_UNIXTIME, PHP_IBASE_UNIXTIME, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(IBASE_TIMESTAMP, PHP_IBASE_TIMESTAMP, 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(IBASE_DATE, PHP_IBASE_DATE, CONST_PERSISTENT);
@@ -731,7 +699,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.145 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.146 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1274,11 +1242,11 @@
}

/* allocate arrays... */
-   if (_php_ibase_alloc_array(IB_QUERY-in_array, IB_QUERY-in_array_cnt, 
IB_QUERY-in_sqlda, link, trans TSRMLS_CC) == FAILURE) {
+   if (_php_ibase_alloc_array(IB_QUERY-in_array, IB_QUERY-in_array_cnt, 
IB_QUERY-in_sqlda, link-handle, trans-handle TSRMLS_CC) == FAILURE) {
goto _php_ibase_alloc_query_error; /* error 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-16 Thread Ard Biesheuvel
abies   Sat Aug 16 12:09:24 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fixed bug #18744
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.146 php-src/ext/interbase/interbase.c:1.147
--- php-src/ext/interbase/interbase.c:1.146 Sat Aug 16 11:30:22 2003
+++ php-src/ext/interbase/interbase.c   Sat Aug 16 12:09:24 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.146 2003/08/16 15:30:22 abies Exp $ */
+/* $Id: interbase.c,v 1.147 2003/08/16 16:09:24 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -699,7 +699,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.146 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.147 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -3347,6 +3347,8 @@
 {
zval **blob_arg, **string_arg;
ibase_blob_handle *ib_blob;
+   unsigned long put_cnt = 0, rem_cnt;
+   unsigned short chunk_size;
 
RESET_ERRMSG;
 
@@ -3360,9 +3362,15 @@

convert_to_string_ex(string_arg);
 
-   if (isc_put_segment(IB_STATUS, ib_blob-bl_handle, (unsigned short) 
Z_STRLEN_PP(string_arg), Z_STRVAL_PP(string_arg))) {
-   _php_ibase_error(TSRMLS_C);
-   RETURN_FALSE;
+   for (rem_cnt = Z_STRLEN_PP(string_arg); rem_cnt  0; rem_cnt -= chunk_size)  {
+   
+   chunk_size = rem_cnt  USHRT_MAX ? USHRT_MAX : rem_cnt;
+
+   if (isc_put_segment(IB_STATUS, ib_blob-bl_handle, chunk_size, 
Z_STRVAL_PP(string_arg)[put_cnt] )) {
+   _php_ibase_error(TSRMLS_C);
+   RETURN_FALSE;
+   }
+   put_cnt += chunk_size;
}
RETURN_TRUE;
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-16 Thread Jani Taskinen

Do NOT mix fixes with code cleanup. Do separate commits.
And second, merge any fixes to PHP_4_3 branch. If you don't 
merge for some reason, do NOT close bugs reported for PHP 4
without saying the fix is only going to be in PHP 5..

--Jani



On Sat, 16 Aug 2003, Ard Biesheuvel wrote:

abies  Sat Aug 16 11:30:25 2003 EDT

  Modified files:  
/php-src/ext/interbase interbase.c 
  Log:
  Fixed bug #24224
  Some general cleaning up
  Some preliminary changes for extensions to array functions
  
  


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-16 Thread Ard Biesheuvel
abies   Sat Aug 16 15:48:32 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Always fill entire buffer in ibase_blob_get()
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.147 php-src/ext/interbase/interbase.c:1.148
--- php-src/ext/interbase/interbase.c:1.147 Sat Aug 16 12:09:24 2003
+++ php-src/ext/interbase/interbase.c   Sat Aug 16 15:48:32 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.147 2003/08/16 16:09:24 abies Exp $ */
+/* $Id: interbase.c,v 1.148 2003/08/16 19:48:32 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -699,7 +699,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.147 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.148 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -3364,7 +3364,7 @@
 
for (rem_cnt = Z_STRLEN_PP(string_arg); rem_cnt  0; rem_cnt -= chunk_size)  {

-   chunk_size = rem_cnt  USHRT_MAX ? USHRT_MAX : rem_cnt;
+   chunk_size = rem_cnt  USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt;
 
if (isc_put_segment(IB_STATUS, ib_blob-bl_handle, chunk_size, 
Z_STRVAL_PP(string_arg)[put_cnt] )) {
_php_ibase_error(TSRMLS_C);
@@ -3381,9 +3381,8 @@
 PHP_FUNCTION(ibase_blob_get)
 {
zval **blob_arg, **len_arg;
-   int stat;
+   ISC_STATUS stat;
char *bl_data;
-   unsigned short seg_len;
unsigned long max_len, cur_len;
ibase_blob_handle *ib_blob;
 
@@ -3404,20 +3403,20 @@

bl_data = emalloc(max_len + 1);
 
-   for (cur_len = stat = 0; stat == 0;) {
-   unsigned short next_chunk_size = (max_len-cur_len)  USHRT_MAX 
? USHRT_MAX : (max_len-cur_len);
+   for (cur_len = stat = 0; stat == 0 || stat == isc_segment;  ) {
+   unsigned short seg_len, chunk_size = (max_len-cur_len)  
USHRT_MAX ? USHRT_MAX : (unsigned short)(max_len-cur_len);
+
+   stat = isc_get_segment(IB_STATUS, ib_blob-bl_handle, 
seg_len, chunk_size, bl_data[cur_len]); 
 
-   stat = isc_get_segment(IB_STATUS, ib_blob-bl_handle, 
seg_len, next_chunk_size, bl_data[cur_len]);
cur_len += seg_len;
-   if (cur_len  max_len) { /* never!*/
-   efree(bl_data);
-   _php_ibase_module_error(PHP module internal error);
-   RETURN_FALSE;
+   
+   if (cur_len == max_len) {
+   break;
}
}
 
bl_data[cur_len] = '\0';
-   if (IB_STATUS[0]  (IB_STATUS[1] != isc_segstr_eof  IB_STATUS[1] != 
isc_segment)) {
+   if (IB_STATUS[0] == 1  (stat != 0  stat != isc_segstr_eof  stat 
!= isc_segment)) {
efree(bl_data);
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-15 Thread Ard Biesheuvel
abies   Fri Aug 15 12:13:52 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Added ibase_free_event_handler()
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.142 php-src/ext/interbase/interbase.c:1.143
--- php-src/ext/interbase/interbase.c:1.142 Thu Aug 14 20:16:58 2003
+++ php-src/ext/interbase/interbase.c   Fri Aug 15 12:13:51 2003
@@ -14,10 +14,11 @@
+--+
| Authors: Jouni Ahto [EMAIL PROTECTED]|
|  Andrew Avdeev [EMAIL PROTECTED]  |
+   |  Ard Biesheuvel [EMAIL PROTECTED]  |
+--+
  */
 
-/* $Id: interbase.c,v 1.142 2003/08/15 00:16:58 abies Exp $ */
+/* $Id: interbase.c,v 1.143 2003/08/15 16:13:51 abies Exp $ */
 
 /*
Changes:
@@ -137,6 +138,7 @@
 #endif
PHP_FE(ibase_wait_event, NULL)
PHP_FE(ibase_set_event_handler, NULL)
+   PHP_FE(ibase_free_event_handler, NULL)
{NULL, NULL, NULL}
 };
 
@@ -725,7 +727,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.142 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.143 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -3965,16 +3967,13 @@
}
}   
 
-   Z_TYPE(return_value) = IS_BOOL;
-   Z_BVAL(return_value) = 1;
-
/* call the callback provided by the user */
if (SUCCESS != call_user_function(EG(function_table), NULL, 
event-callback, return_value, 2, args TSRMLS_CC)) {
_php_ibase_module_error(Error calling callback %s, 
Z_STRVAL_P(event-callback));
return 0;
}
 
-   if (! Z_BVAL(return_value)) {
+   if (Z_TYPE(return_value) == IS_BOOL  !Z_BVAL(return_value)) {
return 0;
}   
}
@@ -4042,7 +4041,7 @@
}   

/* get the callback */
-   if (!zend_is_callable(*args[i-1], 0, callback_name)) {
+   if (!zend_is_callable(*cb_arg, 0, callback_name)) {
_php_ibase_module_error(Callback argument %s is not a callable 
function, callback_name);
efree(callback_name);
efree(args);
@@ -4088,7 +4087,24 @@
ZEND_REGISTER_RESOURCE(return_value, event, le_event);
zend_list_addref(Z_LVAL_P(return_value));
 }
-   
+
+/* {{{ proto bool ibase_free_vevent_handler(resource event)
+   Frees the event handler set by ibase_set_event_handler() */
+PHP_FUNCTION(ibase_free_event_handler)
+{
+   zval **event_arg;
+   ibase_event *event;
+   
+   RESET_ERRMSG;
+   
+   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, event_arg) == FAILURE) {
+   WRONG_PARAM_COUNT;
+   }
+
+   ZEND_FETCH_RESOURCE(event, ibase_event *, event_arg, -1, Interbase event, 
le_event);
+   zend_list_delete(Z_LVAL_PP(event_arg));
+   RETURN_TRUE;
+}  
 /* }}} */
   
 #endif /* HAVE_IBASE */
Index: php-src/ext/interbase/php_interbase.h
diff -u php-src/ext/interbase/php_interbase.h:1.49 
php-src/ext/interbase/php_interbase.h:1.50
--- php-src/ext/interbase/php_interbase.h:1.49  Thu Aug 14 20:06:07 2003
+++ php-src/ext/interbase/php_interbase.h   Fri Aug 15 12:13:51 2003
@@ -14,10 +14,11 @@
+--+
| Authors: Jouni Ahto [EMAIL PROTECTED]|
|  Andrew Avdeev [EMAIL PROTECTED]   |
+   |  Ard Biesheuvel [EMAIL PROTECTED]  |
+--+
  */
 
-/* $Id: php_interbase.h,v 1.49 2003/08/15 00:06:07 abies Exp $ */
+/* $Id: php_interbase.h,v 1.50 2003/08/15 16:13:51 abies Exp $ */
 
 #ifndef PHP_INTERBASE_H
 #define PHP_INTERBASE_H
@@ -92,6 +93,7 @@
 
 PHP_FUNCTION(ibase_wait_event);
 PHP_FUNCTION(ibase_set_event_handler);
+PHP_FUNCTION(ibase_free_event_handler);
 
 #define IBASE_MSGSIZE 256
 #define MAX_ERRMSG (IBASE_MSGSIZE*2)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-15 Thread Ard Biesheuvel
abies   Fri Aug 15 20:58:24 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Added comment about ibase_num_rows()
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.143 php-src/ext/interbase/interbase.c:1.144
--- php-src/ext/interbase/interbase.c:1.143 Fri Aug 15 12:13:51 2003
+++ php-src/ext/interbase/interbase.c   Fri Aug 15 20:58:24 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.143 2003/08/15 16:13:51 abies Exp $ */
+/* $Id: interbase.c,v 1.144 2003/08/16 00:58:24 abies Exp $ */
 
 /*
Changes:
@@ -727,7 +727,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.143 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.144 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -2248,20 +2248,30 @@
 }
 /* }}} */
 
-/* {{{ proto ibase_num_rows( resource result_identifier )
-   Returns the number of rows in a result */
+/* {{{ ibase_num_rows( resource result_identifier ) */
 PHP_FUNCTION(ibase_num_rows) 
 {
/**
-* This function relies on the InterBase API function isc_dsql_sql_info()
-* which has a couple of limitations (which I hope will be fixed in
-* future releases of Firebird):
-* - row count is always zero before the first fetch;
-* - row count for SELECT ... FOR UPDATE is broken - never returns a
-*   higher number than the number of records fetched so far;
-* - row count for other statements is merely a lower bound on the number
-*   of records = calling ibase_num_rows() again after a couple of fetches
-*   will most likely return a new (higher) figure for large result sets.
+* PLEASE READ THIS FIRST before adding this function to the main PHP
+* documentation:
+* 
+* As this function relies on the InterBase API function isc_dsql_sql_info()
+* which has a couple of limitations (which I hope will be fixed in future 
+* releases of Firebird), this function is fairly useless. I'm leaving it
+* in place for people who can live with the limitations, which I only 
+* found out about after I had implemented it anyway.
+*
+* Currently, there's no way to determine how many rows can be fetched from
+* a cursor. The only number that _can_ be determined is the number of rows
+* that have already been pre-fetched by the client library. 
+* This implies the following:
+* - num_rows() always returns zero before the first fetch;
+* - num_rows() for SELECT ... FOR UPDATE is broken - never returns a
+*   higher number than the number of records fetched so far (no pre-fetch);
+* - the result of num_rows() for other statements is merely a lower bound 
+* on the number of records = calling ibase_num_rows() again after a couple
+* of fetches will most likely return a new (higher) figure for large result 
+* sets.
 *
 * 12-aug-2003 Ard Biesheuvel
 */
@@ -4088,7 +4098,7 @@
zend_list_addref(Z_LVAL_P(return_value));
 }
 
-/* {{{ proto bool ibase_free_vevent_handler(resource event)
+/* {{{ proto bool ibase_free_event_handler(resource event)
Frees the event handler set by ibase_set_event_handler() */
 PHP_FUNCTION(ibase_free_event_handler)
 {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-15 Thread Jani Taskinen

Why not leave it out then? It's new, it's not (yet) in any release, etc.
If you leave it in, people WILL try to use it and as they DO NOT read
sources in most cases, they will submit bug reports about the function
not working as they expect. (yes, even if it's not documented..)

--Jani


On Sat, 16 Aug 2003, Ard Biesheuvel wrote:

abies  Fri Aug 15 20:58:24 2003 EDT

  Modified files:  
/php-src/ext/interbase interbase.c 
  Log:
  Added comment about ibase_num_rows()
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.143 
php-src/ext/interbase/interbase.c:1.144
--- php-src/ext/interbase/interbase.c:1.143Fri Aug 15 12:13:51 2003
+++ php-src/ext/interbase/interbase.c  Fri Aug 15 20:58:24 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.143 2003/08/15 16:13:51 abies Exp $ */
+/* $Id: interbase.c,v 1.144 2003/08/16 00:58:24 abies Exp $ */
 
 /*
   Changes:
@@ -727,7 +727,7 @@
 
   php_info_print_table_start();
   php_info_print_table_row(2, Interbase Support, enabled);
-  php_info_print_table_row(2, Revision, $Revision: 1.143 $);
+  php_info_print_table_row(2, Revision, $Revision: 1.144 $);
 #ifdef COMPILE_DL_INTERBASE
   php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -2248,20 +2248,30 @@
 }
 /* }}} */
 
-/* {{{ proto ibase_num_rows( resource result_identifier )
-   Returns the number of rows in a result */
+/* {{{ ibase_num_rows( resource result_identifier ) */
 PHP_FUNCTION(ibase_num_rows) 
 {
   /**
-   * This function relies on the InterBase API function isc_dsql_sql_info()
-   * which has a couple of limitations (which I hope will be fixed in
-   * future releases of Firebird):
-   * - row count is always zero before the first fetch;
-   * - row count for SELECT ... FOR UPDATE is broken - never returns a
-   *   higher number than the number of records fetched so far;
-   * - row count for other statements is merely a lower bound on the number
-   *   of records = calling ibase_num_rows() again after a couple of fetches
-   *   will most likely return a new (higher) figure for large result sets.
+   * PLEASE READ THIS FIRST before adding this function to the main PHP
+   * documentation:
+   * 
+   * As this function relies on the InterBase API function isc_dsql_sql_info()
+   * which has a couple of limitations (which I hope will be fixed in future 
+   * releases of Firebird), this function is fairly useless. I'm leaving it
+   * in place for people who can live with the limitations, which I only 
+   * found out about after I had implemented it anyway.
+   *
+   * Currently, there's no way to determine how many rows can be fetched from
+   * a cursor. The only number that _can_ be determined is the number of rows
+   * that have already been pre-fetched by the client library. 
+   * This implies the following:
+   * - num_rows() always returns zero before the first fetch;
+   * - num_rows() for SELECT ... FOR UPDATE is broken - never returns a
+   *   higher number than the number of records fetched so far (no pre-fetch);
+   * - the result of num_rows() for other statements is merely a lower bound 
+   * on the number of records = calling ibase_num_rows() again after a couple
+   * of fetches will most likely return a new (higher) figure for large result 
+   * sets.
*
* 12-aug-2003 Ard Biesheuvel
*/
@@ -4088,7 +4098,7 @@
   zend_list_addref(Z_LVAL_P(return_value));
 }
 
-/* {{{ proto bool ibase_free_vevent_handler(resource event)
+/* {{{ proto bool ibase_free_event_handler(resource event)
Frees the event handler set by ibase_set_event_handler() */
 PHP_FUNCTION(ibase_free_event_handler)
 {





-- 
https://www.paypal.com/xclick/[EMAIL PROTECTED]no_note=1tax=0currency_code=EUR
 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-14 Thread Ard Biesheuvel
abies   Wed Aug  6 11:27:16 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  ibase_query() now returns a link resource if a CREATE DB was issued
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.116 php-src/ext/interbase/interbase.c:1.117
--- php-src/ext/interbase/interbase.c:1.116 Wed Aug  6 08:09:30 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug  6 11:27:16 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.116 2003/08/06 12:09:30 abies Exp $ */
+/* $Id: interbase.c,v 1.117 2003/08/06 15:27:16 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -75,8 +75,8 @@
 #endif
 
 #ifdef ZEND_DEBUG
-/* #define IBDEBUG(a) php_printf(::: %s (%d)\n, a, __LINE__); */
-#define IBDEBUG(a)
+#define IBDEBUG(a) php_printf(::: %s (%d)\n, a, __LINE__);
+/* #define IBDEBUG(a)*/
 #else
 #define IBDEBUG(a)
 #endif
@@ -349,19 +349,22 @@
ibase_tr_list *p = l;
if (p-trans != NULL) {
if (i == 0) {
-   IBDEBUG(Committing default transaction...);
-   if (isc_commit_transaction(IB_STATUS, 
p-trans-handle)) {
-   _php_ibase_error(TSRMLS_C);
+   if (p-trans-handle != NULL) {
+   IBDEBUG(Committing default transaction...);
+   if (isc_commit_transaction(IB_STATUS, 
p-trans-handle)) {
+   _php_ibase_error(TSRMLS_C);
+   }
}
efree(p-trans); /* default transaction is not a 
registered resource: clean up */
}
-   else if (p-trans-handle != NULL) { 
-   /* non-default transaction might have been rolled back 
by other call of this dtor */
-   IBDEBUG(Rolling back other transactions...);
-   if (isc_rollback_transaction(IB_STATUS, 
p-trans-handle)) {
-   _php_ibase_error(TSRMLS_C);
+   else {
+   if (p-trans-handle != NULL) { 
+   /* non-default transaction might have been 
rolled back by other call of this dtor */
+   IBDEBUG(Rolling back other transactions...);
+   if (isc_rollback_transaction(IB_STATUS, 
p-trans-handle)) {
+   _php_ibase_error(TSRMLS_C);
+   }
}
-
/* set this link pointer to NULL in the transaction */
for (j = 0; j  p-trans-link_cnt; ++j) {
if (p-trans-link[j] == link) {
@@ -392,8 +395,8 @@
ibase_db_link *link = (ibase_db_link *) rsrc-ptr;
 
_php_ibase_commit_link(link TSRMLS_CC);
-   IBDEBUG(Closing normal link...);
if (link-link != NULL) {
+   IBDEBUG(Closing normal link...);
isc_detach_database(IB_STATUS, link-link);
}
IBG(num_links)--;
@@ -671,9 +674,9 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.116 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.117 $);
 #ifdef COMPILE_DL_INTERBASE
-   php_info_print_table_row(2, Dynamic Module, yes);
+   php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
php_info_print_table_row(2, Allow Persistent Links, (IBG(allow_persistent) ? 
Yes : No));
 
@@ -908,7 +911,7 @@
}
xlink = (int) index_ptr-ptr;
ptr = zend_list_find(xlink, type);  /* check if the xlink 
is still there */
-   if (ptr  (type == le_link || type == le_plink)) {
+   if (ptr  (type == le_link || type == le_plink)) {
zend_list_addref(xlink);
Z_LVAL_P(return_value) = xlink;
Z_TYPE_P(return_value) = IS_RESOURCE;
@@ -984,6 +987,7 @@
switch (ZEND_NUM_ARGS()) {
case 0:
link_id = IBG(default_link);
+   IBG(default_link) = -1;
break;
case 1:
if (zend_get_parameters_ex(1, link_arg) == FAILURE) {
@@ -1009,6 +1013,7 @@
 {
zval **link_arg = NULL;
ibase_db_link *ib_link;
+   ibase_tr_list *l;
int link_id;

RESET_ERRMSG;
@@ -1016,6 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-14 Thread Ard Biesheuvel
abies   Wed Aug  6 13:51:46 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Added three new user functions
  
  ibase_{commit|rollback}_ret()
  Commit or rollback a transaction without losing the transaction context.
  
  ibase_name_result()
  Assign a name to a result so {UPDATE|DELETE} ... WHERE CURRENT OF name
  statements can be used.
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.117 php-src/ext/interbase/interbase.c:1.118
--- php-src/ext/interbase/interbase.c:1.117 Wed Aug  6 11:27:16 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug  6 13:51:46 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.117 2003/08/06 15:27:16 abies Exp $ */
+/* $Id: interbase.c,v 1.118 2003/08/06 17:51:46 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -75,8 +75,8 @@
 #endif
 
 #ifdef ZEND_DEBUG
-#define IBDEBUG(a) php_printf(::: %s (%d)\n, a, __LINE__);
-/* #define IBDEBUG(a)*/
+/* #define IBDEBUG(a) php_printf(::: %s (%d)\n, a, __LINE__); */
+#define IBDEBUG(a)
 #else
 #define IBDEBUG(a)
 #endif
@@ -94,6 +94,7 @@
PHP_FE(ibase_fetch_assoc, NULL)
PHP_FE(ibase_fetch_object, NULL)
PHP_FE(ibase_free_result, NULL)
+   PHP_FE(ibase_name_result, NULL)
PHP_FE(ibase_prepare, NULL)
PHP_FE(ibase_execute, NULL)
PHP_FE(ibase_free_query, NULL)
@@ -107,6 +108,8 @@
PHP_FE(ibase_trans, NULL)
PHP_FE(ibase_commit, NULL)
PHP_FE(ibase_rollback, NULL)
+   PHP_FE(ibase_commit_ret, NULL)
+   PHP_FE(ibase_rollback_ret, NULL)
 
PHP_FE(ibase_blob_info, NULL)
PHP_FE(ibase_blob_create, NULL)
@@ -674,7 +677,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.117 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.118 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1767,12 +1770,15 @@
 /* }}} */
 
 /* {{{ _php_ibase_trans_end() */
+#define RETAIN 2
 #define COMMIT 1
 #define ROLLBACK 0
+
 static void _php_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit)
 {
ibase_trans *trans = NULL;
int res_id = 0;
+   ISC_STATUS result;
 
RESET_ERRMSG;
 
@@ -1802,20 +1808,29 @@
break;
}
 
-   if (commit) {
-   if (isc_commit_transaction(IB_STATUS, trans-handle)) {
-   _php_ibase_error(TSRMLS_C);
-   RETURN_FALSE;
-   }
-   } else {
-   if (isc_rollback_transaction(IB_STATUS, trans-handle)) {
-   _php_ibase_error(TSRMLS_C);
-   RETURN_FALSE;
-   }
+   switch (commit) {
+   
+   case ROLLBACK:
+   result = isc_rollback_transaction(IB_STATUS, trans-handle);
+   break;
+   case COMMIT:
+   result = isc_commit_transaction(IB_STATUS, trans-handle);
+   break;
+   case (ROLLBACK | RETAIN):
+   result = isc_rollback_retaining(IB_STATUS, trans-handle);
+   break;
+   case (COMMIT | RETAIN):
+   result = isc_commit_retaining(IB_STATUS, trans-handle);
+   break;
}

+   if (result) {
+   _php_ibase_error(TSRMLS_C);
+   RETURN_FALSE;
+   }
+
/* Don't try to destroy implicitly opened transaction from list... */
-   if (res_id != 0) {
+   if ( (commit  RETAIN) == 0  res_id != 0) {
zend_list_delete(res_id);
}
RETURN_TRUE;
@@ -1838,6 +1853,22 @@
 }
 /* }}} */
 
+/* {{{ proto bool ibase_commit_ret( resource link_identifier )
+   Commit transaction and retain the transaction context */
+PHP_FUNCTION(ibase_commit_ret)
+{
+   _php_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, COMMIT | RETAIN);
+}
+/* }}} */
+
+/* {{{ proto bool ibase_rollback_ret( resource link_identifier )
+   Rollback transaction and retain the transaction context */
+PHP_FUNCTION(ibase_rollback_ret)
+{
+   _php_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, ROLLBACK | RETAIN);
+}
+/* }}} */
+
 /* {{{ proto resource ibase_query([resource link_identifier [, string query [, int 
bind_args]]])
Execute a query */
 PHP_FUNCTION(ibase_query)
@@ -2437,6 +2468,32 @@
 }
 /* }}} */
 
+
+/* {{{ proto bool ibase_name_result(resource result, string name)
+   Assign a name to a result for use with ... WHERE CURRENT OF name statements */
+PHP_FUNCTION(ibase_name_result)
+{
+   zval **result_arg, **name_arg;
+   ibase_result *ib_result;
+
+   RESET_ERRMSG;
+   
+   if (ZEND_NUM_ARGS() != 2 || 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-14 Thread Ard Biesheuvel
abies   Sun Aug 10 12:21:27 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Added ibase_affected_rows() and ibase_num_rows()
  Fix for ibase_fetch_*() error after exhaustion of result 
  @- Added ibase_affected_row() (Ard)
  @- Added ibase_num_rows() (Ard) 
  
  Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.124 php-src/ext/interbase/interbase.c:1.125
--- php-src/ext/interbase/interbase.c:1.124 Sun Aug 10 09:20:38 2003
+++ php-src/ext/interbase/interbase.c   Sun Aug 10 12:21:26 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.124 2003/08/10 13:20:38 abies Exp $ */
+/* $Id: interbase.c,v 1.125 2003/08/10 16:21:26 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -105,6 +105,8 @@
 #endif
 
PHP_FE(ibase_num_fields, NULL)
+   PHP_FE(ibase_num_rows, NULL)
+   PHP_FE(ibase_affected_rows, NULL)
PHP_FE(ibase_field_info, NULL)
 
PHP_FE(ibase_trans, NULL)
@@ -681,7 +683,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.124 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.125 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1717,6 +1719,7 @@
ib_trans = (ibase_trans *) emalloc(sizeof(ibase_trans) + 
(link_cnt-1)*sizeof(ibase_db_link *));
ib_trans-handle = tr_handle;
ib_trans-link_cnt = link_cnt;
+   ib_trans-affected_rows = 0;
for (i = 0; i  link_cnt; ++i) {
ibase_tr_list **l;
ib_trans-db_link[i] = ib_link[i];
@@ -1762,6 +1765,7 @@
tr = (ibase_trans *) emalloc(sizeof(ibase_trans));
tr-handle = NULL;
tr-link_cnt = 1;
+   tr-affected_rows = 0;
tr-db_link[0] = ib_link;
ib_link-tr_list-trans = tr;
}
@@ -1893,13 +1897,30 @@
 }
 /* }}} */
 
+/* {{{ _php_ibase_do_fetch() */
+
+static void _php_ibase_do_fetch(ibase_result *ib_result)
+{
+   if (ib_result-has_more_rows) {
+   if (isc_dsql_fetch(IB_STATUS, ib_result-stmt, 1, 
ib_result-out_sqlda) == 100L) {
+   ib_result-has_more_rows = 0;
+   }
+   
+   if (IB_STATUS[0]  IB_STATUS[1]) { /* error in fetch */
+   _php_ibase_error(TSRMLS_C);
+   }
+   }
+}  
+   
+/* }}} */
+
 /* {{{ proto resource ibase_query([resource link_identifier [, resource 
link_identifier ] ,] string query [, int bind_args])
Execute a query */
 PHP_FUNCTION(ibase_query)
 {
zval ***args, **bind_args = NULL;
int i, bind_n = 0, trans_id = 0;
-   char *query, item_type[] = {isc_info_sql_stmt_type}, result[8];
+   char *query, info_type[] = {isc_info_sql_stmt_type}, info_count[] = {'\0'}, 
result[64];
ibase_db_link *ib_link = NULL;
ibase_trans *trans = NULL;
ibase_query *ib_query;
@@ -2028,8 +2049,9 @@
}

/* find out if what kind of statement was prepared */
-   if (isc_dsql_sql_info(IB_STATUS, ib_query-stmt, sizeof(item_type), 
item_type, sizeof(result), result)) {
+   if (isc_dsql_sql_info(IB_STATUS, ib_query-stmt, sizeof(info_type), 
info_type, sizeof(result), result)) {
_php_ibase_error(TSRMLS_C);
+   free_alloca(args);
RETURN_FALSE;
}
 
@@ -2052,6 +2074,7 @@
trans = (ibase_trans *) emalloc(sizeof(ibase_trans));
trans-handle = tr;
trans-link_cnt = 1;
+   trans-affected_rows = 0;
trans-db_link[0] = ib_link;

if (ib_link-tr_list == NULL) {
@@ -2088,6 +2111,12 @@
}
break;
 
+   case isc_info_sql_stmt_insert:
+   case isc_info_sql_stmt_update:
+   case isc_info_sql_stmt_delete:
+   /* in these cases, we will want to know the number of affected 
rows */
+   info_count[0] = isc_info_sql_records;
+
default:
 
if (_php_ibase_exec(ib_result, ib_query, bind_n, bind_args 
TSRMLS_CC) == FAILURE) {
@@ -2095,14 +2124,40 @@
free_alloca(args);
RETURN_FALSE;
}
+   
+   trans-affected_rows = 0;
+   
+   if (info_count[0]) {
+   
+   if (isc_dsql_sql_info(IB_STATUS, ib_query-stmt, 
sizeof(info_count), info_count, sizeof(result), 

Re: [PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-14 Thread Allowee
On Tuesday 12 August 2003 20:21, Jani Taskinen wrote:
 And please MFH this fix (to PHP_4_3 branch).

Maybe it's a good idea to tell Ard how to commit to branches...

.: Allowee

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-14 Thread Ard Biesheuvel
abies   Wed Aug  6 20:00:20 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  KR cosmetics
  
  # Summary of the changes in recent revisions for the NEWS file
  @- Changes to Interbase extension: (Ard)
  @  . Support in ibase_trans() for multiple databases
  @  . New functions ibase_commit_ret() and ibase_rollback_ret(), which retain
  @the transaction context after execution
  @  . Support in ibase_query() for CREATE DATABASE statements
  @  . New function ibase_drop_db()
  @  . New function ibase_name_result(), which assigns a name to a result for use
  @with SELECT ... FOR UPDATE statements
  
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.118 php-src/ext/interbase/interbase.c:1.119
--- php-src/ext/interbase/interbase.c:1.118 Wed Aug  6 13:51:46 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug  6 20:00:19 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.118 2003/08/06 17:51:46 abies Exp $ */
+/* $Id: interbase.c,v 1.119 2003/08/07 00:00:19 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -529,7 +529,7 @@
 /* {{{ _php_ibase_free_trans() */
 static void _php_ibase_free_trans(zend_rsrc_list_entry *rsrc TSRMLS_DC)
 {
-   ibase_trans *trans = (ibase_trans*)rsrc-ptr;
+   ibase_trans *trans = (ibase_trans *)rsrc-ptr;
int i;

IBDEBUG(Cleaning up transaction resource...);
@@ -677,7 +677,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.118 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.119 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1611,13 +1611,13 @@
argn = ZEND_NUM_ARGS();
 
/* (1+argn) is an upper bound for the number of links this trans connects to */
-   ib_link = (ibase_db_link**)do_alloca(sizeof(ibase_db_link*) * (1+argn));
+   ib_link = (ibase_db_link **) do_alloca(sizeof(ibase_db_link *) * (1+argn));

if (argn  0) {
long trans_argl = 0;
char *tpb;
ISC_TEB *teb;
-   zval ***args = (zval ***)do_alloca(sizeof(zval **) * argn);
+   zval ***args = (zval ***) do_alloca(sizeof(zval **) * argn);
 
if (zend_get_parameters_array_ex(argn, args) == FAILURE) {
free_alloca(args);
@@ -1625,8 +1625,8 @@
RETURN_FALSE;
}
 
-   teb = (ISC_TEB*)do_alloca(sizeof(ISC_TEB) * argn);
-   tpb = (char*)do_alloca(TPB_MAX_SIZE * argn);
+   teb = (ISC_TEB *) do_alloca(sizeof(ISC_TEB) * argn);
+   tpb = (char *) do_alloca(TPB_MAX_SIZE * argn);
 
/* enumerate all the arguments: assume every non-resource argument 
   specifies modifiers for the link ids that follow it */
@@ -1710,7 +1710,7 @@
}
 
/* register the transaction in our own data structures */
-   ib_trans = (ibase_trans *) emalloc(sizeof(ibase_trans) + 
(link_cnt-1)*sizeof(ibase_db_link*));
+   ib_trans = (ibase_trans *) emalloc(sizeof(ibase_trans) + 
(link_cnt-1)*sizeof(ibase_db_link *));
ib_trans-handle = tr_handle;
ib_trans-link_cnt = link_cnt;
for (i = 0; i  link_cnt; ++i) {
@@ -1719,14 +1719,14 @@

/* the first item in the connection-transaction list is reserved for 
the default transaction */
if (ib_link[i]-trans == NULL) {
-   ib_link[i]-trans = 
(ibase_tr_list*)emalloc(sizeof(ibase_tr_list));
+   ib_link[i]-trans = (ibase_tr_list *) 
emalloc(sizeof(ibase_tr_list));
ib_link[i]-trans-trans = NULL;
ib_link[i]-trans-next = NULL;
}
 
/* link the transaction into the connection-transaction list */
for (l = ib_link[i]-trans; *l != NULL; l = (*l)-next);
-   *l = (ibase_tr_list*) emalloc(sizeof(ibase_tr_list));
+   *l = (ibase_tr_list *) emalloc(sizeof(ibase_tr_list));
(*l)-trans = ib_trans;
(*l)-next = NULL;
}
@@ -1746,14 +1746,14 @@
 
/* the first item in the connection-transaction list is reserved for the 
default transaction */
if (ib_link-trans == NULL) {
-   ib_link-trans = (ibase_tr_list*)emalloc(sizeof(ibase_tr_list));
+   ib_link-trans = (ibase_tr_list *) emalloc(sizeof(ibase_tr_list));
ib_link-trans-trans = NULL;
ib_link-trans-next = NULL;
}
 
if (*trans == NULL) {
if (ib_link-trans-trans == NULL) {
-   ibase_trans *tr = (ibase_trans*)emalloc(sizeof(ibase_trans));
+

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-14 Thread Jani Taskinen
sniper  Wed Aug 13 06:35:15 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Disable the debugging to prevent the tests from failing.
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.138 php-src/ext/interbase/interbase.c:1.139
--- php-src/ext/interbase/interbase.c:1.138 Tue Aug 12 22:19:14 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug 13 06:35:14 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.138 2003/08/13 02:19:14 abies Exp $ */
+/* $Id: interbase.c,v 1.139 2003/08/13 10:35:14 sniper Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -82,8 +82,8 @@
 #endif
 
 #ifdef ZEND_DEBUG
-#define IBDEBUG(a) php_printf(::: %s (%d)\n, a, __LINE__);
-/* #define IBDEBUG(a) */
+/* #define IBDEBUG(a) php_printf(::: %s (%d)\n, a, __LINE__); */
+#define IBDEBUG(a)
 #else
 #define IBDEBUG(a)
 #endif
@@ -698,7 +698,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.138 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.139 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-14 Thread Ard Biesheuvel
abies   Tue Aug 12 22:19:15 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Allow the use of EXECUTE PROCEDURE statements
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.137 php-src/ext/interbase/interbase.c:1.138
--- php-src/ext/interbase/interbase.c:1.137 Tue Aug 12 14:01:59 2003
+++ php-src/ext/interbase/interbase.c   Tue Aug 12 22:19:14 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.137 2003/08/12 18:01:59 abies Exp $ */
+/* $Id: interbase.c,v 1.138 2003/08/13 02:19:14 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -82,8 +82,8 @@
 #endif
 
 #ifdef ZEND_DEBUG
-/* #define IBDEBUG(a) php_printf(::: %s (%d)\n, a, __LINE__); */
-#define IBDEBUG(a)
+#define IBDEBUG(a) php_printf(::: %s (%d)\n, a, __LINE__);
+/* #define IBDEBUG(a) */
 #else
 #define IBDEBUG(a)
 #endif
@@ -698,7 +698,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.137 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.138 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1554,7 +1554,8 @@
BIND_BUF *bind_buf = NULL;
int rv = FAILURE;
char info_count[] = {isc_info_sql_records}, result[64];
-
+   ISC_STATUS isc_result;
+   
RESET_ERRMSG;
 
if (argc  0  args != NULL) {
@@ -1627,6 +1628,7 @@
IB_RESULT-link = ib_query-link-handle;
IB_RESULT-trans = ib_query-trans-handle;
IB_RESULT-stmt = ib_query-stmt; 
+   IB_RESULT-statement_type = ib_query-statement_type;
IB_RESULT-drop_stmt = 0; /* when free result close but not drop!*/
 
out_sqlda = IB_RESULT-out_sqlda = 
emalloc(XSQLDA_LENGTH(ib_query-out_sqlda-sqld));
@@ -1656,7 +1658,12 @@
}
}
 
-   if (isc_dsql_execute(IB_STATUS, ib_query-trans-handle, ib_query-stmt, 
ib_query-dialect, in_sqlda)) {
+   if (ib_query-statement_type == isc_info_sql_stmt_exec_procedure) {
+   isc_result = isc_dsql_execute2(IB_STATUS, ib_query-trans-handle, 
ib_query-stmt, SQLDA_CURRENT_VERSION, in_sqlda, out_sqlda);
+   } else {
+   isc_result = isc_dsql_execute(IB_STATUS, ib_query-trans-handle, 
ib_query-stmt, SQLDA_CURRENT_VERSION, in_sqlda);
+   }
+   if (isc_result) {
IBDEBUG(Could not execute query);
_php_ibase_error(TSRMLS_C);
goto _php_ibase_exec_error;
@@ -2505,15 +2512,20 @@
RETURN_FALSE;
}
 
-   if (isc_dsql_fetch(IB_STATUS, ib_result-stmt, 1, ib_result-out_sqlda)) {
+   if (ib_result-statement_type != isc_info_sql_stmt_exec_procedure) {
 
-   ib_result-has_more_rows = 0;
-   if (IB_STATUS[0]  IB_STATUS[1]) { /* error in fetch */
-   _php_ibase_error(TSRMLS_C);
+   if (isc_dsql_fetch(IB_STATUS, ib_result-stmt, 1, 
ib_result-out_sqlda)) {
+   
+   ib_result-has_more_rows = 0;
+   if (IB_STATUS[0]  IB_STATUS[1]) { /* error in fetch */
+   _php_ibase_error(TSRMLS_C);
+   }
+   RETURN_FALSE;
}
-   RETURN_FALSE;
-   }
-
+   } else {
+   ib_result-has_more_rows = 0;
+   }   
+   
array_init(return_value);

arr_cnt = 0;
Index: php-src/ext/interbase/php_interbase.h
diff -u php-src/ext/interbase/php_interbase.h:1.46 
php-src/ext/interbase/php_interbase.h:1.47
--- php-src/ext/interbase/php_interbase.h:1.46  Tue Aug 12 14:08:13 2003
+++ php-src/ext/interbase/php_interbase.h   Tue Aug 12 22:19:14 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: php_interbase.h,v 1.46 2003/08/12 18:08:13 abies Exp $ */
+/* $Id: php_interbase.h,v 1.47 2003/08/13 02:19:14 abies Exp $ */
 
 #ifndef PHP_INTERBASE_H
 #define PHP_INTERBASE_H
@@ -166,6 +166,7 @@
XSQLDA *out_sqlda;
ibase_array *out_array;
unsigned char has_more_rows;
+   char statement_type;
 } ibase_result;
 
 typedef struct _php_ibase_varchar {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-14 Thread Jani Taskinen

And please MFH this fix (to PHP_4_3 branch).

--Jani


On Tue, 12 Aug 2003, Ard Biesheuvel wrote:

abies  Tue Aug 12 14:02:00 2003 EDT

  Modified files:  
/php-src/ext/interbase php_interbase.h interbase.c 
  Log:
  Re-commit of failed patch 
  
  


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-14 Thread Ard Biesheuvel
abies   Tue Aug  5 19:40:30 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Changed ibase_trans() to allow multi-DB transactions with distinct 
  trans_args for each connection.
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.114 php-src/ext/interbase/interbase.c:1.115
--- php-src/ext/interbase/interbase.c:1.114 Tue Aug  5 12:30:47 2003
+++ php-src/ext/interbase/interbase.c   Tue Aug  5 19:40:30 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.114 2003/08/05 16:30:47 sniper Exp $ */
+/* $Id: interbase.c,v 1.115 2003/08/05 23:40:30 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -670,7 +670,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.114 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.115 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, yes);
 #endif
@@ -974,7 +974,7 @@
Close an InterBase connection */
 PHP_FUNCTION(ibase_close)
 {
-   zval **link_arg;
+   zval **link_arg = NULL;
ibase_db_link *ib_link;
int link_id;

@@ -1006,7 +1006,7 @@
Drop an InterBase database */
 PHP_FUNCTION(ibase_drop_db)
 {
-   zval **link_arg;
+   zval **link_arg = NULL;
ibase_db_link *ib_link;
int link_id;

@@ -1576,98 +1576,120 @@
 }
 /* }}} */
 
-/* {{{ proto resource ibase_trans([int trans_args [, resource link_identifier]])
-   Start transaction */
+/* {{{ proto resource ibase_trans([int trans_args [, resource link_identifier [, ... 
], int trans_args [, resource link_identifier [, ... ]] [, ...]]])
+   Start a transaction over one or several databases */
+
+#define TPB_MAX_SIZE (8*sizeof(char))
+
 PHP_FUNCTION(ibase_trans)
 {
-   zval ***args;
-   char tpb[20];
-   long trans_argl = 0;
-   int tpb_len = 0, argn, link_cnt, link_id[19], i;
-   ibase_db_link *ib_link[19];
+   unsigned i, argn, link_cnt = 0, tpb_len = 0;
+   char last_tpb[TPB_MAX_SIZE];
+   ibase_db_link **ib_link = NULL;
ibase_trans *ib_trans;
-
-   ISC_TEB *teb;
isc_tr_handle tr_handle = NULL;
+   ISC_STATUS result;

RESET_ERRMSG;
 
argn = ZEND_NUM_ARGS();
-   if (argn  0) {
-   WRONG_PARAM_COUNT;
-   }
 
-   if (argn) {
-   /* the number of databases this transaction connects to */
-   link_cnt = argn-1;
+   /* (1+argn) is an upper bound for the number of links this trans connects to */
+   ib_link = (ibase_db_link**)do_alloca(sizeof(ibase_db_link*) * (1+argn));
+   
+   if (argn  0) {
+   long trans_argl = 0;
+   char *tpb;
+   ISC_TEB *teb;
+   zval ***args = (zval ***)do_alloca(sizeof(zval **) * argn);
 
-   args = (zval ***) emalloc(sizeof(zval **) * argn);
if (zend_get_parameters_array_ex(argn, args) == FAILURE) {
-   efree(args);
+   free_alloca(args);
+   free_alloca(ib_link);
RETURN_FALSE;
}
 
-   /* Handle all database links. */
-   for (i = argn-1; i  0  Z_TYPE_PP(args[i]) == IS_RESOURCE; --i) {
-   ZEND_FETCH_RESOURCE2(ib_link[i-1], ibase_db_link *, args[i], 
-1, InterBase link, le_link, le_plink);
-   link_id[i-1] = Z_LVAL_PP(args[i]);
-   }
+   teb = (ISC_TEB*)do_alloca(sizeof(ISC_TEB) * argn);
+   tpb = (char*)do_alloca(TPB_MAX_SIZE * argn);
 
-   /* First argument is transaction parameters */
-   convert_to_long_ex(args[0]);
-   trans_argl = Z_LVAL_PP(args[0]);
+   /* enumerate all the arguments: assume every non-resource argument 
+  specifies modifiers for the link ids that follow it */
+   for (i = 0; i  argn; ++i) {
+   
+   if (Z_TYPE_PP(args[i]) == IS_RESOURCE) {
+   
+   ZEND_FETCH_RESOURCE2(ib_link[link_cnt], ibase_db_link 
*, args[i], -1, InterBase link, le_link, le_plink);
+   
+   /* copy the most recent modifier string into tbp[] */
+   memcpy(tpb[TPB_MAX_SIZE * link_cnt], last_tpb, 
TPB_MAX_SIZE);
 
-   efree(args);
-   }
+   /* add a database handle to the TEB with the most 
recently specified set of modifiers */
+   teb[link_cnt].db_ptr = ib_link[link_cnt]-link;
+   teb[link_cnt].tpb_len = tpb_len;
+   teb[link_cnt].tpb_ptr = 

Re: [PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-14 Thread Jani Taskinen

Any fixes for bugs should be merged to the PHP_4_3 branch..

--Jani


On Tue, 12 Aug 2003, Ard Biesheuvel wrote:

abies  Tue Aug 12 09:19:36 2003 EDT

  Modified files:  
/php-src/ext/interbase interbase.c 
  Log:
  Fixed bug #23936 (fail to select and fetch)
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.133 
php-src/ext/interbase/interbase.c:1.134
--- php-src/ext/interbase/interbase.c:1.133Tue Aug 12 07:35:26 2003
+++ php-src/ext/interbase/interbase.c  Tue Aug 12 09:19:36 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.133 2003/08/12 11:35:26 abies Exp $ */
+/* $Id: interbase.c,v 1.134 2003/08/12 13:19:36 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -64,6 +64,11 @@
 
 #if HAVE_IBASE
 #include ibase.h
+
+#ifndef SQLDA_CURRENT_VERSION
+#define SQLDA_CURRENT_VERSION SQLDA_VERSION1
+#endif
+
 #include time.h
 #include ext/standard/fsock.h
 #include ext/standard/info.h
@@ -687,7 +692,7 @@
 
   php_info_print_table_start();
   php_info_print_table_row(2, Interbase Support, enabled);
-  php_info_print_table_row(2, Revision, $Revision: 1.133 $);
+  php_info_print_table_row(2, Revision, $Revision: 1.134 $);
 #ifdef COMPILE_DL_INTERBASE
   php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1180,7 +1185,7 @@
 
   IB_QUERY-out_sqlda = (XSQLDA *) emalloc(XSQLDA_LENGTH(1));
   IB_QUERY-out_sqlda-sqln = 1;
-  IB_QUERY-out_sqlda-version = SQLDA_VERSION1;
+  IB_QUERY-out_sqlda-version = SQLDA_CURRENT_VERSION;
 
   if (isc_dsql_prepare(IB_STATUS, IB_QUERY-trans, IB_QUERY-stmt, 0, query, 
 dialect, IB_QUERY-out_sqlda)) {
   _php_ibase_error(TSRMLS_C);
@@ -1191,8 +1196,8 @@
   if (IB_QUERY-out_sqlda-sqld  IB_QUERY-out_sqlda-sqln) {
   IB_QUERY-out_sqlda = erealloc(IB_QUERY-out_sqlda, 
 XSQLDA_LENGTH(IB_QUERY-out_sqlda-sqld));
   IB_QUERY-out_sqlda-sqln = IB_QUERY-out_sqlda-sqld;
-  IB_QUERY-out_sqlda-version = SQLDA_VERSION1;
-  if (isc_dsql_describe(IB_STATUS, IB_QUERY-stmt, SQLDA_VERSION1, 
IB_QUERY-out_sqlda)) {
+  IB_QUERY-out_sqlda-version = SQLDA_CURRENT_VERSION;
+  if (isc_dsql_describe(IB_STATUS, IB_QUERY-stmt, 
SQLDA_CURRENT_VERSION, IB_QUERY-out_sqlda)) {
   _php_ibase_error(TSRMLS_C);
   goto _php_ibase_alloc_query_error;
   }
@@ -1201,8 +1206,8 @@
   /* maybe have input placeholders? */
   IB_QUERY-in_sqlda = emalloc(XSQLDA_LENGTH(1));
   IB_QUERY-in_sqlda-sqln = 1;
-  IB_QUERY-in_sqlda-version = SQLDA_VERSION1;
-  if (isc_dsql_describe_bind(IB_STATUS, IB_QUERY-stmt, SQLDA_VERSION1, 
IB_QUERY-in_sqlda)) {
+  IB_QUERY-in_sqlda-version = SQLDA_CURRENT_VERSION;
+  if (isc_dsql_describe_bind(IB_STATUS, IB_QUERY-stmt, SQLDA_CURRENT_VERSION, 
IB_QUERY-in_sqlda)) {
   _php_ibase_error(TSRMLS_C);
   goto _php_ibase_alloc_query_error;
   }
@@ -1211,8 +1216,8 @@
   if (IB_QUERY-in_sqlda-sqln  IB_QUERY-in_sqlda-sqld) {
   IB_QUERY-in_sqlda = erealloc(IB_QUERY-in_sqlda, 
 XSQLDA_LENGTH(IB_QUERY-in_sqlda-sqld));
   IB_QUERY-in_sqlda-sqln = IB_QUERY-in_sqlda-sqld;
-  IB_QUERY-in_sqlda-version = SQLDA_VERSION1;
-  if (isc_dsql_describe_bind(IB_STATUS, IB_QUERY-stmt, SQLDA_VERSION1, 
IB_QUERY-in_sqlda)) {
+  IB_QUERY-in_sqlda-version = SQLDA_CURRENT_VERSION;
+  if (isc_dsql_describe_bind(IB_STATUS, IB_QUERY-stmt, 
SQLDA_CURRENT_VERSION, IB_QUERY-in_sqlda)) {
   _php_ibase_error(TSRMLS_C);
   goto _php_ibase_alloc_query_error;
   }





-- 
https://www.paypal.com/xclick/[EMAIL PROTECTED]no_note=1tax=0currency_code=EUR
 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-14 Thread Ard Biesheuvel
abies   Sun Aug 10 13:24:52 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Win32 fixes
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.125 php-src/ext/interbase/interbase.c:1.126
--- php-src/ext/interbase/interbase.c:1.125 Sun Aug 10 12:21:26 2003
+++ php-src/ext/interbase/interbase.c   Sun Aug 10 13:24:51 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.125 2003/08/10 16:21:26 abies Exp $ */
+/* $Id: interbase.c,v 1.126 2003/08/10 17:24:51 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -683,7 +683,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.125 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.126 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1899,7 +1899,7 @@
 
 /* {{{ _php_ibase_do_fetch() */
 
-static void _php_ibase_do_fetch(ibase_result *ib_result)
+static void _php_ibase_do_fetch(ibase_result *ib_result TSRMLS_DC)
 {
if (ib_result-has_more_rows) {
if (isc_dsql_fetch(IB_STATUS, ib_result-stmt, 1, 
ib_result-out_sqlda) == 100L) {
@@ -2048,7 +2048,7 @@
RETURN_FALSE;
}

-   /* find out if what kind of statement was prepared */
+   /* find out what kind of statement was prepared */
if (isc_dsql_sql_info(IB_STATUS, ib_query-stmt, sizeof(info_type), 
info_type, sizeof(result), result)) {
_php_ibase_error(TSRMLS_C);
free_alloca(args);
@@ -2057,12 +2057,12 @@
 
switch (result[3]) {
isc_tr_handle tr;
+   ibase_tr_list **l;

case isc_info_sql_stmt_start_trans:

/* a SET TRANSACTION statement should be executed with a NULL 
trans handle */
tr = NULL;
-   ibase_tr_list **l;

if (isc_dsql_execute_immediate(IB_STATUS, ib_link-link, tr, 
0, query, ib_link-dialect, NULL)) {
_php_ibase_error(TSRMLS_C);
@@ -2140,7 +2140,7 @@
unsigned i = 3, result_size = 
isc_vax_integer(result[1],2);
 
while (result[i] != isc_info_end  i  
result_size) {
-   short len = 
isc_vax_integer(result[i+1],2);
+   short len = 
(short)isc_vax_integer(result[i+1],2);
if (result[i] != 
isc_info_req_select_count) {
trans-affected_rows += 
isc_vax_integer(result[i+3],len);
}
@@ -2157,7 +2157,7 @@
ib_query-stmt = NULL; /* keep stmt when free query */
_php_ibase_free_query(ib_query TSRMLS_CC);
ib_result-has_more_rows = 1;
-   _php_ibase_do_fetch(ib_result);
+   _php_ibase_do_fetch(ib_result TSRMLS_CC);
ZEND_REGISTER_RESOURCE(return_value, ib_result, le_result);
} else {
_php_ibase_free_query(ib_query TSRMLS_CC);
@@ -2212,7 +2212,7 @@
 /* }}} */
 
 /* {{{ proto ibase_num_rows( resource result_identifier )
-   Returns the number of records in the result */
+   Returns the number of rows in a result */
 PHP_FUNCTION(ibase_num_rows) 
 {
zval **result_arg;
@@ -2236,7 +2236,7 @@
unsigned i = 3, result_size = isc_vax_integer(result[1],2);
 
while (result[i] != isc_info_end  i  result_size) {
-   short len = isc_vax_integer(result[i+1],2);
+   short len = (short)isc_vax_integer(result[i+1],2);
if (result[i] == isc_info_req_select_count) {
RETURN_LONG(isc_vax_integer(result[i+3],len));
}
@@ -2244,6 +2244,7 @@
}
}   
 }
+/* }}} */
 
 /* {{{ _php_ibase_var_zval() */
 static int _php_ibase_var_zval(zval *val, void *data, int type, int len, int scale, 
int flag TSRMLS_DC)
@@ -2530,13 +2531,13 @@

if (isc_open_blob(IB_STATUS, 
ib_result-link, ib_result-trans, bl_handle, (ISC_QUAD ISC_FAR *) var-sqldata)) {
_php_ibase_error(TSRMLS_C);
-   RETURN_FALSE;
+   goto 
_php_ibase_fetch_hash_error;
}
 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-14 Thread Ard Biesheuvel
abies   Tue Aug 12 09:19:36 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fixed bug #23936 (fail to select and fetch)
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.133 php-src/ext/interbase/interbase.c:1.134
--- php-src/ext/interbase/interbase.c:1.133 Tue Aug 12 07:35:26 2003
+++ php-src/ext/interbase/interbase.c   Tue Aug 12 09:19:36 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.133 2003/08/12 11:35:26 abies Exp $ */
+/* $Id: interbase.c,v 1.134 2003/08/12 13:19:36 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -64,6 +64,11 @@
 
 #if HAVE_IBASE
 #include ibase.h
+
+#ifndef SQLDA_CURRENT_VERSION
+#define SQLDA_CURRENT_VERSION SQLDA_VERSION1
+#endif
+
 #include time.h
 #include ext/standard/fsock.h
 #include ext/standard/info.h
@@ -687,7 +692,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.133 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.134 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1180,7 +1185,7 @@
 
IB_QUERY-out_sqlda = (XSQLDA *) emalloc(XSQLDA_LENGTH(1));
IB_QUERY-out_sqlda-sqln = 1;
-   IB_QUERY-out_sqlda-version = SQLDA_VERSION1;
+   IB_QUERY-out_sqlda-version = SQLDA_CURRENT_VERSION;
 
if (isc_dsql_prepare(IB_STATUS, IB_QUERY-trans, IB_QUERY-stmt, 0, query, 
dialect, IB_QUERY-out_sqlda)) {
_php_ibase_error(TSRMLS_C);
@@ -1191,8 +1196,8 @@
if (IB_QUERY-out_sqlda-sqld  IB_QUERY-out_sqlda-sqln) {
IB_QUERY-out_sqlda = erealloc(IB_QUERY-out_sqlda, 
XSQLDA_LENGTH(IB_QUERY-out_sqlda-sqld));
IB_QUERY-out_sqlda-sqln = IB_QUERY-out_sqlda-sqld;
-   IB_QUERY-out_sqlda-version = SQLDA_VERSION1;
-   if (isc_dsql_describe(IB_STATUS, IB_QUERY-stmt, SQLDA_VERSION1, 
IB_QUERY-out_sqlda)) {
+   IB_QUERY-out_sqlda-version = SQLDA_CURRENT_VERSION;
+   if (isc_dsql_describe(IB_STATUS, IB_QUERY-stmt, 
SQLDA_CURRENT_VERSION, IB_QUERY-out_sqlda)) {
_php_ibase_error(TSRMLS_C);
goto _php_ibase_alloc_query_error;
}
@@ -1201,8 +1206,8 @@
/* maybe have input placeholders? */
IB_QUERY-in_sqlda = emalloc(XSQLDA_LENGTH(1));
IB_QUERY-in_sqlda-sqln = 1;
-   IB_QUERY-in_sqlda-version = SQLDA_VERSION1;
-   if (isc_dsql_describe_bind(IB_STATUS, IB_QUERY-stmt, SQLDA_VERSION1, 
IB_QUERY-in_sqlda)) {
+   IB_QUERY-in_sqlda-version = SQLDA_CURRENT_VERSION;
+   if (isc_dsql_describe_bind(IB_STATUS, IB_QUERY-stmt, SQLDA_CURRENT_VERSION, 
IB_QUERY-in_sqlda)) {
_php_ibase_error(TSRMLS_C);
goto _php_ibase_alloc_query_error;
}
@@ -1211,8 +1216,8 @@
if (IB_QUERY-in_sqlda-sqln  IB_QUERY-in_sqlda-sqld) {
IB_QUERY-in_sqlda = erealloc(IB_QUERY-in_sqlda, 
XSQLDA_LENGTH(IB_QUERY-in_sqlda-sqld));
IB_QUERY-in_sqlda-sqln = IB_QUERY-in_sqlda-sqld;
-   IB_QUERY-in_sqlda-version = SQLDA_VERSION1;
-   if (isc_dsql_describe_bind(IB_STATUS, IB_QUERY-stmt, SQLDA_VERSION1, 
IB_QUERY-in_sqlda)) {
+   IB_QUERY-in_sqlda-version = SQLDA_CURRENT_VERSION;
+   if (isc_dsql_describe_bind(IB_STATUS, IB_QUERY-stmt, 
SQLDA_CURRENT_VERSION, IB_QUERY-in_sqlda)) {
_php_ibase_error(TSRMLS_C);
goto _php_ibase_alloc_query_error;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-14 Thread Jani Taskinen

I have reverted to previous version, you fucked up the commit
with some dos line endings or something.

Reapply the patch. 

--Jani


On Tue, 12 Aug 2003, Ard Biesheuvel wrote:

abies  Tue Aug 12 13:33:54 2003 EDT

  Modified files:  
/php-src/ext/interbase interbase.c php_interbase.h 
  Log:
  Allow prepared execution of any non-query statement except CREATE DB
  (fixes bug #7014)
  
  

 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-14 Thread Ard Biesheuvel
abies   Thu Aug 14 20:06:07 2003 EDT

  Modified files:  
/php-src/ext/interbase  php_interbase.h interbase.c 
  Log:
  Added ibase_set_event_handler()
  
  Index: php-src/ext/interbase/php_interbase.h
diff -u php-src/ext/interbase/php_interbase.h:1.48 
php-src/ext/interbase/php_interbase.h:1.49
--- php-src/ext/interbase/php_interbase.h:1.48  Thu Aug 14 06:55:02 2003
+++ php-src/ext/interbase/php_interbase.h   Thu Aug 14 20:06:07 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: php_interbase.h,v 1.48 2003/08/14 10:55:02 abies Exp $ */
+/* $Id: php_interbase.h,v 1.49 2003/08/15 00:06:07 abies Exp $ */
 
 #ifndef PHP_INTERBASE_H
 #define PHP_INTERBASE_H
@@ -91,6 +91,7 @@
 PHP_FUNCTION(ibase_errcode);
 
 PHP_FUNCTION(ibase_wait_event);
+PHP_FUNCTION(ibase_set_event_handler);
 
 #define IBASE_MSGSIZE 256
 #define MAX_ERRMSG (IBASE_MSGSIZE*2)
@@ -170,6 +171,17 @@
unsigned char has_more_rows;
char statement_type;
 } ibase_result;
+
+typedef struct {
+   int link_res_id;
+   ibase_db_link *link;
+   ISC_LONG event_id;
+   unsigned short event_count;
+   char **events;
+   char *event_buffer, *result_buffer;
+   zval *callback;
+   void **thread_ctx;
+} ibase_event;
 
 typedef struct _php_ibase_varchar {
short var_len;
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.140 php-src/ext/interbase/interbase.c:1.141
--- php-src/ext/interbase/interbase.c:1.140 Thu Aug 14 06:55:02 2003
+++ php-src/ext/interbase/interbase.c   Thu Aug 14 20:06:07 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.140 2003/08/14 10:55:02 abies Exp $ */
+/* $Id: interbase.c,v 1.141 2003/08/15 00:06:07 abies Exp $ */
 
 /*
Changes:
@@ -136,6 +136,7 @@
PHP_FE(ibase_delete_user, NULL)
 #endif
PHP_FE(ibase_wait_event, NULL)
+   PHP_FE(ibase_set_event_handler, NULL)
{NULL, NULL, NULL}
 };
 
@@ -164,7 +165,7 @@
 #endif
 
 /* True globals, no need for thread safety */
-static int le_blob, le_link, le_plink, le_result, le_query, le_trans;
+static int le_blob, le_link, le_plink, le_result, le_query, le_trans, le_event;
 
 ZEND_DECLARE_MODULE_GLOBALS(ibase)
 
@@ -584,6 +585,34 @@
 }
 /* }}} */
 
+/* {{{ _php_ibase_event_free() */
+static void _php_ibase_event_free(char *event_buf, char *result_buf)
+{
+   isc_free(event_buf);
+   isc_free(result_buf);
+}
+/* }}} */
+
+/* {{{ _php_ibase_free_event */
+static void _php_ibase_free_event(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+{
+   ibase_event *event = (ibase_event *) rsrc-ptr;
+   
+   IBDEBUG(Cleaning up event resource);
+
+   zval_dtor(event-callback);
+   event-callback = NULL;
+   
+   if (event-link-handle != NULL) {
+   if (isc_cancel_events(IB_STATUS, event-link-handle, 
event-event_id)) {
+   _php_ibase_error(TSRMLS_C);
+   }
+   }
+   _php_ibase_event_free(event-event_buffer,event-result_buffer);
+}
+   
+/* }}} */
+
 /* {{{ startup, shutdown and info functions */
 PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN(ibase.allow_persistent, 1, PHP_INI_SYSTEM, 
OnUpdateLong, allow_persistent, zend_ibase_globals, ibase_globals)
@@ -617,6 +646,7 @@
le_link = zend_register_list_destructors_ex(_php_ibase_close_link, NULL, 
interbase link, module_number);
le_plink = zend_register_list_destructors_ex(php_ibase_commit_link_rsrc, 
_php_ibase_close_plink, interbase link persistent, module_number);
le_trans = zend_register_list_destructors_ex(_php_ibase_free_trans, NULL, 
interbase transaction, module_number);
+   le_event = zend_register_list_destructors_ex(_php_ibase_free_event, NULL, 
interbase event, module_number);
 
REGISTER_LONG_CONSTANT(IBASE_DEFAULT, PHP_IBASE_DEFAULT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(IBASE_TEXT, PHP_IBASE_TEXT, CONST_PERSISTENT);
@@ -695,7 +725,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.140 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.141 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1910,7 +1940,7 @@
 {
ibase_trans *trans = NULL;
int res_id = 0;
-   ISC_STATUS result;
+   ISC_STATUS result = 0;
 
RESET_ERRMSG;
 
@@ -3829,14 +3859,6 @@
 }
 /* }}} */
 
-/* {{{ _php_ibase_event_free() */
-static void _php_ibase_event_free(char *event_buf, char *result_buf)
-{
-   isc_free(event_buf);
-   isc_free(result_buf);
-}
-/* }}} */
-
 /* {{{ proto string ibase_wait_event([resource link,] string event [, string event [, 
...]])
Waits for any one of the passed Interbase events to be posted by the 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-14 Thread Ard Biesheuvel
abies   Thu Aug 14 20:16:59 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Moved TRMLS_FETCH to correct scope
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.141 php-src/ext/interbase/interbase.c:1.142
--- php-src/ext/interbase/interbase.c:1.141 Thu Aug 14 20:06:07 2003
+++ php-src/ext/interbase/interbase.c   Thu Aug 14 20:16:58 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.141 2003/08/15 00:06:07 abies Exp $ */
+/* $Id: interbase.c,v 1.142 2003/08/15 00:16:58 abies Exp $ */
 
 /*
Changes:
@@ -725,7 +725,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.141 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.142 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -3935,6 +3935,9 @@
 /* {{{ _php_ibase_callback() */
 static isc_callback _php_ibase_callback(ibase_event *event, unsigned short 
buffer_size, char *result_buf)
 {
+   /* this function is called asynchronously by the Interbase client library. */
+   TSRMLS_FETCH_FROM_CTX(event-thread_ctx);
+   
/**
 * The callback function is called when the event is first registered and when 
the event
 * is cancelled. I consider this is a bug. By clearing event-callback, we 
make sure 
@@ -3946,9 +3949,6 @@
ISC_STATUS occurred_event[15];
zval event_name, link_id, return_value, *args[2] = { event_name, 
link_id };
 
-   /* this function is called asynchronously by the Interbase client 
library. */
-   TSRMLS_FETCH_FROM_CTX(event-thread_ctx);
-   
/* copy the updated results into the result buffer */
memcpy(event-result_buffer, result_buf, buffer_size);

@@ -4086,6 +4086,7 @@
efree(args);
 
ZEND_REGISTER_RESOURCE(return_value, event, le_event);
+   zend_list_addref(Z_LVAL_P(return_value));
 }

 /* }}} */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-14 Thread Ard Biesheuvel
abies   Tue Aug 12 14:02:00 2003 EDT

  Modified files:  
/php-src/ext/interbase  php_interbase.h interbase.c 
  Log:
  Re-commit of failed patch 
  
  Index: php-src/ext/interbase/php_interbase.h
diff -u php-src/ext/interbase/php_interbase.h:1.44 
php-src/ext/interbase/php_interbase.h:1.45
--- php-src/ext/interbase/php_interbase.h:1.44  Tue Aug 12 13:41:37 2003
+++ php-src/ext/interbase/php_interbase.h   Tue Aug 12 14:01:59 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: php_interbase.h,v 1.44 2003/08/12 17:41:37 sniper Exp $ */
+/* $Id: php_interbase.h,v 1.45 2003/08/12 18:01:59 abies Exp $ */
 
 #ifndef PHP_INTERBASE_H
 #define PHP_INTERBASE_H
@@ -153,6 +153,9 @@
int in_array_cnt, out_array_cnt;
unsigned short dialect;
int cursor_open;
+   char statement_type;
+   char *query;
+   int trans_res_id;
 } ibase_query;
 
 typedef struct {
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.136 php-src/ext/interbase/interbase.c:1.137
--- php-src/ext/interbase/interbase.c:1.136 Tue Aug 12 13:41:37 2003
+++ php-src/ext/interbase/interbase.c   Tue Aug 12 14:01:59 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.136 2003/08/12 17:41:37 sniper Exp $ */
+/* $Id: interbase.c,v 1.137 2003/08/12 18:01:59 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -421,9 +421,9 @@
ibase_db_link *link = (ibase_db_link *) rsrc-ptr;
 
_php_ibase_commit_link(link TSRMLS_CC);
-   if (link-link != NULL) {
+   if (link-handle != NULL) {
IBDEBUG(Closing normal link...);
-   isc_detach_database(IB_STATUS, link-link);
+   isc_detach_database(IB_STATUS, link-handle);
}
IBG(num_links)--;
efree(link);
@@ -438,8 +438,8 @@
 
_php_ibase_commit_link(link TSRMLS_CC);
IBDEBUG(Closing permanent link...);
-   if (link-link != NULL) {
-   isc_detach_database(IB_STATUS, link-link);
+   if (link-handle != NULL) {
+   isc_detach_database(IB_STATUS, link-handle);
}
IBG(num_persistent)--;
IBG(num_links)--;
@@ -502,6 +502,9 @@
if (ib_query-out_array) {
efree(ib_query-out_array);
}
+   if (ib_query-query) {
+   efree(ib_query-query);
+   }
efree(ib_query);
}
 }
@@ -530,6 +533,9 @@
if (ib_query-out_array) {
efree(ib_query-out_array);
}
+   if (ib_query-query) {
+   efree(ib_query-query);
+   }
efree(ib_query);
}
 }
@@ -692,7 +698,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.136 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.137 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -865,7 +871,7 @@
}
/* Check if connection has timed out */
ib_link = (ibase_db_link *) le-ptr;
-   if (!isc_database_info(IB_STATUS, ib_link-link, 
sizeof(tmp_1), tmp_1, sizeof(tmp_2), tmp_2)) {
+   if (!isc_database_info(IB_STATUS, ib_link-handle, 
sizeof(tmp_1), tmp_1, sizeof(tmp_2), tmp_2)) {
open_new_connection = 0;
}
}
@@ -895,7 +901,7 @@
}
 
ib_link = (ibase_db_link *) malloc(sizeof(ibase_db_link));
-   ib_link-link = db_handle;
+   ib_link-handle = db_handle;
ib_link-dialect = (ib_dialect ? (unsigned short) 
strtoul(ib_dialect, NULL, 10) : SQL_DIALECT_CURRENT);
ib_link-tr_list = NULL;
 
@@ -955,7 +961,7 @@
}
 
ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
-   ib_link-link = db_handle;
+   ib_link-handle = db_handle;
ib_link-dialect = (ib_dialect ? (unsigned short) strtoul(ib_dialect, 
NULL, 10) : SQL_DIALECT_CURRENT);
ib_link-tr_list = NULL;

@@ -1054,7 +1060,7 @@
}

ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, InterBase 
link, le_link, le_plink);
-   if (isc_drop_database(IB_STATUS, ib_link-link)) {
+   if (isc_drop_database(IB_STATUS, ib_link-handle)) {
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -1162,9 +1168,10 @@
 
 /* {{{ _php_ibase_alloc_query() */
 /* allocate and prepare query */
-static int 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-14 Thread Ard Biesheuvel
abies   Tue Aug 12 07:35:26 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Added comment in code :-)
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.132 php-src/ext/interbase/interbase.c:1.133
--- php-src/ext/interbase/interbase.c:1.132 Tue Aug 12 07:27:03 2003
+++ php-src/ext/interbase/interbase.c   Tue Aug 12 07:35:26 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.132 2003/08/12 11:27:03 abies Exp $ */
+/* $Id: interbase.c,v 1.133 2003/08/12 11:35:26 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -687,7 +687,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.132 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.133 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -2201,6 +2201,20 @@
Returns the number of rows in a result */
 PHP_FUNCTION(ibase_num_rows) 
 {
+   /**
+* This function relies on the InterBase API function isc_dsql_sql_info()
+* which has a couple of limitations (which I hope will be fixed in
+* future releases of Firebird):
+* - row count is always zero before the first fetch;
+* - row count for SELECT ... FOR UPDATE is broken - never returns a
+*   higher number than the number of records fetched so far;
+* - row count for other statements is merely a lower bound on the number
+*   of records = calling ibase_num_rows() again after a couple of fetches
+*   will most likely return a new (higher) figure for large result sets.
+*
+* 12-aug-2003 Ard Biesheuvel
+*/
+   
zval **result_arg;
ibase_result *ib_result;
char info_count[] = {isc_info_sql_records}, result[64];



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-14 Thread Jani Taskinen
sniper  Mon Aug 11 22:11:42 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  fix build
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.128 php-src/ext/interbase/interbase.c:1.129
--- php-src/ext/interbase/interbase.c:1.128 Mon Aug 11 20:55:57 2003
+++ php-src/ext/interbase/interbase.c   Mon Aug 11 22:11:41 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.128 2003/08/12 00:55:57 iliaa Exp $ */
+/* $Id: interbase.c,v 1.129 2003/08/12 02:11:41 sniper Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -687,7 +687,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.128 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.129 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -799,7 +799,7 @@
WRONG_PARAM_COUNT;
}

-   args = (zval ***) safe_emalloc(sizeof(zval **), ZEND_NUM_ARGS());
+   args = (zval ***) safe_emalloc(sizeof(zval **), ZEND_NUM_ARGS(), 0);
if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
efree(args);
RETURN_FALSE;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-14 Thread Ard Biesheuvel
abies   Wed Aug  6 21:00:25 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Fixed crash in _php_ibase_error() after request shutdown
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.119 php-src/ext/interbase/interbase.c:1.120
--- php-src/ext/interbase/interbase.c:1.119 Wed Aug  6 20:00:19 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug  6 21:00:22 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.119 2003/08/07 00:00:19 abies Exp $ */
+/* $Id: interbase.c,v 1.120 2003/08/07 01:00:22 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -34,6 +34,8 @@
  emalloc() with do_alloca()
- Changes to ibase_query() to enable the use of CREATE 
DATABASE ...
- Added ibase_drop_db()
+   - Added ibase_commit_ret() and ibase_rollback_ret()
+   - Added ibase_name_result()
2001-05-31: Jeremy Bettis [EMAIL PROTECTED]
- If a blob handle was expected and something else was
  received create a blob and add the value to it.
@@ -575,7 +577,6 @@
ibase_globals-timestampformat = NULL;
ibase_globals-dateformat = NULL;
ibase_globals-timeformat = NULL;
-   ibase_globals-errmsg = NULL;
ibase_globals-num_persistent = 0;
 }
 
@@ -632,10 +633,7 @@
}
IBG(timeformat) = DL_STRDUP(IBG(cfg_timeformat));
 
-   if (IBG(errmsg)) {
-   DL_FREE(IBG(errmsg));
-   }
-   IBG(errmsg) = DL_MALLOC(sizeof(char)*MAX_ERRMSG+1);
+   RESET_ERRMSG;
 
return SUCCESS;
 }
@@ -663,11 +661,6 @@
}
IBG(timeformat) = NULL;
 
-   if (IBG(errmsg)) {
-   DL_FREE(IBG(errmsg));
-   }
-   IBG(errmsg) = NULL;
-
return SUCCESS;
 } 
  
@@ -677,7 +670,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.119 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.120 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
Index: php-src/ext/interbase/php_interbase.h
diff -u php-src/ext/interbase/php_interbase.h:1.38 
php-src/ext/interbase/php_interbase.h:1.39
--- php-src/ext/interbase/php_interbase.h:1.38  Wed Aug  6 13:51:46 2003
+++ php-src/ext/interbase/php_interbase.h   Wed Aug  6 21:00:22 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: php_interbase.h,v 1.38 2003/08/06 17:51:46 abies Exp $ */
+/* $Id: php_interbase.h,v 1.39 2003/08/07 01:00:22 abies Exp $ */
 
 #ifndef PHP_INTERBASE_H
 #define PHP_INTERBASE_H
@@ -102,7 +102,7 @@
char *cfg_dateformat;
char *timeformat;
char *cfg_timeformat;
-   char *errmsg;
+   char errmsg[MAX_ERRMSG];
 ZEND_END_MODULE_GLOBALS(ibase)
 
 typedef struct {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-12 Thread Ard Biesheuvel
abies   Thu Aug  7 21:42:09 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Changed _php_ibase_trans_end() to allow committing of default transaction
  of a non-default link
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.120 php-src/ext/interbase/interbase.c:1.121
--- php-src/ext/interbase/interbase.c:1.120 Wed Aug  6 21:00:22 2003
+++ php-src/ext/interbase/interbase.c   Thu Aug  7 21:42:09 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.120 2003/08/07 01:00:22 abies Exp $ */
+/* $Id: interbase.c,v 1.121 2003/08/08 01:42:09 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -226,7 +226,7 @@
 char *tpb_ptr;
 } ISC_TEB;
 
-/* Fill ib_link and trans_n with the correct database link and transaction slot 
number.
+/* Fill ib_link and trans with the correct database link and transaction.
  */
 static void _php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAMETERS, zval **link_id, 
ibase_db_link **ib_link, ibase_trans **trans)
 {
@@ -670,7 +670,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.120 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.121 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1778,22 +1778,38 @@
switch (ZEND_NUM_ARGS()) {
 
ibase_db_link *ib_link;
-   zval **trans_arg;
+   zval **arg;
 
case 0:
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, 
IBG(default_link), InterBase link, le_link, le_plink);
+   if (ib_link-trans == NULL) {
+   /* this link doesn't have a default transaction */
+   _php_ibase_module_error(Default link has no default 
transaction);
+   RETURN_FALSE;
+   }
trans = ib_link-trans-trans;
break;
 
case 1: 
-   if (zend_get_parameters_ex(1, trans_arg) == FAILURE) {
+   if (zend_get_parameters_ex(1, arg) == FAILURE) {
RETURN_FALSE;
}
-   ZEND_FETCH_RESOURCE(trans, ibase_trans *, trans_arg, -1, 
InterBase transaction, le_trans);
+   /* one id was passed, could be db or trans id */
+   _php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, 
arg, ib_link, trans);
+   if (trans != NULL) {
+   convert_to_long_ex(arg);
+   res_id = Z_LVAL_PP(arg);
 
-   convert_to_long_ex(trans_arg);
-   res_id = Z_LVAL_PP(trans_arg);
+   } else {
+   ZEND_FETCH_RESOURCE(ib_link, ibase_db_link *, arg, -1, 
InterBase transaction, le_trans);
 
+   if (ib_link-trans == NULL) {
+   /* this link doesn't have a default 
transaction */
+   _php_ibase_module_error(Link has no default 
transaction);
+   RETURN_FALSE;
+   }
+   trans = ib_link-trans-trans;
+   }
break;
 
default:
@@ -1955,8 +1971,7 @@
_php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, 
args[0], ib_link, trans);
break;  
case 3:
-   /* two ids were passed, first should be link and second should 
be trans;
-   */
+   /* two ids were passed, first should be link and second should 
be trans; */
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link*, args[0], -1, 
InterBase link, le_link, le_plink);
ZEND_FETCH_RESOURCE(trans, ibase_trans*, args[1], -1, 
InterBase transaction, le_trans);
break;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-12 Thread Ard Biesheuvel
abies   Tue Aug 12 06:02:26 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Fix for missing errmsg in test 005
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.130 php-src/ext/interbase/interbase.c:1.131
--- php-src/ext/interbase/interbase.c:1.130 Mon Aug 11 22:16:40 2003
+++ php-src/ext/interbase/interbase.c   Tue Aug 12 06:02:25 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.130 2003/08/12 02:16:40 abies Exp $ */
+/* $Id: interbase.c,v 1.131 2003/08/12 10:02:25 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -687,7 +687,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.130 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.131 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -2468,8 +2468,6 @@
ibase_result *ib_result;
XSQLVAR *var;

-   RESET_ERRMSG;
-   
switch (ZEND_NUM_ARGS()) {
case 1:
if (ZEND_NUM_ARGS() == 1  zend_get_parameters_ex(1, 
result_arg) == FAILURE) {
@@ -2490,14 +2488,11 @@
 
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, InterBase 
result, le_result);
 
-   if (ib_result-out_sqlda == NULL) {
-   _php_ibase_module_error(Trying to fetch results from a non-select 
query);
-   RETURN_FALSE;
-   }
-   
-   if (!ib_result-has_more_rows) {
+   if (ib_result-out_sqlda == NULL || !ib_result-has_more_rows) {
RETURN_FALSE;
-   }
+   } /* might have been because of an error */
+
+   RESET_ERRMSG;

array_init(return_value);




-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-10 Thread Ard Biesheuvel
abies   Sun Aug 10 09:20:38 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Changed ibase_query() to free transaction resource if SQL is COMMIT or
  ROLLBACK
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.123 php-src/ext/interbase/interbase.c:1.124
--- php-src/ext/interbase/interbase.c:1.123 Fri Aug  8 09:47:20 2003
+++ php-src/ext/interbase/interbase.c   Sun Aug 10 09:20:38 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.123 2003/08/08 13:47:20 abies Exp $ */
+/* $Id: interbase.c,v 1.124 2003/08/10 13:20:38 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -246,27 +246,23 @@
 static void _php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAMETERS, zval **link_id, 
ibase_db_link **ib_link, ibase_trans **trans)
 {
int type;
-   void *resource = NULL;
 
IBDEBUG(Transaction or database link?);
-   if ((resource = zend_list_find(Z_LVAL_PP(link_id), type))) {
-   IBDEBUG(Found in list);
-   if (type == le_trans) {
-   /* Transaction resource: make sure it refers to one link only, 
then 
-  fetch it; database link is stored in ib_trans-db_link[]. */
-   IBDEBUG(Type is le_trans);
-   ZEND_FETCH_RESOURCE(*trans, ibase_trans *, link_id, -1, 
InterBase transaction, le_trans);
-   if ((*trans)-link_cnt  1) {
-   _php_ibase_module_error(Link id is ambiguous: 
transaction spans multiple connections.);
-   return;
-   }   
-   *ib_link = (*trans)-db_link[0];
-   } else {
-   IBDEBUG(Type is le_[p]link);
-   /* Database link resource, use default transaction. */
-   *trans = NULL;
-   ZEND_FETCH_RESOURCE2(*ib_link, ibase_db_link *, link_id, -1, 
InterBase link, le_link, le_plink);
-   }
+   if (zend_list_find(Z_LVAL_PP(link_id), type)  type == le_trans) {
+   /* Transaction resource: make sure it refers to one link only, then 
+  fetch it; database link is stored in ib_trans-db_link[]. */
+   IBDEBUG(Type is le_trans);
+   ZEND_FETCH_RESOURCE(*trans, ibase_trans *, link_id, -1, InterBase 
transaction, le_trans);
+   if ((*trans)-link_cnt  1) {
+   _php_ibase_module_error(Link id is ambiguous: transaction 
spans multiple connections.);
+   return;
+   }   
+   *ib_link = (*trans)-db_link[0];
+   } else {
+   IBDEBUG(Type is le_[p]link or id not found);
+   /* Database link resource, use default transaction. */
+   *trans = NULL;
+   ZEND_FETCH_RESOURCE2(*ib_link, ibase_db_link *, link_id, -1, 
InterBase link, le_link, le_plink);
}
 }

@@ -685,7 +681,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.123 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.124 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1897,17 +1893,17 @@
 }
 /* }}} */
 
-/* {{{ proto resource ibase_query([resource link_identifier [, string query [, int 
bind_args]]])
+/* {{{ proto resource ibase_query([resource link_identifier [, resource 
link_identifier ] ,] string query [, int bind_args])
Execute a query */
 PHP_FUNCTION(ibase_query)
 {
zval ***args, **bind_args = NULL;
-   int i, bind_n = 0;
-   char *query;
+   int i, bind_n = 0, trans_id = 0;
+   char *query, item_type[] = {isc_info_sql_stmt_type}, result[8];
ibase_db_link *ib_link = NULL;
ibase_trans *trans = NULL;
ibase_query *ib_query;
-   ibase_result *ib_result;
+   ibase_result *ib_result = NULL;
 
RESET_ERRMSG;
 
@@ -1988,11 +1984,21 @@
case 2:
/* one id was passed, could be db or trans id */
_php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, 
args[0], ib_link, trans);
+
+   if (trans != NULL) {
+   /* argument was a trans id */
+   convert_to_long_ex(args[0]);
+   trans_id = Z_LVAL_PP(args[0]);
+   }
break;  
case 3:
/* two ids were passed, first should be link and second should 
be trans; */
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link*, args[0], -1, 
InterBase link, le_link, le_plink);

[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-09 Thread Ard Biesheuvel
abies   Fri Aug  8 07:04:12 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Changed the names of some struct members for readability
  Added function ibase_errcode()
  @- Added function ibase_errcode() (Ard)
  
  Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.121 php-src/ext/interbase/interbase.c:1.122
--- php-src/ext/interbase/interbase.c:1.121 Thu Aug  7 21:42:09 2003
+++ php-src/ext/interbase/interbase.c   Fri Aug  8 07:04:12 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.121 2003/08/08 01:42:09 abies Exp $ */
+/* $Id: interbase.c,v 1.122 2003/08/08 11:04:12 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -123,6 +123,7 @@
PHP_FE(ibase_blob_echo, NULL)
PHP_FE(ibase_blob_import, NULL)
PHP_FE(ibase_errmsg, NULL)
+   PHP_FE(ibase_errcode, NULL)
 
 #ifdef SQL_DIALECT_V6
PHP_FE(ibase_add_user, NULL)
@@ -175,7 +176,7 @@
WRONG_PARAM_COUNT;
}
 
-   if (IBG(errmsg[0])) {
+   if (IBG(sql_code) != 0) {
RETURN_STRING(IBG(errmsg), 1);
}
 
@@ -183,16 +184,30 @@
 }
 /* }}} */
 
+/* {{{ proto string ibase_errcode(void) 
+   Return error code */
+PHP_FUNCTION(ibase_errcode)
+{
+   if (ZEND_NUM_ARGS() != 0) {
+   WRONG_PARAM_COUNT;
+   }
+
+   if (IBG(sql_code) != 0) {
+   RETURN_LONG(IBG(sql_code));
+   }
+   RETURN_FALSE;
+}
+/* }}} */
+
 /* {{{ _php_ibase_error(TSRMLS_D) 
print interbase error and save it for ibase_errmsg() */
 static void _php_ibase_error(TSRMLS_D)
 {
-   char *s;
-   ISC_STATUS *statusp;
-
-   s = IBG(errmsg);
-   statusp = IB_STATUS;
+   char *s = IBG(errmsg);
+   ISC_STATUS *statusp = IB_STATUS;
 
+   IBG(sql_code) = isc_sqlcode(IB_STATUS);
+   
while ((s - IBG(errmsg))  MAX_ERRMSG - (IBASE_MSGSIZE + 2)  
isc_interprete(s, statusp)) {
strcat(IBG(errmsg),  );
s = IBG(errmsg) + strlen(IBG(errmsg));
@@ -238,14 +253,14 @@
IBDEBUG(Found in list);
if (type == le_trans) {
/* Transaction resource: make sure it refers to one link only, 
then 
-  fetch it; database link is stored in ib_trans-link[]. */
+  fetch it; database link is stored in ib_trans-db_link[]. */
IBDEBUG(Type is le_trans);
ZEND_FETCH_RESOURCE(*trans, ibase_trans *, link_id, -1, 
InterBase transaction, le_trans);
if ((*trans)-link_cnt  1) {
_php_ibase_module_error(Link id is ambiguous: 
transaction spans multiple connections.);
return;
}   
-   *ib_link = (*trans)-link[0];
+   *ib_link = (*trans)-db_link[0];
} else {
IBDEBUG(Type is le_[p]link);
/* Database link resource, use default transaction. */
@@ -255,8 +270,7 @@
}
 }

-#define RESET_ERRMSG { IBG(errmsg)[0] = '\0';}
-#define TEST_ERRMSG ( IBG(errmsg)[0] != '\0')
+#define RESET_ERRMSG { IBG(errmsg)[0] = '\0'; IBG(sql_code) = 0; }
 
 /* sql variables union
  * used for convert and binding input variables
@@ -350,7 +364,7 @@
ibase_tr_list *l;
IBDEBUG(Checking transactions to close...);
 
-   for (l = link-trans; l != NULL; ++i) {
+   for (l = link-tr_list; l != NULL; ++i) {
ibase_tr_list *p = l;
if (p-trans != NULL) {
if (i == 0) {
@@ -372,8 +386,8 @@
}
/* set this link pointer to NULL in the transaction */
for (j = 0; j  p-trans-link_cnt; ++j) {
-   if (p-trans-link[j] == link) {
-   p-trans-link[j] = NULL;
+   if (p-trans-db_link[j] == link) {
+   p-trans-db_link[j] = NULL;
break;
}
}
@@ -382,7 +396,7 @@
l = l-next;
efree(p);
}
-   link-trans = NULL;
+   link-tr_list = NULL;
 }
 /* }}} */
 
@@ -544,9 +558,9 @@
 
/* now remove this transaction from all the connection-transaction lists */
for (i = 0; i  trans-link_cnt; ++i) {
-   if (trans-link[i] != NULL) {
+   if (trans-db_link[i] != NULL) {
ibase_tr_list **l;
-   for (l = trans-link[i]-trans; *l != NULL; l = (*l)-next) {
+   for (l 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-08-09 Thread Ard Biesheuvel
abies   Fri Aug  8 09:47:20 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  Changes ibase_query() to support SET TRANSACTION statements
  @- Added support for SET TRANSACTION statements in ibase_query() (Ard)
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.122 php-src/ext/interbase/interbase.c:1.123
--- php-src/ext/interbase/interbase.c:1.122 Fri Aug  8 07:04:12 2003
+++ php-src/ext/interbase/interbase.c   Fri Aug  8 09:47:20 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.122 2003/08/08 11:04:12 abies Exp $ */
+/* $Id: interbase.c,v 1.123 2003/08/08 13:47:20 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -685,7 +685,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.122 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.123 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, Yes);
 #endif
@@ -1801,7 +1801,7 @@
 
case 0:
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, 
IBG(default_link), InterBase link, le_link, le_plink);
-   if (ib_link-tr_list == NULL) {
+   if (ib_link-tr_list == NULL || ib_link-tr_list-trans == 
NULL) {
/* this link doesn't have a default transaction */
_php_ibase_module_error(Default link has no default 
transaction);
RETURN_FALSE;
@@ -1992,45 +1992,6 @@
case 3:
/* two ids were passed, first should be link and second should 
be trans; */
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link*, args[0], -1, 
InterBase link, le_link, le_plink);
-
-#if abies_0
-   /* as yet undocumented: passing a non-resource as trans 
argument allows SET TRANSACTION stmt */
-   if (Z_TYPE_PP(args[1]) != IS_RESOURCE) {
-   isc_tr_handle tr = NULL;
-
-   if (isc_dsql_execute_immediate(IB_STATUS, 
ib_link-link, tr, 0, query, SQL_DIALECT_CURRENT, NULL)) {
-   _php_ibase_error(TSRMLS_C);
-   free_alloca(args);
-   RETURN_FALSE;
-   }
-   if (tr != NULL) {
-   ibase_tr_list **l;
-   
-   trans = (ibase_trans *) 
emalloc(sizeof(ibase_trans));
-   trans-handle = tr;
-   trans-link_cnt = 1;
-   trans-db_link[0] = ib_link;
-
-   if (ib_link-trans == NULL) {
-   ib_link-trans = (ibase_tr_list *) 
emalloc(sizeof(ibase_tr_list));
-   ib_link-trans-trans = NULL;
-   ib_link-trans-next = NULL;
-   }
-   
-   /* link the transaction into the 
connection-transaction list */
-   for (l = ib_link-trans; *l != NULL; l = 
(*l)-next);
-   *l = (ibase_tr_list *) 
emalloc(sizeof(ibase_tr_list));
-   (*l)-trans = trans;
-   (*l)-next = NULL;
-
-   ZEND_REGISTER_RESOURCE(return_value, trans, 
le_trans);
-
-   free_alloca(args);
-   return;
-   }
-   }
-#endif
-
ZEND_FETCH_RESOURCE(trans, ibase_trans*, args[1], -1, 
InterBase transaction, le_trans);
break;
default:
@@ -2058,6 +2019,53 @@
if (_php_ibase_alloc_query(ib_query, ib_link-link, trans-handle, query, 
ib_link-dialect TSRMLS_CC) == FAILURE) {
free_alloca(args);
RETURN_FALSE;
+   } else {
+   
+   /* find out if the statement is a SET TRANSACTION, because we have to 
execute it
+  with a NULL trans handle */
+   char item_type[] = {isc_info_sql_stmt_type}, result[8];
+
+   if (isc_dsql_sql_info(IB_STATUS, ib_query-stmt, sizeof(item_type), 
item_type, sizeof(result), result)) {
+   _php_ibase_error(TSRMLS_C);
+   RETURN_FALSE;
+   }
+
+   if 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-06 Thread Ard Biesheuvel
abies   Wed Aug  6 08:09:31 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Minor Win32 fixes/cleanups
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.115 php-src/ext/interbase/interbase.c:1.116
--- php-src/ext/interbase/interbase.c:1.115 Tue Aug  5 19:40:30 2003
+++ php-src/ext/interbase/interbase.c   Wed Aug  6 08:09:30 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.115 2003/08/05 23:40:30 abies Exp $ */
+/* $Id: interbase.c,v 1.116 2003/08/06 12:09:30 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -75,7 +75,8 @@
 #endif
 
 #ifdef ZEND_DEBUG
-#define IBDEBUG(a) php_printf(::: %s (%s:%d)\n, a, __FILE__, __LINE__);
+/* #define IBDEBUG(a) php_printf(::: %s (%d)\n, a, __LINE__); */
+#define IBDEBUG(a)
 #else
 #define IBDEBUG(a)
 #endif
@@ -670,7 +671,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.115 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.116 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, yes);
 #endif
@@ -1152,8 +1153,8 @@
goto _php_ibase_alloc_query_error;
}
 
-   IB_QUERY-out_sqlda = (XSQLDA *) emalloc(XSQLDA_LENGTH(0));
-   IB_QUERY-out_sqlda-sqln = 0;
+   IB_QUERY-out_sqlda = (XSQLDA *) emalloc(XSQLDA_LENGTH(1));
+   IB_QUERY-out_sqlda-sqln = 1;
IB_QUERY-out_sqlda-version = SQLDA_VERSION1;
 
if (isc_dsql_prepare(IB_STATUS, IB_QUERY-trans, IB_QUERY-stmt, 0, query, 
dialect, IB_QUERY-out_sqlda)) {
@@ -1173,8 +1174,8 @@
}
 
/* maybe have input placeholders? */
-   IB_QUERY-in_sqlda = emalloc(XSQLDA_LENGTH(0));
-   IB_QUERY-in_sqlda-sqln = 0;
+   IB_QUERY-in_sqlda = emalloc(XSQLDA_LENGTH(1));
+   IB_QUERY-in_sqlda-sqln = 1;
IB_QUERY-in_sqlda-version = SQLDA_VERSION1;
if (isc_dsql_describe_bind(IB_STATUS, IB_QUERY-stmt, SQLDA_VERSION1, 
IB_QUERY-in_sqlda)) {
_php_ibase_error(TSRMLS_C);
@@ -1583,7 +1584,7 @@
 
 PHP_FUNCTION(ibase_trans)
 {
-   unsigned i, argn, link_cnt = 0, tpb_len = 0;
+   unsigned short i, argn, link_cnt = 0, tpb_len = 0;
char last_tpb[TPB_MAX_SIZE];
ibase_db_link **ib_link = NULL;
ibase_trans *ib_trans;
Index: php-src/ext/interbase/php_interbase.h
diff -u php-src/ext/interbase/php_interbase.h:1.36 
php-src/ext/interbase/php_interbase.h:1.37
--- php-src/ext/interbase/php_interbase.h:1.36  Tue Aug  5 12:30:47 2003
+++ php-src/ext/interbase/php_interbase.h   Wed Aug  6 08:09:30 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: php_interbase.h,v 1.36 2003/08/05 16:30:47 sniper Exp $ */
+/* $Id: php_interbase.h,v 1.37 2003/08/06 12:09:30 abies Exp $ */
 
 #ifndef PHP_INTERBASE_H
 #define PHP_INTERBASE_H
@@ -29,14 +29,10 @@
 extern zend_module_entry ibase_module_entry;
 #define phpext_interbase_ptr ibase_module_entry
 
+#ifndef ISC_INT64_FORMAT
 #ifdef PHP_WIN32
-#define PHP_IBASE_API __declspec(dllexport)
-#ifndef ISC_INT64_FORMAT
 #define ISC_INT64_FORMAT I64
-#endif
 #else
-#define PHP_IBASE_API
-#ifndef ISC_INT64_FORMAT
 #define ISC_INT64_FORMAT ll
 #endif
 #endif
@@ -162,8 +158,6 @@
short var_len;
char var_str[1];
 } IBASE_VCHAR;
-
-/* extern ibase_module php_ibase_module; */
 
 enum php_interbase_option {
PHP_IBASE_DEFAULT   = 0,



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/interbase interbase.c php_interbase.h

2003-08-05 Thread Jani Taskinen
sniper  Tue Aug  5 12:30:47 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c php_interbase.h 
  Log:
  Fix CS/WS
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.113 php-src/ext/interbase/interbase.c:1.114
--- php-src/ext/interbase/interbase.c:1.113 Tue Aug  5 09:17:15 2003
+++ php-src/ext/interbase/interbase.c   Tue Aug  5 12:30:47 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.113 2003/08/05 13:17:15 abies Exp $ */
+/* $Id: interbase.c,v 1.114 2003/08/05 16:30:47 sniper Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -670,7 +670,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.113 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.114 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, yes);
 #endif
@@ -1588,7 +1588,7 @@
ibase_trans *ib_trans;
 
ISC_TEB *teb;
-isc_tr_handle tr_handle = NULL;
+   isc_tr_handle tr_handle = NULL;

RESET_ERRMSG;
 
@@ -1598,8 +1598,8 @@
}
 
if (argn) {
-/* the number of databases this transaction connects to */
-   link_cnt = argn-1;
+   /* the number of databases this transaction connects to */
+   link_cnt = argn-1;
 
args = (zval ***) emalloc(sizeof(zval **) * argn);
if (zend_get_parameters_array_ex(argn, args) == FAILURE) {
@@ -1621,7 +1621,7 @@
}
 
if (argn  2) {
-   link_cnt = 1;
+   link_cnt = 1;
ZEND_FETCH_RESOURCE2(ib_link[0], ibase_db_link *, NULL, 
IBG(default_link), InterBase link, le_link, le_plink);
}
 
@@ -1639,7 +1639,7 @@
tpb[tpb_len++] = isc_tpb_read_committed;
if (trans_argl  PHP_IBASE_REC_VERSION) {
tpb[tpb_len++] = isc_tpb_rec_version;
-   }else{
+   } else {
tpb[tpb_len++] = isc_tpb_no_rec_version; /* default in 
read_committed  */ 
}   
} else if (trans_argl  PHP_IBASE_CONSISTENCY) {
@@ -1659,9 +1659,9 @@
/* allocate a TEB array */
teb = (ISC_TEB*) emalloc(sizeof(ISC_TEB) * link_cnt);
for (i = 0; i  link_cnt; ++i) {
-   teb[i].db_ptr = ib_link[i]-link;
-   teb[i].tpb_len = tpb_len;
-   teb[i].tpb_ptr = tpb;
+   teb[i].db_ptr = ib_link[i]-link;
+   teb[i].tpb_len = tpb_len;
+   teb[i].tpb_ptr = tpb;
}

/* start the transaction */
@@ -1679,14 +1679,13 @@
ibase_tr_list **l;
ib_trans-link[i] = ib_link[i];

-   /* the first item in the connection-transaction list is reserved for 
-   the default transaction */
+   /* the first item in the connection-transaction list is reserved for 
the default transaction */
if (ib_link[i]-trans == NULL) {
ib_link[i]-trans = 
(ibase_tr_list*)emalloc(sizeof(ibase_tr_list));
ib_link[i]-trans-trans = NULL;
ib_link[i]-trans-next = NULL;
}
-   
+
/* link the transaction into the connection-transaction list */
for (l = ib_link[i]-trans; *l != NULL; l = (*l)-next);
*l = (ibase_tr_list*) emalloc(sizeof(ibase_tr_list));
@@ -1707,14 +1706,13 @@
return FAILURE;
}
 
-/* the first item in the connection-transaction list is reserved for 
-   the default transaction */
+   /* the first item in the connection-transaction list is reserved for the 
default transaction */
if (ib_link-trans == NULL) {
ib_link-trans = (ibase_tr_list*)emalloc(sizeof(ibase_tr_list));
ib_link-trans-trans = NULL;
ib_link-trans-next = NULL;
}
-   
+
if (*trans == NULL) {
if (ib_link-trans-trans == NULL) {
ibase_trans *tr = (ibase_trans*)emalloc(sizeof(ibase_trans));
@@ -1731,7 +1729,7 @@
}
return SUCCESS;
 }
-/*}}}*/
+/* }}} */
 
 /* {{{ _php_ibase_trans_end() */
 #define COMMIT 1
Index: php-src/ext/interbase/php_interbase.h
diff -u php-src/ext/interbase/php_interbase.h:1.35 
php-src/ext/interbase/php_interbase.h:1.36
--- php-src/ext/interbase/php_interbase.h:1.35  Tue Aug  5 09:17:16 2003
+++ php-src/ext/interbase/php_interbase.h   Tue Aug  5 12:30:47 2003
@@ -17,12 +17,13 @@
+--+
  */
 
-/* $Id: php_interbase.h,v 1.35 2003/08/05 

[PHP-CVS] cvs: php-src /ext/interbase interbase.c

2003-07-09 Thread Jani Taskinen
sniper  Wed Jul  9 20:17:09 2003 EDT

  Modified files:  
/php-src/ext/interbase  interbase.c 
  Log:
  - Fixed bug #11924 (ibase_query() and ibase_execute() mangled passed 
parameter variables)
  
  
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.111 php-src/ext/interbase/interbase.c:1.112
--- php-src/ext/interbase/interbase.c:1.111 Mon Jun 16 06:41:42 2003
+++ php-src/ext/interbase/interbase.c   Wed Jul  9 20:17:09 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: interbase.c,v 1.111 2003/06/16 10:41:42 daniela Exp $ */
+/* $Id: interbase.c,v 1.112 2003/07/10 00:17:09 sniper Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -628,7 +628,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, Interbase Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.111 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.112 $);
 #ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, Dynamic Module, yes);
 #endif
@@ -1432,6 +1432,10 @@
int rv = FAILURE;

IB_RESULT = NULL;
+
+   if (argc  0  args != NULL) {
+   SEPARATE_ZVAL(args);
+   }

/* allocate sqlda and output buffers */
if (ib_query-out_sqlda) { /* output variables in select, select for update */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php