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