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