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: private $connection;
21:
22:
23: public function __construct(NConnection $connection, array $options)
24: {
25: $this->connection = $connection;
26: }
27:
28:
29:
30:
31:
32: 33: 34:
35: public function delimite($name)
36: {
37: return '[' . str_replace(array('[', ']'), array('[[', ']]'), $name) . ']';
38: }
39:
40:
41: 42: 43:
44: public function formatBool($value)
45: {
46: return $value ? '1' : '0';
47: }
48:
49:
50: 51: 52:
53: public function formatDateTime(DateTime $value)
54: {
55: return $value->format("#m/d/Y H:i:s#");
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: public function applyLimit(& $sql, $limit, $offset)
73: {
74: if ($limit >= 0) {
75: $sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')';
76: }
77:
78: if ($offset) {
79: throw new InvalidArgumentException('Offset is not implemented in driver odbc.');
80: }
81: }
82:
83:
84: 85: 86:
87: public function normalizeRow($row, $statement)
88: {
89: return $row;
90: }
91:
92:
93:
94:
95:
96: 97: 98:
99: public function getTables()
100: {
101: throw new NotImplementedException;
102: }
103:
104:
105: 106: 107:
108: public function getColumns($table)
109: {
110: throw new NotImplementedException;
111: }
112:
113:
114: 115: 116:
117: public function getIndexes($table)
118: {
119: throw new NotImplementedException;
120: }
121:
122:
123: 124: 125:
126: public function getForeignKeys($table)
127: {
128: throw new NotImplementedException;
129: }
130:
131:
132: 133: 134:
135: public function isSupported($item)
136: {
137: return $item === self::SUPPORT_COLUMNS_META;
138: }
139:
140: }
141: