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