Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_firebird firebird_driver.c

2009-04-22 Thread Ilia Alshanetsky

Its mostly to keep the code the same across all branches.

Ilia Alshanetsky




On 21-Apr-09, at 7:24 PM, Johannes Schlüter wrote:


On Thu, 2009-04-16 at 22:14 +, Ilia Alshanetsky wrote:

#include "php.h"
+#ifdef ZEND_ENGINE_2
+# include "zend_exceptions.h"
+#else


Not that it is a big issue but do we really need PHP 4 compatibiity in
the code? :-)

johannes


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




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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_firebird firebird_driver.c

2009-04-21 Thread Johannes Schlüter
On Thu, 2009-04-16 at 22:14 +, Ilia Alshanetsky wrote: 
>  #include "php.h"
> +#ifdef ZEND_ENGINE_2
> +# include "zend_exceptions.h"
> +#else

Not that it is a big issue but do we really need PHP 4 compatibiity in
the code? :-)

johannes


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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_firebird firebird_driver.c

2009-04-18 Thread Felipe Pena
felipe  Sat Apr 18 18:56:11 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pdo_firebird   firebird_driver.c 
  Log:
  - MFH: Fix build
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/firebird_driver.c?r1=1.17.2.2.2.4.2.7&r2=1.17.2.2.2.4.2.8&diff_format=u
Index: php-src/ext/pdo_firebird/firebird_driver.c
diff -u php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.7 
php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.8
--- php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.7 Thu Apr 16 
22:14:28 2009
+++ php-src/ext/pdo_firebird/firebird_driver.c  Sat Apr 18 18:56:11 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.7 2009/04/16 22:14:28 iliaa Exp $ */
+/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.8 2009/04/18 18:56:11 felipe Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -27,7 +27,7 @@
 #include "php.h"
 #ifdef ZEND_ENGINE_2
 # include "zend_exceptions.h"
-#else
+#endif
 #include "php_ini.h"
 #include "ext/standard/info.h"
 #include "pdo/php_pdo.h"



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_firebird firebird_driver.c

2009-04-16 Thread Ilia Alshanetsky
iliaa   Thu Apr 16 22:14:28 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pdo_firebird   firebird_driver.c 
  Log:
  
  Fixed compiler warning
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/firebird_driver.c?r1=1.17.2.2.2.4.2.6&r2=1.17.2.2.2.4.2.7&diff_format=u
Index: php-src/ext/pdo_firebird/firebird_driver.c
diff -u php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.6 
php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.7
--- php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.6 Sun Feb 15 
21:51:00 2009
+++ php-src/ext/pdo_firebird/firebird_driver.c  Thu Apr 16 22:14:28 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.6 2009/02/15 21:51:00 felipe Exp $ 
*/
+/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.7 2009/04/16 22:14:28 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -25,6 +25,9 @@
 #define _GNU_SOURCE
 
 #include "php.h"
+#ifdef ZEND_ENGINE_2
+# include "zend_exceptions.h"
+#else
 #include "php_ini.h"
 #include "ext/standard/info.h"
 #include "pdo/php_pdo.h"



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_firebird firebird_driver.c

2008-07-13 Thread Antony Dovgal
tony2001Sun Jul 13 10:55:50 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pdo_firebird   firebird_driver.c 
  Log:
  blind fix for a segfault in ext/pdo_firebird/tests/bug_38253.phpt
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/firebird_driver.c?r1=1.17.2.2.2.4.2.3&r2=1.17.2.2.2.4.2.4&diff_format=u
Index: php-src/ext/pdo_firebird/firebird_driver.c
diff -u php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.3 
php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.4
--- php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.3 Mon Dec 31 
07:17:12 2007
+++ php-src/ext/pdo_firebird/firebird_driver.c  Sun Jul 13 10:55:50 2008
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.3 2007/12/31 07:17:12 sebastian Exp 
$ */
+/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.4 2008/07/13 10:55:50 tony2001 Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -608,7 +608,7 @@
strcpy(&buf[i++], " ");
}
add_next_index_string(info, buf, 1);
-   } else {
+   } else if (H->last_app_error) {
add_next_index_long(info, -999);
add_next_index_string(info, const_cast(H->last_app_error),1);
}



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_firebird firebird_driver.c firebird_statement.c php_pdo_firebird_int.h

2007-11-14 Thread Lars Westermann
lwe Thu Nov 15 00:10:38 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pdo_firebird   firebird_driver.c firebird_statement.c 
php_pdo_firebird_int.h 
  Log:
  - Fixed bug #43296 (Feature req: pdo_firebird: ATTR_FETCH_TABLE_NAMES support)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/firebird_driver.c?r1=1.17.2.2.2.4.2.1&r2=1.17.2.2.2.4.2.2&diff_format=u
Index: php-src/ext/pdo_firebird/firebird_driver.c
diff -u php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.1 
php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.2
--- php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.1 Tue Oct 30 
16:30:40 2007
+++ php-src/ext/pdo_firebird/firebird_driver.c  Thu Nov 15 00:10:38 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.1 2007/10/30 16:30:40 lwe Exp $ */
+/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.2 2007/11/15 00:10:38 lwe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -493,6 +493,11 @@
}
return 1;
 
+   case PDO_ATTR_FETCH_TABLE_NAMES:
+   convert_to_boolean(val);
+   H->fetch_table_names = Z_BVAL_P(val);
+   return 1;
+
case PDO_FB_ATTR_DATE_FORMAT:
convert_to_string(val);
if (H->date_format) {
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/firebird_statement.c?r1=1.18.2.1.2.5.2.4&r2=1.18.2.1.2.5.2.5&diff_format=u
Index: php-src/ext/pdo_firebird/firebird_statement.c
diff -u php-src/ext/pdo_firebird/firebird_statement.c:1.18.2.1.2.5.2.4 
php-src/ext/pdo_firebird/firebird_statement.c:1.18.2.1.2.5.2.5
--- php-src/ext/pdo_firebird/firebird_statement.c:1.18.2.1.2.5.2.4  Wed Nov 
14 23:19:29 2007
+++ php-src/ext/pdo_firebird/firebird_statement.c   Thu Nov 15 00:10:38 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: firebird_statement.c,v 1.18.2.1.2.5.2.4 2007/11/14 23:19:29 lwe Exp $ 
*/
+/* $Id: firebird_statement.c,v 1.18.2.1.2.5.2.5 2007/11/15 00:10:38 lwe Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -162,15 +162,27 @@
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
struct pdo_column_data *col = &stmt->columns[colno];
XSQLVAR *var = &S->out_sqlda.sqlvar[colno];
+   int colname_len;
+   char *cp;

/* allocate storage for the column */
var->sqlind = (void*)emalloc(var->sqllen + 2*sizeof(short));
var->sqldata = &((char*)var->sqlind)[sizeof(short)];
 
+   colname_len = (S->H->fetch_table_names && var->relname_length)
+   ? (var->aliasname_length + 
var->relname_length + 1)
+   : (var->aliasname_length);
col->precision = -var->sqlscale;
col->maxlen = var->sqllen;
-   col->namelen = var->aliasname_length;
-   col->name = estrndup(var->aliasname,var->aliasname_length);
+   col->namelen = colname_len;
+   col->name = cp = emalloc(colname_len + 1);
+   if (colname_len > var->aliasname_length) {
+   memmove(cp, var->relname, var->relname_length);
+   cp += var->relname_length;
+   *cp++ = '.';
+   }
+   memmove(cp, var->aliasname, var->aliasname_length);
+   *(cp+var->aliasname_length) = '\0';
col->param_type = PDO_PARAM_STR;
 
return 1;
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/php_pdo_firebird_int.h?r1=1.10.2.1.2.1.2.2&r2=1.10.2.1.2.1.2.3&diff_format=u
Index: php-src/ext/pdo_firebird/php_pdo_firebird_int.h
diff -u php-src/ext/pdo_firebird/php_pdo_firebird_int.h:1.10.2.1.2.1.2.2 
php-src/ext/pdo_firebird/php_pdo_firebird_int.h:1.10.2.1.2.1.2.3
--- php-src/ext/pdo_firebird/php_pdo_firebird_int.h:1.10.2.1.2.1.2.2Wed Nov 
14 22:09:21 2007
+++ php-src/ext/pdo_firebird/php_pdo_firebird_int.h Thu Nov 15 00:10:38 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: php_pdo_firebird_int.h,v 1.10.2.1.2.1.2.2 2007/11/14 22:09:21 lwe Exp 
$ */
+/* $Id: php_pdo_firebird_int.h,v 1.10.2.1.2.1.2.3 2007/11/15 00:10:38 lwe Exp 
$ */
 
 #ifndef PHP_PDO_FIREBIRD_INT_H
 #define PHP_PDO_FIREBIRD_INT_H
@@ -82,6 +82,11 @@
char *time_format;
char *timestamp_format;

+   /* prepend table names on column names in fetch */
+   unsigned fetch_table_names:1;
+   
+   unsigned _reserved:31;
+   
 } pdo_firebird_db_handle;
 
 

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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_firebird firebird_driver.c

