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