Re: MDB2 and single INSERT statement, prepare+execute or just query?

From: Date: Fri, 21 May 2004 18:45:16 +0000
Subject: Re: MDB2 and single INSERT statement, prepare+execute or just query?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-186703@lists.php.net to get a copy of this message
"Michael Hanney" <waxdipped@yahoo.co.uk> wrote in message news:20040521183227.43675.qmail@pb1.pair.com... > Hello, > > I am ditching my own DB abstraction class in favour of MDB2. > When I need to do a sinlge INSERT, should I use MDB2_Driver_Common->prepare > like this.. > $prep = $this->mdb2->prepare('INSERT INTO test (test_id, name) values > (?,?)', $types); > $result = $this->mdb2->executeParams($prep, $types, $data); > OR should I simply use MDB2_Driver_Common->query($sql).. > $res = $this->mdb2->query($sql); > where the $sql contains the pre-formatted INSERT statement? What I really > want to know is - does the prepare method offer any compatibility advantage > (escaping depending on types?), > or is it just for speeding up multiple inserts i.e. prepare once, execute > many. The docs explain how, but not always why. Inserts don't happen very > often in my apps so compatibility accross multiple dbs is more important to > me than speed. Finally, is this the right place to ask questions about MDB2, > or is there a more specific group for discussing Pear projects? > Please send your question to the PEAR mailing list php.pear.general Regards, Torsten Roehr

« previous php.general (#186703) next »