yohgaki         Tue Oct  1 22:11:27 2002 EDT

  Added files:                 
    /php4/ext/pgsql/tests       11pg_meta_data.phpt pg_meta_data.inc 

  Removed files:               
    /php4/ext/pgsql/tests       11pg_metadata.phpt pg_metadata.inc 

  Modified files:              
    /php4       NEWS 
    /php4/ext/pgsql     pgsql.c php_pgsql.h 
  Log:
  Rename pg_metadata() to pg_meta_data() to confirm naming standard
  
  
Index: php4/NEWS
diff -u php4/NEWS:1.1164 php4/NEWS:1.1165
--- php4/NEWS:1.1164    Tue Oct  1 06:04:04 2002
+++ php4/NEWS   Tue Oct  1 22:11:26 2002
@@ -7,7 +7,7 @@
 - Fixed bug #17825 (ob_start() chunk size option didn't work well). (Yasuo)
 - Fixed output buffering implicit flush. (Yasuo) 
 - Added getopt() for parsing command line options and arguments. (Jon)
-- Added pg_fetch_assoc(), pg_fetch_all(), pg_metadata(), pg_convert(), 
+- Added pg_fetch_assoc(), pg_fetch_all(), pg_meta_data(), pg_convert(), 
   pg_insert(), pg_select(), pg_update() and pg_delete(). (Yasuo)
 - Fixed bug #17281 (Sanity checks for encoding sessions). (Ilia)
 - Fixed bug #16995 and #19392 (Prevent crash if $HTTP_SESSION_VARS != ARRAY).
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.224 php4/ext/pgsql/pgsql.c:1.225
--- php4/ext/pgsql/pgsql.c:1.224        Mon Sep 30 05:07:57 2002
+++ php4/ext/pgsql/pgsql.c      Tue Oct  1 22:11:26 2002
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: pgsql.c,v 1.224 2002/09/30 09:07:57 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.225 2002/10/02 02:11:26 yohgaki Exp $ */
 
 #include <stdlib.h>
 
@@ -146,7 +146,7 @@
        PHP_FE(pg_set_client_encoding,  NULL)
 #endif
        /* misc function */
-       PHP_FE(pg_metadata,     NULL)
+       PHP_FE(pg_meta_data,     NULL)
        PHP_FE(pg_convert,      NULL)
        PHP_FE(pg_insert,       NULL)
        PHP_FE(pg_update,       NULL)
@@ -2809,10 +2809,10 @@
 }
 /* }}} */
 
-/* {{{ php_pgsql_metadata
- * TODO: Add metadata cache for better performance
+/* {{{ php_pgsql_meta_data
+ * TODO: Add meta_data cache for better performance
  */
-PHPAPI int php_pgsql_metadata(PGconn *pg_link, const char *table_name, zval *meta 
TSRMLS_DC) 
+PHPAPI int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta 
+TSRMLS_DC) 
 {
        PGresult *pg_result;
        char *tmp_name;
@@ -2835,7 +2835,7 @@
        
        pg_result = PQexec(pg_link, querystr.c);
        if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = 
PQntuples(pg_result)) == 0) {
-               php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to query metadata 
for '%s' table %s", table_name, querystr.c);
+               php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to query meta_data 
+for '%s' table %s", table_name, querystr.c);
                smart_str_free(&querystr);
                PQclear(pg_result);
                return FAILURE;
@@ -2871,9 +2871,9 @@
 /* }}} */
 
 
-/* {{{ proto array pg_metadata(resource db, string table)
-   Get metadata */
-PHP_FUNCTION(pg_metadata)
+/* {{{ proto array pg_meta_data(resource db, string table)
+   Get meta_data */
+PHP_FUNCTION(pg_meta_data)
 {
        zval *pgsql_link;
        char *table_name;
@@ -2889,7 +2889,7 @@
        ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", 
le_link, le_plink);
        
        array_init(return_value);
-       if (php_pgsql_metadata(pgsql, table_name, return_value TSRMLS_CC) == FAILURE) {
+       if (php_pgsql_meta_data(pgsql, table_name, return_value TSRMLS_CC) == FAILURE) 
+{
                zval_dtor(return_value); /* destroy array */
                RETURN_FALSE;
        }
@@ -3094,7 +3094,7 @@
                FREE_ZVAL(meta);
                return FAILURE;
        }
-       if (php_pgsql_metadata(pg_link, table_name, meta TSRMLS_CC) == FAILURE) {
+       if (php_pgsql_meta_data(pg_link, table_name, meta TSRMLS_CC) == FAILURE) {
                zval_dtor(meta);
                FREE_ZVAL(meta);
                return FAILURE;
Index: php4/ext/pgsql/php_pgsql.h
diff -u php4/ext/pgsql/php_pgsql.h:1.48 php4/ext/pgsql/php_pgsql.h:1.49
--- php4/ext/pgsql/php_pgsql.h:1.48     Mon Sep 30 05:07:57 2002
+++ php4/ext/pgsql/php_pgsql.h  Tue Oct  1 22:11:27 2002
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: php_pgsql.h,v 1.48 2002/09/30 09:07:57 yohgaki Exp $ */
+/* $Id: php_pgsql.h,v 1.49 2002/10/02 02:11:27 yohgaki Exp $ */
 
 #ifndef PHP_PGSQL_H
 #define PHP_PGSQL_H
@@ -130,7 +130,7 @@
 #endif
 
 /* misc functions */
-PHP_FUNCTION(pg_metadata);
+PHP_FUNCTION(pg_meta_data);
 PHP_FUNCTION(pg_convert);
 PHP_FUNCTION(pg_insert);
 PHP_FUNCTION(pg_update);
@@ -149,7 +149,7 @@
 #define PGSQL_DML_STRING            (1<<11)    /* Return query string */
 
 /* exported functions */
-PHPAPI int php_pgsql_metadata(PGconn *pg_link, const char *table_name, zval *meta 
TSRMLS_DC);
+PHPAPI int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta 
+TSRMLS_DC);
 PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval 
*values, zval *result, ulong opt TSRMLS_DC);
 PHPAPI int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, ulong 
opt, char **sql TSRMLS_DC);
 PHPAPI int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval 
*ids, ulong opt , char **sql TSRMLS_DC);

Index: php4/ext/pgsql/tests/11pg_meta_data.phpt
+++ php4/ext/pgsql/tests/11pg_meta_data.phpt
--TEST--
PostgreSQL pg_metadata()
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
include("pg_meta_data.inc");
?>
--EXPECT--
array(3) {
  ["num"]=>
  array(5) {
    ["num"]=>
    int(1)
    ["type"]=>
    string(4) "int4"
    ["len"]=>
    int(4)
    ["not null"]=>
    bool(false)
    ["has default"]=>
    bool(false)
  }
  ["str"]=>
  array(5) {
    ["num"]=>
    int(2)
    ["type"]=>
    string(4) "text"
    ["len"]=>
    int(-1)
    ["not null"]=>
    bool(false)
    ["has default"]=>
    bool(false)
  }
  ["bin"]=>
  array(5) {
    ["num"]=>
    int(3)
    ["type"]=>
    string(5) "bytea"
    ["len"]=>
    int(-1)
    ["not null"]=>
    bool(false)
    ["has default"]=>
    bool(false)
  }
}

Index: php4/ext/pgsql/tests/pg_meta_data.inc
+++ php4/ext/pgsql/tests/pg_meta_data.inc
<?php
error_reporting(E_ALL);

include 'config.inc';

$db = pg_connect($conn_str);

$meta = pg_meta_data($db, $table_name);

var_dump($meta);


?>



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

Reply via email to