cvs: pecl /dbdo dbdo.c

From: Date: Thu, 07 Apr 2005 14:02:51 +0000
Subject: cvs: pecl /dbdo dbdo.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-2945@lists.php.net to get a copy of this message
alan_k Thu Apr 7 10:02:51 2005 EDT Modified files: /pecl/dbdo dbdo.c Log: copy add_assoc_long for use with hashes directly http://cvs.php.net/diff.php/pecl/dbdo/dbdo.c?r1=1.88&r2=1.89&ty=u Index: pecl/dbdo/dbdo.c diff -u pecl/dbdo/dbdo.c:1.88 pecl/dbdo/dbdo.c:1.89 --- pecl/dbdo/dbdo.c:1.88 Thu Apr 7 08:49:08 2005 +++ pecl/dbdo/dbdo.c Thu Apr 7 10:02:51 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dbdo.c,v 1.88 2005/04/07 12:49:08 alan_k Exp $ */ +/* $Id: dbdo.c,v 1.89 2005/04/07 14:02:51 alan_k Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -392,18 +392,17 @@ /* }}} */ -#define DBDO_ADD_CONSTANT_LONG(_name, _val) \ - { \ - zval *_const; \ - ALLOC_ZVAL(_const); \ - ZVAL_LONG(_const, _val); \ - zend_hash_add( \ - &dbdo_class_entry_ce->constants_table, \ - _name, strlen(_name)+1, \ - &_const, sizeof(zval *), NULL); \ - } - +#define hash_add_assoc_long(__arg, __key, __val) hash_add_assoc_long_ex(__arg, __key, strlen(__key), __val) + +int hash_add_assoc_long_ex(HashTable *arg, char *key, uint key_len, long n) +{ + zval *tmp; + MAKE_STD_ZVAL(tmp); + ZVAL_LONG(tmp, n); + + return zend_symtable_update(arg, key, key_len, (void *) &tmp, sizeof(zval *), NULL); +} /* Remove if there's nothing to do at request start */ /* {{{ PHP_RINIT_FUNCTION */ @@ -418,14 +417,17 @@ le_new; zend_hash_init(&dbdo_class_entry_ce->constants_table, 0, NULL, NULL, 1); - - DBDO_ADD_CONSTANT_LONG("OBJECTS", 0); - DBDO_ADD_CONSTANT_LONG("KEY_VALUE", 1); - DBDO_ADD_CONSTANT_LONG("BUILD", 1); - DBDO_ADD_CONSTANT_LONG("VALUE", 3); - DBDO_ADD_CONSTANT_LONG("SINGLE", 3); - DBDO_ADD_CONSTANT_LONG("E_ALL", 3); - DBDO_ADD_CONSTANT_LONG("E_FULL", 63); + /* fetch all returns */ + hash_add_assoc_long(&dbdo_class_entry_ce->constants_table, "OBJECTS", 0); + hash_add_assoc_long(&dbdo_class_entry_ce->constants_table, "KEY_VALUE", 1); + hash_add_assoc_long(&dbdo_class_entry_ce->constants_table, "VALUE", 2); + hash_add_assoc_long(&dbdo_class_entry_ce->constants_table, "SINGLE", 3); + /* update/delete build or use fetchedobject. */ + hash_add_assoc_long(&dbdo_class_entry_ce->constants_table, "BUILD", 1); + /* error constants */ + hash_add_assoc_long(&dbdo_class_entry_ce->constants_table, "E_ALL", 3); + hash_add_assoc_long(&dbdo_class_entry_ce->constants_table, "E_FULL", 63); + /* make sure we are connected on each request */ @@ -583,7 +585,7 @@ GdaProviderInfo *info; php_info_print_table_start(); php_info_print_table_header(2, "DBDO support", "enabled"); - php_info_print_table_row(2, "CVS id", "$Id: dbdo.c,v 1.88 2005/04/07 12:49:08 alan_k Exp $"); + php_info_print_table_row(2, "CVS id", "$Id: dbdo.c,v 1.89 2005/04/07 14:02:51 alan_k Exp $"); prov_list = gda_config_get_provider_list ();

« previous php.pecl.cvs (#2945) next »