cvs: pecl /dbdo dbdo.c /dbdo/examples assignFrom.php call.php delete.php factory.php fetchAll.php info.php insert.php keys.php mortgagecalc.php
schema.php toArray.php update.php valueGet.php valueSet.php

From: Date: Tue, 22 Mar 2005 12:55:08 +0000
Subject: cvs: pecl /dbdo dbdo.c /dbdo/examples assignFrom.php call.php delete.php factory.php fetchAll.php info.php insert.php keys.php mortgagecalc.php
schema.php toArray.php update.php valueGet.php valueSet.php
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-2882@lists.php.net to get a copy of this message
alan_k Tue Mar 22 07:55:08 2005 EDT Modified files: /pecl/dbdo dbdo.c /pecl/dbdo/examples assignFrom.php call.php delete.php factory.php fetchAll.php info.php insert.php keys.php mortgagecalc.php schema.php toArray.php update.php valueGet.php valueSet.php Log: change most of the examples to use the new config for setting up the connection, fix the insert issue.

http://cvs.php.net/diff.php/pecl/dbdo/dbdo.c?r1=1.72&r2=1.73&ty=u Index: pecl/dbdo/dbdo.c diff -u pecl/dbdo/dbdo.c:1.72 pecl/dbdo/dbdo.c:1.73 --- pecl/dbdo/dbdo.c:1.72 Thu Mar 17 03:13:50 2005 +++ pecl/dbdo/dbdo.c Tue Mar 22 07:55:06 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dbdo.c,v 1.72 2005/03/17 08:13:50 alan_k Exp $ */ +/* $Id: dbdo.c,v 1.73 2005/03/22 12:55:06 alan_k Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -601,7 +601,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.72 2005/03/17 08:13:50 alan_k Exp $"); + php_info_print_table_row(2, "CVS id", "$Id: dbdo.c,v 1.73 2005/03/22 12:55:06 alan_k Exp $"); prov_list = gda_config_get_provider_list (); @@ -2680,22 +2680,27 @@ /* make the dataset for the object from the args.. */ /* TODO: add the autoinc col. */ - - { GdaDataModel *model; int i,no_cols=0; GList *value_list = NULL; + + /* work out how may columns we have.. */ for (i=0;i<rows;i++) { if (result_cols[i] != NULL) { no_cols++; } } /* printf("got %d rows\n", no_cols); */ - + + /* pop the sequence column as the first item in the data array */ + obj->result = gda_data_model_array_new (no_cols+1); gda_data_model_set_column_title (obj->result, 0,obj->table->sequenceColumn); - value_list = g_list_append (value_list, gda_value_new_from_string (ret_str, GDA_VALUE_TYPE_INTEGER) ); + + value_list = g_list_append (value_list, gda_value_new_from_string (ret_str, GDA_VALUE_TYPE_INTEGER)); + + no_cols = 1; for (i=0;i<rows;i++) { if (result_cols[i] == NULL) { @@ -2704,17 +2709,19 @@ /* printf("adding row %d: %s\n", no_cols,result_cols[i]); */ gda_data_model_set_column_title (obj->result, no_cols,result_cols[i]); /* printf("adding value %s\n", gda_value_stringify(result_values[i])); */ - value_list = g_list_append (value_list,result_values[i]); + value_list = g_list_append (value_list, result_values[i]); + + no_cols++; } - if (!gda_data_model_append_row (obj->result, value_list)) { + if (!gda_data_model_append_values (GDA_DATA_MODEL (obj->result), value_list)) { DBDO_DEBUG0(1,"error inserting rows."); return; } - g_list_foreach (value_list, (GFunc) gda_value_free, NULL); - g_list_free (value_list); + g_list_foreach (value_list, (GFunc) gda_value_free, NULL); + g_list_free (value_list); g_object_ref(obj->result); @@ -3849,3 +3856,4 @@ } + http://cvs.php.net/diff.php/pecl/dbdo/examples/assignFrom.php?r1=1.2&r2=1.3&ty=u Index: pecl/dbdo/examples/assignFrom.php diff -u pecl/dbdo/examples/assignFrom.php:1.2 pecl/dbdo/examples/assignFrom.php:1.3 --- pecl/dbdo/examples/assignFrom.php:1.2 Sat Nov 27 06:45:41 2004 +++ pecl/dbdo/examples/assignFrom.php Tue Mar 22 07:55:08 2005 @@ -8,7 +8,8 @@ } // set up source test to use database test.. -dbdo::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); //dbdo::connectSignal('debug','debug'); // connect to source test, table test.. http://cvs.php.net/diff.php/pecl/dbdo/examples/call.php?r1=1.1&r2=1.2&ty=u Index: pecl/dbdo/examples/call.php diff -u pecl/dbdo/examples/call.php:1.1 pecl/dbdo/examples/call.php:1.2 --- pecl/dbdo/examples/call.php:1.1 Sat Dec 4 09:28:33 2004 +++ pecl/dbdo/examples/call.php Tue Mar 22 07:55:08 2005 @@ -8,7 +8,8 @@ // set up source test to use database test.. -dbdo::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); DBDO::debugLevel(1); $x = new DBDO('test', 'test'); http://cvs.php.net/diff.php/pecl/dbdo/examples/delete.php?r1=1.3&r2=1.4&ty=u Index: pecl/dbdo/examples/delete.php diff -u pecl/dbdo/examples/delete.php:1.3 pecl/dbdo/examples/delete.php:1.4 --- pecl/dbdo/examples/delete.php:1.3 Sat Jan 8 04:32:08 2005 +++ pecl/dbdo/examples/delete.php Tue Mar 22 07:55:08 2005 @@ -6,7 +6,8 @@ // set up source test to use database test.. -dbdo::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); dbdo::debugLevel(1); http://cvs.php.net/diff.php/pecl/dbdo/examples/factory.php?r1=1.4&r2=1.5&ty=u Index: pecl/dbdo/examples/factory.php diff -u pecl/dbdo/examples/factory.php:1.4 pecl/dbdo/examples/factory.php:1.5 --- pecl/dbdo/examples/factory.php:1.4 Tue Nov 23 00:32:18 2004 +++ pecl/dbdo/examples/factory.php Tue Mar 22 07:55:08 2005 @@ -35,7 +35,8 @@ // set up source test to use database test.. -DBDO::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); DBDO::debugLevel(1); DBDO::config("test", "class_name", "Test_%s"); http://cvs.php.net/diff.php/pecl/dbdo/examples/fetchAll.php?r1=1.6&r2=1.7&ty=u Index: pecl/dbdo/examples/fetchAll.php diff -u pecl/dbdo/examples/fetchAll.php:1.6 pecl/dbdo/examples/fetchAll.php:1.7 --- pecl/dbdo/examples/fetchAll.php:1.6 Sat Jan 8 04:32:08 2005 +++ pecl/dbdo/examples/fetchAll.php Tue Mar 22 07:55:08 2005 @@ -8,7 +8,8 @@ // set up source test to use database test.. -dbdo::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); dbdo::debugLevel(1); http://cvs.php.net/diff.php/pecl/dbdo/examples/info.php?r1=1.6&r2=1.7&ty=u Index: pecl/dbdo/examples/info.php diff -u pecl/dbdo/examples/info.php:1.6 pecl/dbdo/examples/info.php:1.7 --- pecl/dbdo/examples/info.php:1.6 Sat Jan 15 22:16:11 2005 +++ pecl/dbdo/examples/info.php Tue Mar 22 07:55:08 2005 @@ -4,7 +4,8 @@ dl('dbdo.' . PHP_SHLIB_SUFFIX); } // set up source test to use database test.. -dbdo::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); DBDO::debugLevel(DBDO::E_ALL); $x = new DBDO('test', 'test'); http://cvs.php.net/diff.php/pecl/dbdo/examples/insert.php?r1=1.4&r2=1.5&ty=u Index: pecl/dbdo/examples/insert.php diff -u pecl/dbdo/examples/insert.php:1.4 pecl/dbdo/examples/insert.php:1.5 --- pecl/dbdo/examples/insert.php:1.4 Sat Jan 8 04:32:08 2005 +++ pecl/dbdo/examples/insert.php Tue Mar 22 07:55:08 2005 @@ -8,7 +8,8 @@ } // set up source test to use database test.. -dbdo::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); dbdo::debugLevel(DBDO::E_ALL); // connect to source test, table test.. http://cvs.php.net/diff.php/pecl/dbdo/examples/keys.php?r1=1.1&r2=1.2&ty=u Index: pecl/dbdo/examples/keys.php diff -u pecl/dbdo/examples/keys.php:1.1 pecl/dbdo/examples/keys.php:1.2 --- pecl/dbdo/examples/keys.php:1.1 Fri Dec 10 23:45:30 2004 +++ pecl/dbdo/examples/keys.php Tue Mar 22 07:55:08 2005 @@ -7,7 +7,8 @@ // set up source test to use database test.. -DBDO::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); DBDO::debugLevel(DBDO::E_ALL); $x = new DBDO('test', 'typetest'); http://cvs.php.net/diff.php/pecl/dbdo/examples/mortgagecalc.php?r1=1.5&r2=1.6&ty=u Index: pecl/dbdo/examples/mortgagecalc.php diff -u pecl/dbdo/examples/mortgagecalc.php:1.5 pecl/dbdo/examples/mortgagecalc.php:1.6 --- pecl/dbdo/examples/mortgagecalc.php:1.5 Sun Nov 28 19:47:52 2004 +++ pecl/dbdo/examples/mortgagecalc.php Tue Mar 22 07:55:08 2005 @@ -17,7 +17,8 @@ // set up source test to use database test.. -DBDO::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); //DBDO::debugLevel(1); $x = new DBDO("test","test"); http://cvs.php.net/diff.php/pecl/dbdo/examples/schema.php?r1=1.3&r2=1.4&ty=u Index: pecl/dbdo/examples/schema.php diff -u pecl/dbdo/examples/schema.php:1.3 pecl/dbdo/examples/schema.php:1.4 --- pecl/dbdo/examples/schema.php:1.3 Sat Nov 13 10:07:45 2004 +++ pecl/dbdo/examples/schema.php Tue Mar 22 07:55:08 2005 @@ -1,4 +1,6 @@ <?php +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); $x = new DBDO('test','typetest'); $s = $x->schema(); http://cvs.php.net/diff.php/pecl/dbdo/examples/toArray.php?r1=1.3&r2=1.4&ty=u Index: pecl/dbdo/examples/toArray.php diff -u pecl/dbdo/examples/toArray.php:1.3 pecl/dbdo/examples/toArray.php:1.4 --- pecl/dbdo/examples/toArray.php:1.3 Tue Nov 23 00:32:18 2004 +++ pecl/dbdo/examples/toArray.php Tue Mar 22 07:55:08 2005 @@ -8,7 +8,8 @@ // set up source test to use database test.. -DBDO::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); DBDO::debugLevel(1); http://cvs.php.net/diff.php/pecl/dbdo/examples/update.php?r1=1.4&r2=1.5&ty=u Index: pecl/dbdo/examples/update.php diff -u pecl/dbdo/examples/update.php:1.4 pecl/dbdo/examples/update.php:1.5 --- pecl/dbdo/examples/update.php:1.4 Sat Dec 11 22:55:35 2004 +++ pecl/dbdo/examples/update.php Tue Mar 22 07:55:08 2005 @@ -6,7 +6,8 @@ } // set up source test to use database test.. -DBDO::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); DBDO::debugLevel(DBDO::E_ALL); $x = new DBDO('test', 'test'); http://cvs.php.net/diff.php/pecl/dbdo/examples/valueGet.php?r1=1.1&r2=1.2&ty=u Index: pecl/dbdo/examples/valueGet.php diff -u pecl/dbdo/examples/valueGet.php:1.1 pecl/dbdo/examples/valueGet.php:1.2 --- pecl/dbdo/examples/valueGet.php:1.1 Sat Nov 27 11:40:59 2004 +++ pecl/dbdo/examples/valueGet.php Tue Mar 22 07:55:08 2005 @@ -7,7 +7,9 @@ // set up source test to use database test.. -DBDO::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); + DBDO::debugLevel(DBDO::E_ALL); DBDO::config("test", "class_name", "Test_%s"); http://cvs.php.net/diff.php/pecl/dbdo/examples/valueSet.php?r1=1.2&r2=1.3&ty=u Index: pecl/dbdo/examples/valueSet.php diff -u pecl/dbdo/examples/valueSet.php:1.2 pecl/dbdo/examples/valueSet.php:1.3 --- pecl/dbdo/examples/valueSet.php:1.2 Sat Nov 27 07:00:30 2004 +++ pecl/dbdo/examples/valueSet.php Tue Mar 22 07:55:08 2005 @@ -7,7 +7,9 @@ } // set up source test to use database test.. -dbdo::saveDataSource("test","MySQL","DATABASE=test", "test database", "alan",""); +DBDO::config('test','provider','MySQL'); +DBDO::config('test','cnc','DATABASE=test;USER=alan'); + dbdo::debugLevel(DBDO::E_ALL); class x {
« previous php.pecl.cvs (#2882) next »