Re: MDB2 autoPrepare statements
| From: | Michael Gauthier | Date: | Wed, 18 Aug 2010 14:17:34 +0000 |
| Subject: | Re: MDB2 autoPrepare statements | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-30700@lists.php.net to get a copy of this message | ||
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Åï£B¤Ö‘
> C2“úC
>
> $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