Ubiquity  2.0.2
php rapid development framework
SqlExport.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Ubiquity\db\export;
4 
6 
7 class SqlExport extends DataExport {
8 
9  public function __construct($batchSize=5) {
10  parent::__construct($batchSize);
11  }
12 
13  public function exports($tableName, $fields, $condition="") {
14  $datas=DAO::$db->prepareAndExecute($tableName, $condition, $fields, false);
15  return $this->generateInsert($tableName, $fields, $datas);
16  }
17 
18  protected function batchOneRow($row, $fields) {
19  $result=[ ];
20  foreach ( $fields as $field ) {
21  $result[]="'" . $row[$field] . "'";
22  }
23  return \implode(",", $result);
24  }
25 }
__construct($batchSize=5)
Definition: SqlExport.php:9
generateInsert($table, $fields, $datas)
Definition: DataExport.php:14
static $db
Definition: DAO.php:22
batchOneRow($row, $fields)
Definition: SqlExport.php:18
exports($tableName, $fields, $condition="")
Definition: SqlExport.php:13