1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11:
12:
13:
14:
15: 16: 17: 18: 19: 20:
21: class MsSqlDriver extends Object implements ISupplementalDriver
22: {
23:
24: public $supports = array('meta' => TRUE);
25:
26:
27: private $connection;
28:
29:
30:
31: public function __construct(Connection $connection, array $options)
32: {
33: $this->connection = $connection;
34: }
35:
36:
37:
38:
39:
40:
41:
42: 43: 44:
45: public function delimite($name)
46: {
47:
48: return '[' . str_replace(array('[', ']'), array('[[', ']]'), $name) . ']';
49: }
50:
51:
52:
53: 54: 55:
56: public function formatDateTime(DateTime $value)
57: {
58: return $value->format("'Y-m-d H:i:s'");
59: }
60:
61:
62:
63: 64: 65:
66: public function formatLike($value, $pos)
67: {
68: $value = strtr($value, array("'" => "''", '%' => '[%]', '_' => '[_]', '[' => '[[]'));
69: return ($pos <= 0 ? "'%" : "'") . $value . ($pos >= 0 ? "%'" : "'");
70: }
71:
72:
73:
74: 75: 76:
77: public function applyLimit(&$sql, $limit, $offset)
78: {
79:
80: if ($limit >= 0) {
81: $sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ') t';
82: }
83:
84: if ($offset) {
85: throw new NotImplementedException('Offset is not implemented.');
86: }
87: }
88:
89:
90:
91: 92: 93:
94: public function normalizeRow($row, $statement)
95: {
96: return $row;
97: }
98:
99: }
100: