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