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 formatDateTime(DateTime $value)
53: {
54: return $value->format("#m/d/Y H:i:s#");
55: }
56:
57:
58:
59: 60: 61:
62: public function formatLike($value, $pos)
63: {
64: $value = strtr($value, array("'" => "''", '%' => '[%]', '_' => '[_]', '[' => '[[]'));
65: return ($pos <= 0 ? "'%" : "'") . $value . ($pos >= 0 ? "%'" : "'");
66: }
67:
68:
69:
70: 71: 72:
73: public function applyLimit(&$sql, $limit, $offset)
74: {
75:
76: if ($limit >= 0) {
77: $sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')';
78: }
79:
80: if ($offset) {
81: throw new InvalidArgumentException('Offset is not implemented in driver odbc.');
82: }
83: }
84:
85:
86:
87: 88: 89:
90: public function normalizeRow($row, $statement)
91: {
92: return $row;
93: }
94:
95:
96:
97:
98:
99:
100:
101: 102: 103:
104: public function getTables()
105: {
106: throw new NNotImplementedException;
107: }
108:
109:
110:
111: 112: 113:
114: public function getColumns($table)
115: {
116: throw new NNotImplementedException;
117: }
118:
119:
120:
121: 122: 123:
124: public function getIndexes($table)
125: {
126: throw new NNotImplementedException;
127: }
128:
129:
130:
131: 132: 133:
134: public function getForeignKeys($table)
135: {
136: throw new NNotImplementedException;
137: }
138:
139:
140:
141: 142: 143:
144: public function isSupported($item)
145: {
146: return $item === self::META;
147: }
148:
149: }
150: