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/tests        003.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.217&r2=1.218&ty=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);
        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);
-       REGISTER_LONG_CONSTANT("IBASE_TIME", PHP_IBASE_TIME, CONST_PERSISTENT);
 
        /* transactions */
        REGISTER_LONG_CONSTANT("IBASE_WRITE", PHP_IBASE_WRITE, CONST_PERSISTENT);
@@ -495,21 +490,6 @@
        IBG(default_link)= -1;
        IBG(num_links) = IBG(num_persistent);
 
-       if (IBG(timestampformat)) {
-               DL_FREE(IBG(timestampformat));
-       }
-       IBG(timestampformat) = DL_STRDUP(IBG(cfg_timestampformat));
-
-       if (IBG(dateformat)) {
-               DL_FREE(IBG(dateformat));
-       }
-       IBG(dateformat) = DL_STRDUP(IBG(cfg_dateformat));
-
-       if (IBG(timeformat)) {
-               DL_FREE(IBG(timeformat));
-       }
-       IBG(timeformat) = DL_STRDUP(IBG(cfg_timeformat));
-
        RESET_ERRMSG;
 
        return SUCCESS;
@@ -542,21 +522,6 @@
 
 PHP_RSHUTDOWN_FUNCTION(ibase)
 {
-       if (IBG(timestampformat)) {
-               DL_FREE(IBG(timestampformat));
-       }
-       IBG(timestampformat) = NULL;
-
-       if (IBG(dateformat)) {
-               DL_FREE(IBG(dateformat));
-       }
-       IBG(dateformat) = NULL;
-
-       if (IBG(timeformat)) {
-               DL_FREE(IBG(timeformat));
-       }
-       IBG(timeformat) = NULL;
-
        return SUCCESS;
 } 
  
@@ -565,7 +530,12 @@
        char tmp[64], *s;
 
        php_info_print_table_start();
-       php_info_print_table_row(2, "Interbase Support", "enabled");
+       php_info_print_table_row(2, "Firebird/InterBase Support", 
+#ifdef COMPILE_DL_INTERBASE
+               "dynamic");
+#else
+               "static");
+#endif
 
 #ifdef FB_API_VER
        sprintf( (s = tmp), "Firebird API version %d", FB_API_VER);
@@ -600,29 +570,7 @@
        } while (0);
 #endif                 
 
-       php_info_print_table_row(2, "Revision", FILE_REVISION);
-#ifdef COMPILE_DL_INTERBASE
-       php_info_print_table_row(2, "Dynamic Module", "Yes");
-#endif
-       php_info_print_table_row(2, "Allow Persistent Links", (IBG(allow_persistent) ? 
"Yes" : "No"));
-
-       if (IBG(max_persistent) == -1) {
-               sprintf(tmp, "%ld/unlimited", IBG(num_persistent));
-       } else {
-               sprintf(tmp, "%ld/%ld", IBG(num_persistent), IBG(max_persistent));
-       }
-       php_info_print_table_row(2, "Persistent Links", tmp);
-
-       if (IBG(max_links) == -1) {
-               sprintf(tmp, "%ld/unlimited", IBG(num_links));
-       } else {
-               sprintf(tmp, "%ld/%ld", IBG(num_links), IBG(max_links));
-       }
-       php_info_print_table_row(2, "Total Links", tmp);
-
-       php_info_print_table_row(2, "Timestamp Format", IBG(timestampformat));
-       php_info_print_table_row(2, "Date Format", IBG(dateformat));
-       php_info_print_table_row(2, "Time Format", IBG(timeformat));
+       DISPLAY_INI_ENTRIES();
 
        php_info_print_table_end();
 }
@@ -1188,45 +1136,6 @@
 PHP_FUNCTION(ibase_rollback_ret)
 {
        _php_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, ROLLBACK | RETAIN);
-}
-/* }}} */
-
-/* {{{ proto bool ibase_timefmt(string format [, int type ])
-   Sets the format of timestamp, date and time columns returned from queries */
-PHP_FUNCTION(ibase_timefmt)
-{
-       char *fmt;
-       int fmt_len;
-       long type = PHP_IBASE_TIMESTAMP;
-       
-       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &fmt, 
&fmt_len, &type)) {
-               RETURN_FALSE;
-       }
-
-       switch (type) {
-               case PHP_IBASE_TIMESTAMP:
-                       if (IBG(timestampformat)) {
-                               DL_FREE(IBG(timestampformat));
-                       }
-                       IBG(timestampformat) = DL_STRDUP(fmt);
-                       break;
-               case PHP_IBASE_DATE:
-                       if (IBG(dateformat)) {
-                               DL_FREE(IBG(dateformat));
-                       }
-                       IBG(dateformat) = DL_STRDUP(fmt);
-                       break;
-               case PHP_IBASE_TIME:
-                       if (IBG(timeformat)) {
-                               DL_FREE(IBG(timeformat));
-                       }
-                       IBG(timeformat) = DL_STRDUP(fmt);
-                       break;
-               default:
-                       RETURN_FALSE;
-       }
-
-       RETURN_TRUE;
 }
 /* }}} */
 
http://cvs.php.net/diff.php/php-src/ext/interbase/php_ibase_includes.h?r1=1.11&r2=1.12&ty=u
Index: php-src/ext/interbase/php_ibase_includes.h
diff -u php-src/ext/interbase/php_ibase_includes.h:1.11 
php-src/ext/interbase/php_ibase_includes.h:1.12
--- php-src/ext/interbase/php_ibase_includes.h:1.11     Fri May 28 19:39:33 2004
+++ php-src/ext/interbase/php_ibase_includes.h  Sun May 30 12:20:25 2004
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_ibase_includes.h,v 1.11 2004/05/28 23:39:33 abies Exp $ */
+/* $Id: php_ibase_includes.h,v 1.12 2004/05/30 16:20:25 abies Exp $ */
 
 #ifndef PHP_IBASE_INCLUDES_H
 #define PHP_IBASE_INCLUDES_H
@@ -64,7 +64,6 @@
        long allow_persistent;
        char *default_db, *default_user, *default_password, *default_charset;
        char *timestampformat, *dateformat, *timeformat;
-       char *cfg_timestampformat, *cfg_dateformat, *cfg_timeformat;
        char errmsg[MAX_ERRMSG];
        long sql_code;
 ZEND_END_MODULE_GLOBALS(ibase)
@@ -115,10 +114,6 @@
        PHP_IBASE_FETCH_BLOBS           = 1,
        PHP_IBASE_FETCH_ARRAYS      = 2,
        PHP_IBASE_UNIXTIME                      = 4,
-       /* timefmt flags */
-       PHP_IBASE_TIMESTAMP             = 1,
-       PHP_IBASE_DATE                          = 2,
-       PHP_IBASE_TIME                          = 4,
        /* transaction access mode */
        PHP_IBASE_WRITE                         = 1,
        PHP_IBASE_READ                          = 2,
http://cvs.php.net/diff.php/php-src/ext/interbase/tests/003.phpt?r1=1.9&r2=1.10&ty=u
Index: php-src/ext/interbase/tests/003.phpt
diff -u php-src/ext/interbase/tests/003.phpt:1.9 
php-src/ext/interbase/tests/003.phpt:1.10
--- php-src/ext/interbase/tests/003.phpt:1.9    Fri May 21 10:24:34 2004
+++ php-src/ext/interbase/tests/003.phpt        Sun May 30 12:20:25 2004
@@ -3,7 +3,7 @@
 --SKIPIF--
 <?php include("skipif.inc"); ?>
 --FILE--
-<?php /* $Id: 003.phpt,v 1.9 2004/05/21 14:24:34 abies Exp $ */
+<?php /* $Id: 003.phpt,v 1.10 2004/05/30 16:20:25 abies Exp $ */
 
     require("interbase.inc");
     ibase_connect($test_base);
@@ -31,7 +31,7 @@
        @ibase_query("insert into test3 (iter) values (?)", null);
 
     /* if timefmt is not supported, suppress error here */
-    @ibase_timefmt("%m/%d/%Y %H:%M:%S");
+    ini_set('ibase.timestampformat',"%m/%d/%Y %H:%M:%S");
 
     for($iter = 0; $iter < 10; $iter++){
        /* prepare data  */
http://cvs.php.net/diff.php/php-src/ext/interbase/tests/006.phpt?r1=1.10&r2=1.11&ty=u
Index: php-src/ext/interbase/tests/006.phpt
diff -u php-src/ext/interbase/tests/006.phpt:1.10 
php-src/ext/interbase/tests/006.phpt:1.11
--- php-src/ext/interbase/tests/006.phpt:1.10   Wed May 19 04:54:52 2004
+++ php-src/ext/interbase/tests/006.phpt        Sun May 30 12:20:25 2004
@@ -3,7 +3,7 @@
 --SKIPIF--
 <?php include("skipif.inc"); ?>
 --FILE--
-<?php /* $Id: 006.phpt,v 1.10 2004/05/19 08:54:52 helly Exp $ */
+<?php /* $Id: 006.phpt,v 1.11 2004/05/30 16:20:25 abies Exp $ */
 
        require("interbase.inc");
        
@@ -32,7 +32,7 @@
        ibase_commit();
 
        /* if timefmt not supported, hide error */
-       @ibase_timefmt("%m/%d/%Y %H:%M:%S");
+       ini_set('ibase.timestampformat',"%m/%d/%Y %H:%M:%S");
 
        echo "insert\n";
 
@@ -54,7 +54,7 @@
                        values (?,?,?,?,?,?,?,?,?,?)",
                        $iter, $v_char, $v_date, $v_decimal, $v_double, $v_float,
                        $v_integer, $v_numeric, $v_smallint, $v_varchar);
-               $sel = ibase_query("select * from test6 where iter = $iter");
+               $sel = ibase_query("select * from test6 where iter = ?", $iter);
 
                $row = ibase_fetch_object($sel);
                if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char) {
http://cvs.php.net/diff.php/php-src/ext/interbase/tests/007.phpt?r1=1.3&r2=1.4&ty=u
Index: php-src/ext/interbase/tests/007.phpt
diff -u php-src/ext/interbase/tests/007.phpt:1.3 
php-src/ext/interbase/tests/007.phpt:1.4
--- php-src/ext/interbase/tests/007.phpt:1.3    Wed May 19 04:54:52 2004
+++ php-src/ext/interbase/tests/007.phpt        Sun May 30 12:20:25 2004
@@ -3,7 +3,7 @@
 --SKIPIF--
 <?php include("skipif.inc"); ?>
 --FILE--
-<?php /* $Id: 007.phpt,v 1.3 2004/05/19 08:54:52 helly Exp $ */
+<?php /* $Id: 007.phpt,v 1.4 2004/05/30 16:20:25 abies Exp $ */
 
        require("interbase.inc");
        
@@ -26,7 +26,7 @@
        ibase_commit();
 
        /* if timefmt not supported, hide error */
-       @ibase_timefmt("%m/%d/%Y %H:%M:%S");
+       ini_set('ibase.timestampformat',"%m/%d/%Y %H:%M:%S");
 
        echo "insert\n";
        

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

Reply via email to