2007-10-30 Thread Lars Westermann
lwe Tue Oct 30 16:30:40 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pdo_firebird   firebird_driver.c 
  Log:
  - Added 3 firebird specific attributes to firebird_handle_set_attribute()
  - function. They control formatting of date/timestamp columns.
  - pdo_firebird_handle_factory() now throwing an execption if unable to attach
  - database (bug reports 39822 and 41522)
  - Fixed bug #39822 (new PDO() doesn't work with firebird)
  - Fixed bug #41522 (PDO firebird driver returns null if it fails to connect)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/firebird_driver.c?r1=1.17.2.2.2.4&r2=1.17.2.2.2.4.2.1&diff_format=u
Index: php-src/ext/pdo_firebird/firebird_driver.c
diff -u php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4 
php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.1
--- php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4 Tue Feb 27 
03:28:16 2007
+++ php-src/ext/pdo_firebird/firebird_driver.c  Tue Oct 30 16:30:40 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: firebird_driver.c,v 1.17.2.2.2.4 2007/02/27 03:28:16 iliaa Exp $ */
+/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.1 2007/10/30 16:30:40 lwe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -114,6 +114,16 @@
RECORD_ERROR(dbh);
}
 
+   if (H->date_format) {
+   efree(H->date_format);
+   }
+   if (H->time_format) {
+   efree(H->time_format);
+   }
+   if (H->timestamp_format) {
+   efree(H->timestamp_format);
+   }
+   
pefree(H, dbh->is_persistent);
 
return 0;
@@ -482,6 +492,30 @@
dbh->auto_commit = Z_BVAL_P(val);
}
return 1;
+
+   case PDO_FB_ATTR_DATE_FORMAT:
+   convert_to_string(val);
+   if (H->date_format) {
+   efree(H->date_format);
+   }
+   spprintf(&H->date_format, 0, "%s", Z_STRVAL_P(val)); 
+   return 1;
+
+   case PDO_FB_ATTR_TIME_FORMAT:
+   convert_to_string(val);
+   if (H->time_format) {
+   efree(H->time_format);
+   }
+   spprintf(&H->time_format, 0, "%s", Z_STRVAL_P(val)); 
+   return 1;
+
+   case PDO_FB_ATTR_TIMESTAMP_FORMAT:
+   convert_to_string(val);
+   if (H->timestamp_format) {
+   efree(H->timestamp_format);
+   }
+   spprintf(&H->timestamp_format, 0, "%s", 
Z_STRVAL_P(val)); 
+   return 1;
}
return 0;
 }
@@ -500,7 +534,7 @@
 /* }}} */
 
 /* called by PDO to get a driver-specific dbh attribute */
-static int firebird_handle_get_attribute(pdo_dbh_t const *dbh, long attr, zval 
*val TSRMLS_DC) /* {{{ */
+static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val 
TSRMLS_DC) /* {{{ */
 {
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
 
@@ -615,7 +649,7 @@
char dpb_buffer[256] = { isc_dpb_version1 }, *dpb;

dpb = dpb_buffer + 1; 
-   
+
/* loop through all the provided arguments and set dpb fields 
accordingly */
for (i = 0; i < sizeof(dpb_flags); ++i) {
if (dpb_values[i] && buf_len > 0) {
@@ -627,15 +661,14 @@
}

/* fire it up baby! */
-   if (isc_attach_database(H->isc_status, 0, vars[0].optval, 
&H->db,(short)(dpb-dpb_buffer),
-   dpb_buffer)) {
+   if (isc_attach_database(H->isc_status, 0, vars[0].optval, 
&H->db,(short)(dpb-dpb_buffer), dpb_buffer)) {
break;
}

dbh->methods = &firebird_methods;
dbh->native_case = PDO_CASE_UPPER;
dbh->alloc_own_columns = 1;
-
+   
ret = 1;

} while (0);
@@ -646,6 +679,14 @@
}
}
 
+   if (!dbh->methods) {
+   char errmsg[512];
+   ISC_STATUS *s = H->isc_status;
+   isc_interprete(errmsg, &s);
+   zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, 
"SQLSTATE[%s] [%d] %s",
+   "HY000", H->isc_status[1], errmsg);
+   }
+
if (!ret) {
firebird_handle_closer(dbh TSRMLS_CC);
}
@@ -654,6 +695,7 @@
 }
 /* }}} */
 
+
 pdo_driver_t pdo_firebird_driver = { /* {{{ */
PDO_DRIVER_HEADER(firebird),
pdo_firebird_handle_factory

-- 
PHP CVS Mailing List (http