From: Bradley Slavik on 17 Aug 2010 09:25 Dear MDB2 users, I have scoured through the MDB2 documentation, but have been unable to locate any documentation on the types array that can be passed to the autoPrepare command. Actually the problem may be the documentation for the MDB2 Prepare command which is called behind the scenes by autoPrepare. Looking at : http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Common.html#methodprepare we find in documentation: prepare [line 2933] mixed &prepare( string $query, [mixed $types = null], [mixed $result_types = null], [mixed $lobs = array()]) What are the valid values I can send in for the individual types? I find the following reference at http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Datatype_Common.html $valid_default_values = array( 'text' => '', 'boolean' => true, 'integer' => 0, 'decimal' => 0.0, 'float' => 0.0, 'timestamp' => '1970-01-01 00:00:00', 'time' => '00:00:00', 'date' => '1970-01-01', 'clob' => '', 'blob' => '', ) So, are these the types that can be used? I was hoping to be able to map these from their names to the values returned by this mysql statement: $result = mysql_query('SHOW COLUMNS FROM ' . $table_name); Thanks for helping out here. If there is a reference that I missed short of digging through all the layers of code and finding it seven layers deep, please point me at it. Otherwise, thank you for sharing your superior knowledge. Bradley Slavik
From: Michael Gauthier on 18 Aug 2010 10:17 On Tue, 2010-08-17 at 08:25 -0500, Bradley Slavik wrote: > Dear MDB2 users, > > I have scoured through the MDB2 documentation, but have been unable to locate any documentation on the types array that can be passed to the autoPrepare command. Actually the problem may be the documentation for the MDB2 Prepare command which is called behind the scenes by autoPrepare. > > > Looking at : > > http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Common.html#methodprepare > > we find in documentation: > > prepare [line 2933] > mixed &prepare( string $query, [mixed $types = null], [mixed $result_types = null], [mixed $lobs = array()]) > > What are the valid values I can send in for the individual types? I find the following reference at > http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Datatype_Common.html > > $valid_default_values = array( > 'text' => '', > 'boolean' => true, > 'integer' => 0, > 'decimal' => 0.0, > 'float' => 0.0, > 'timestamp' => '1970-01-01 00:00:00', > 'time' => '00:00:00', > 'date' => '1970-01-01', > 'clob' => '', > 'blob' => '', > ) > > > So, are these the types that can be used? I was hoping to be able to map these from their names to the values returned by this mysql statement: > > $result = mysql_query('SHOW COLUMNS FROM ' . $table_name); > > Thanks for helping out here. If there is a reference that I missed short of digging through all the layers of code and > finding it seven layers deep, please point me at it. Otherwise, thank you for sharing your superior knowledge. > Hi Bradley, Those are the types that can be used with MDB2. There is more detailed documentation about MDB2 types at http://pear.php.net/manual/en/package.database.mdb2.datatypes.php I'm not sure what column types MySQL uses with 'SHOW COLUMNS' (I'm a PostgreSQL user) so I can't help you there. Cheers, Mike
|
Pages: 1 Prev: PEAR Elections 2010 Next: [ANNOUNCEMENT] Net_Nmap-1.0.3 (stable) Released. |