13 require_once dirname(__FILE__).
'/DALConverter.inc';
34 protected $name =
'DB2';
42 protected $dataTypes = array(
44 'varchar' =>
'VARCHAR',
48 'smallint' =>
'SMALLINT',
49 'numeric' =>
'NUMERIC',
52 'double_precision' =>
'DOUBLE PRECISION',
56 'timestamp' =>
'TIMESTAMP',
57 'time with time zone' =>
'TIME',
84 $sql =
'SELECT next value for '.$seqName[0].
' FROM SYSIBM.SYSDUMMY1';
102 $sql =
'SELECT prevval for '.$seqName[0].
' FROM SYSIBM.SYSDUMMY1';
118 if (is_array($tableName) === TRUE) {
119 $tableName = $tableName[0];
122 $sql =
'SELECT count(*) FROM syscat.tables WHERE tabname = UPPER(CAST('.$tableName.
' AS VARCHAR(50)))';
138 if (is_array($sequenceName) === TRUE) {
139 $sequenceName = $sequenceName[0];
142 $sql =
'SELECT count(*) FROM syscat.sequences WHERE seqname = '.$sequenceName;
164 $sql =
'TIMESTAMP('.$iso8601_date.
')';
181 if (isset($union[
'UNION']) === TRUE) {
183 }
else if (isset($union[
'UNION-ALL']) === TRUE) {
202 if ($type ===
'UNION-ALL') {
221 $sql = implode(
' || ', $args);
239 $sql =
'LOCATE('.str_replace(
'%',
'', $to).
', '.str_replace(
'%',
'', $compare).
') <> 0';
279 if (count($args) != 2 && count($args) != 3) {
280 $msg =
'The SUBSTR() function only accepts two or three parameters.';
286 $length = isset($args[2]) ?
",$args[2]" :
'';
287 $sql =
"SUBSTRING($input, $start $length, OCTETS)";