'row_parse_post' => 'tenant_doc',
),
+ 'test' => array(
+ 'sql' => 'SELECT 1',
+ ),
+
'rent' => array(
'orderby' => 'start desc, end desc',
#'replace' => [ 'idtenant' => 'tenant.name', 'idplace' => 'addr.addr' ],
$CONF['rent'] = array (
'order' => 5,
'pdo' => 'sqlite:/opt/rent/rent.db',
- #'_import' => '_nb',
+ '_import' => '_rent',
);
return 1;
// Name, could be a select
if (DB_TABLE_QUERY_NAME and stripos($this->name,'SELECT ')===0) {
- #$temp = '_'.substr(md5($this->name),0,6);
- $temp = DB_TABLE_QUERY_NAME;
- #bye("CREATE TEMPORARY VIEW $temp AS $this->name");
- $this->db()->conn->query("CREATE TEMPORARY TABLE $temp AS $this->name");
- $this->name = $temp;
+ $this->db()->conn->query("CREATE TEMPORARY TABLE ".DB_TABLE_QUERY_NAME." AS $this->name");
+ $this->name = DB_TABLE_QUERY_NAME;
+
+ // Virtual Table
+ } elseif (DB_TABLE_QUERY_NAME and !empty($this->sql)) {
+ $this->db()->conn->query("CREATE TEMPORARY TABLE ".DB_TABLE_QUERY_NAME." AS $this->sql");
+ $this->name = DB_TABLE_QUERY_NAME;
} elseif (preg_match('/\b(\.import|LOAD DATA|COPY|INSERT|REPLACE|DELETE|TRUNCATE|CREATE|DROP|ALERT)\b/',$this->name)) {
bye("Query not Allowed !");