1: <?php
2:
3: 4: 5: 6: 7:
8:
9:
10:
11: 12: 13: 14: 15: 16:
17: class NOdbcDriver extends NObject implements ISupplementalDriver
18: {
19:
20:
21:
22:
23: 24: 25:
26: public function delimite($name)
27: {
28: return '[' . str_replace(array('[', ']'), array('[[', ']]'), $name) . ']';
29: }
30:
31:
32: 33: 34:
35: public function formatBool($value)
36: {
37: return $value ? '1' : '0';
38: }
39:
40:
41: 42: 43:
44: public function formatDateTime(DateTime $value)
45: {
46: return $value->format('#m/d/Y H:i:s#');
47: }
48:
49:
50: 51: 52:
53: public function formatLike($value, $pos)
54: {
55: $value = strtr($value, array("'" => "''", '%' => '[%]', '_' => '[_]', '[' => '[[]'));
56: return ($pos <= 0 ? "'%" : "'") . $value . ($pos >= 0 ? "%'" : "'");
57: }
58:
59:
60: 61: 62:
63: public function applyLimit(& $sql, $limit, $offset)
64: {
65: if ($limit >= 0) {
66: $sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')';
67: }
68:
69: if ($offset) {
70: throw new InvalidArgumentException('Offset is not implemented in driver odbc.');
71: }
72: }
73:
74:
75: 76: 77:
78: public function normalizeRow($row, $statement)
79: {
80: return $row;
81: }
82:
83:
84:
85:
86:
87: 88: 89:
90: public function getTables()
91: {
92: throw new NotImplementedException;
93: }
94:
95:
96: 97: 98:
99: public function getColumns($table)
100: {
101: throw new NotImplementedException;
102: }
103:
104:
105: 106: 107:
108: public function getIndexes($table)
109: {
110: throw new NotImplementedException;
111: }
112:
113:
114: 115: 116:
117: public function getForeignKeys($table)
118: {
119: throw new NotImplementedException;
120: }
121:
122:
123: 124: 125:
126: public function isSupported($item)
127: {
128: return $item === self::SUPPORT_COLUMNS_META;
129: }
130:
131: }
132: