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