1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004, 2011 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: * @package Nette\Database\Drivers
11: */
12:
13:
14:
15: /**
16: * Supplemental SQLite2 database driver.
17: *
18: * @author David Grudl
19: */
20: class NPdoSqlite2Driver extends NPdoSqliteDriver
21: {
22:
23: /**
24: * Encodes string for use in a LIKE statement.
25: */
26: public function formatLike($value, $pos)
27: {
28: throw new NotSupportedException;
29: }
30:
31:
32:
33: /**
34: * Normalizes result row.
35: */
36: public function normalizeRow($row, $statement)
37: {
38: if (!is_object($row)) {
39: $iterator = $row;
40: } elseif ($row instanceof Traversable) {
41: $iterator = iterator_to_array($row);
42: } else {
43: $iterator = (array) $row;
44: }
45: foreach ($iterator as $key => $value) {
46: unset($row[$key]);
47: if ($key[0] === '[' || $key[0] === '"') {
48: $key = substr($key, 1, -1);
49: }
50: $row[$key] = $value;
51: }
52: return $row;
53: }
54:
55: }
56: