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
没有评论:
发表评论