1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
7: *
8: * For the full copyright and license information, please view
9: * the file license.txt that was distributed with this source code.
10: */
11:
12: namespace Nette\Database\Drivers;
13:
14: use Nette;
15:
16:
17:
18: /**
19: * Supplemental SQLite2 database driver.
20: *
21: * @author David Grudl
22: */
23: class Sqlite2Driver extends SqliteDriver
24: {
25:
26: /**
27: * Encodes string for use in a LIKE statement.
28: */
29: public function formatLike($value, $pos)
30: {
31: throw new Nette\NotSupportedException;
32: }
33:
34:
35:
36: /**
37: * Normalizes result row.
38: */
39: public function normalizeRow($row, $statement)
40: {
41: if (!is_object($row)) {
42: $iterator = $row;
43: } elseif ($row instanceof \Traversable) {
44: $iterator = iterator_to_array($row);
45: } else {
46: $iterator = (array) $row;
47: }
48: foreach ($iterator as $key => $value) {
49: unset($row[$key]);
50: if ($key[0] === '[' || $key[0] === '"') {
51: $key = substr($key, 1, -1);
52: }
53: $row[$key] = $value;
54: }
55: return $row;
56: }
57:
58:
59:
60: /**
61: * Returns metadata for all foreign keys in a table.
62: */
63: public function getForeignKeys($table)
64: {
65: throw new NotSupportedException; // @see http://www.sqlite.org/foreignkeys.html
66: }
67:
68: }
69: