'pdo' => 'sqlite:/opt/semantico/product/releases/sem_ui/db/semantico.db',
'default_table' => 'node',
+ 'sql_exec' => [
+ 'SET SESSION sql_mode=PIPES_AS_CONCAT',
+ ],
+
'sql_replace' => function($sql) {
if (!Db::p('db.type')) return $sql;
$r = [];
if (empty($this->conn)) return false;
# Type queries
- if ($sql = $this->type('exec')) {
- if (is_scalar($sql)) $sql = array($sql);
- foreach ($sql as $s) {
- if (!empty($s)) $this->conn->exec($s);
- }
+ foreach ($this->sql_exec() as $s) {
+ $this->conn->exec($s);
}
# Create functions
$type = self::p('type','');
$name = self::p('name','');
- if ($sql = $this->type('exec')) {
- foreach ((is_array($sql) ? $sql : array($sql)) as $sql) {
- if ($sql) echo rtrim($sql,';').";\n";
- }
+ foreach ($this->sql_exec() as $s) {
+ echo rtrim($s,';').";\n";
}
foreach ($tables as $t) {
return $fields;
}
+ public function sql_exec() {
+ $return = [];
+
+ if ($sql = $this->type('exec')) {
+ if (is_scalar($sql)) $sql = array($sql);
+ foreach ($sql as $s) {
+ if (!empty($s)) $return[] = $s;
+ }
+ }
+
+ if (!empty($this->sql_exec) and ($sql = $this->sql_exec)) {
+ if (is_scalar($sql)) $sql = array($sql);
+ foreach ($sql as $s) {
+ if (!empty($s)) $return[] = $s;
+ }
+ }
+
+ return $return;
+ }
} # < Class
?>
'SET NAMES '.str_replace('utf-8','utf8',strtolower(Db::$encoding)),
],
(Db::p('db.type') ? [
- 'SET SESSION sql_mode=PIPES_AS_CONCAT',
"/*!40103 SET TIME_ZONE='+00:00' */",
'/*!40014 SET @@UNIQUE_CHECKS=0 */',
'/*!40014 SET @@FOREIGN_KEY_CHECKS=0 */',