[TASK] Update ADOdb to 5.18
[Packages/TYPO3.CMS.git] / typo3 / sysext / adodb / adodb / datadict / datadict-sqlite.inc.php
1 <?php
2
3 /**
4 V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). 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 SQLite datadict Andrei Besleaga
12
13 */
14
15 // security - hide paths
16 if (!defined('ADODB_DIR')) die();
17
18 class ADODB2_sqlite extends ADODB_DataDict {
19 var $databaseType = 'sqlite';
20 var $seqField = false;
21 var $addCol=' ADD COLUMN';
22 var $dropTable = 'DROP TABLE IF EXISTS %s';
23 var $dropIndex = 'DROP INDEX IF EXISTS %s';
24 var $renameTable = 'ALTER TABLE %s RENAME TO %s';
25
26
27
28 function ActualType($meta)
29 {
30 switch(strtoupper($meta)) {
31 case 'C': return 'VARCHAR'; // TEXT , TEXT affinity
32 case 'XL':return 'LONGTEXT'; // TEXT , TEXT affinity
33 case 'X': return 'TEXT'; // TEXT , TEXT affinity
34
35 case 'C2': return 'VARCHAR'; // TEXT , TEXT affinity
36 case 'X2': return 'LONGTEXT'; // TEXT , TEXT affinity
37
38 case 'B': return 'LONGBLOB'; // TEXT , NONE affinity , BLOB
39
40 case 'D': return 'DATE'; // NUMERIC , NUMERIC affinity
41 case 'T': return 'DATETIME'; // NUMERIC , NUMERIC affinity
42 case 'L': return 'TINYINT'; // NUMERIC , INTEGER affinity
43
44 case 'R':
45 case 'I4':
46 case 'I': return 'INTEGER'; // NUMERIC , INTEGER affinity
47 case 'I1': return 'TINYINT'; // NUMERIC , INTEGER affinity
48 case 'I2': return 'SMALLINT'; // NUMERIC , INTEGER affinity
49 case 'I8': return 'BIGINT'; // NUMERIC , INTEGER affinity
50
51 case 'F': return 'DOUBLE'; // NUMERIC , REAL affinity
52 case 'N': return 'NUMERIC'; // NUMERIC , NUMERIC affinity
53 default:
54 return $meta;
55 }
56 }
57
58 // return string must begin with space
59 function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
60 {
61 $suffix = '';
62 if ($funsigned) $suffix .= ' UNSIGNED';
63 if ($fnotnull) $suffix .= ' NOT NULL';
64 if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
65 if ($fautoinc) $suffix .= ' AUTOINCREMENT';
66 if ($fconstraint) $suffix .= ' '.$fconstraint;
67 return $suffix;
68 }
69
70 function AlterColumnSQL($tabname, $flds, $tableflds='', $tableoptions='')
71 {
72 if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported natively by SQLite");
73 return array();
74 }
75
76 function DropColumnSQL($tabname, $flds, $tableflds='', $tableoptions='')
77 {
78 if ($this->debug) ADOConnection::outp("DropColumnSQL not supported natively by SQLite");
79 return array();
80 }
81
82 function RenameColumnSQL($tabname,$oldcolumn,$newcolumn,$flds='')
83 {
84 if ($this->debug) ADOConnection::outp("RenameColumnSQL not supported natively by SQLite");
85 return array();
86 }
87
88 }
89 ?>