I'm using it with MySQL, but I could test it on Postgres and MSSQL.
Don't have any other RMDBS at hand...
Bye,
Stephan
Ralph Schindler schrieb:
> DO you by chance know the availability of this SQL syntax across the board
> of RMDBS? Which RMDBS are you using?
>
> -ralph
>
>
> On 12/3/08 6:08 PM, "Stephan Wentz" <stephan@wentz.it> wrote:
>
>> Is there a method like this planned in Zend_Db?
>>
>> Would be great, and isn't too hard. Something like
>>
>> public function insertSelect($tableName, Zend_Db_Select $select, array
>> $fields = array()) {
>> $fieldString = '';
>> if (count($fields))
>> {
>> foreach($fields as $fieldKey => $field)
>> {
>> $fields[$fieldKey] = $this->quoteIdentifier($field);
>> }
>>
>> $fieldString = ' (' . implode(',', $fields) . ')';
>> }
>>
>> $query = "INSERT INTO ".$this->quoteIdentifier($tableName) .
>> $fieldString . " ";
>> $query .= $select;
>>
>> $this->_db->query($query);
>> }
>>
>> I have several places in my app that need an INSERT INTO ... SELECT
>> statement, right this is the only place where I haven't got database
>> independent code...
>>
>> Bye,
>> Stephan
>>
>
没有评论:
发表评论