1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved. |
---|
5 | Released under both BSD license and Lesser GPL library license. |
---|
6 | Whenever there is any discrepancy between the two licenses, |
---|
7 | the BSD license will take precedence. |
---|
8 | |
---|
9 | Set tabs to 4 for best viewing. |
---|
10 | |
---|
11 | */ |
---|
12 | // security - hide paths |
---|
13 | if (!defined('ADODB_DIR')) die(); |
---|
14 | |
---|
15 | class ADODB2_db2 extends ADODB_DataDict { |
---|
16 | |
---|
17 | var $databaseType = 'db2'; |
---|
18 | var $seqField = false; |
---|
19 | |
---|
20 | function ActualType($meta) |
---|
21 | { |
---|
22 | switch($meta) { |
---|
23 | case 'C': return 'VARCHAR'; |
---|
24 | case 'XL': return 'CLOB'; |
---|
25 | case 'X': return 'VARCHAR(3600)'; |
---|
26 | |
---|
27 | case 'C2': return 'VARCHAR'; // up to 32K |
---|
28 | case 'X2': return 'VARCHAR(3600)'; // up to 32000, but default page size too small |
---|
29 | |
---|
30 | case 'B': return 'BLOB'; |
---|
31 | |
---|
32 | case 'D': return 'DATE'; |
---|
33 | case 'T': return 'TIMESTAMP'; |
---|
34 | |
---|
35 | case 'L': return 'SMALLINT'; |
---|
36 | case 'I': return 'INTEGER'; |
---|
37 | case 'I1': return 'SMALLINT'; |
---|
38 | case 'I2': return 'SMALLINT'; |
---|
39 | case 'I4': return 'INTEGER'; |
---|
40 | case 'I8': return 'BIGINT'; |
---|
41 | |
---|
42 | case 'F': return 'DOUBLE'; |
---|
43 | case 'N': return 'DECIMAL'; |
---|
44 | default: |
---|
45 | return $meta; |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | // return string must begin with space |
---|
50 | function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint) |
---|
51 | { |
---|
52 | $suffix = ''; |
---|
53 | if ($fautoinc) return ' GENERATED ALWAYS AS IDENTITY'; # as identity start with |
---|
54 | if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; |
---|
55 | if ($fnotnull) $suffix .= ' NOT NULL'; |
---|
56 | if ($fconstraint) $suffix .= ' '.$fconstraint; |
---|
57 | return $suffix; |
---|
58 | } |
---|
59 | |
---|
60 | function AlterColumnSQL($tabname, $flds) |
---|
61 | { |
---|
62 | if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); |
---|
63 | return array(); |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | function DropColumnSQL($tabname, $flds) |
---|
68 | { |
---|
69 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); |
---|
70 | return array(); |
---|
71 | } |
---|
72 | |
---|
73 | } |
---|
74 | |
---|
75 | |
---|
76 | ?> |
---|