コード例 #1
0
 /**
  * The main method in this class, returns the SQL for INSERTing data into a
  * row.
  *
  * @param  DataRow $row
  * @return string
  */
 public function buildRowSql(DataRow $row)
 {
     // add column names to SQL
     $colNames = array();
     foreach ($row->getColumnValues() as $colValue) {
         $colNames[] = $this->quoteIdentifier($colValue->getColumn()->getName());
     }
     $colVals = array();
     foreach ($row->getColumnValues() as $colValue) {
         $colVals[] = $this->getColumnValueSql($colValue);
     }
     $sql = sprintf('INSERT INTO %s (%s) VALUES (%s);', $this->quoteIdentifier($this->getTable()->getName()), implode(',', $colNames), implode(',', $colVals));
     return $sql . "\n";
 }
コード例 #2
0
ファイル: DataSQLBuilder.php プロジェクト: rozwell/Propel2
 /**
  * The main method in this class, returns the SQL for INSERTing data into a row.
  * @param      DataRow $row The row to process.
  * @return     string
  */
 public function buildRowSql(DataRow $row)
 {
     $sql = "";
     $platform = $this->getPlatform();
     $table = $this->getTable();
     $sql .= "INSERT INTO " . $this->quoteIdentifier($this->getTable()->getName()) . " (";
     // add column names to SQL
     $colNames = array();
     foreach ($row->getColumnValues() as $colValue) {
         $colNames[] = $this->quoteIdentifier($colValue->getColumn()->getName());
     }
     $sql .= implode(',', $colNames);
     $sql .= ") VALUES (";
     $colVals = array();
     foreach ($row->getColumnValues() as $colValue) {
         $colVals[] = $this->getColumnValueSql($colValue);
     }
     $sql .= implode(',', $colVals);
     $sql .= ");\n";
     return $sql;
 }