# Change db type if needed
$type_from = $type_to = '';
if ($db_type) {
- echo "-- Type orig: ".$this->type."\n";
echo "-- Type : ".$db_type."\n";
+ echo "-- Type from: ".$this->type."\n";
$type_from = $this->type;
$type_to = $db_type;
$this->type = $type_to;
'/"([\w_]+)"\(/' => '$1(', # pgsql function quoted;
"/'([\w_]+\(.*?\))'/" => '$1', # pgsql function quoted;
"/now\(\)/i" => 'CURRENT_TIMESTAMP', # pgsql function quoted;
+ '/left\((.*?),\s*(\d+)\s*\)/i' => 'SUBSTR($1,0,$2)', # function left to substr
+ '/right\((.*?),\s*(\d+)\s*\)/i' => 'SUBSTR($1,$2,LENGTH($1))', # function right to substr
];
- $sql= preg_replace(array_keys($r),array_values($r),$sql);
- return $sql;
+
+ return preg_replace(array_keys($r),array_values($r),$sql);
},
);?>