PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/core/db/DbPdo.php

http://zoop.googlecode.com/
PHP | 60 lines | 37 code | 7 blank | 16 comment | 2 complexity | 0b4146d58d4b2609bfd86ac648ea1759 MD5 | raw file
 1<?php
 2class DbPdo extends DbConnection
 3{
 4	function init()
 5	{
 6		if($this->params['file'][0] != '/')
 7			$this->params['file'] = app_dir . '/var/' . $this->params['file'];
 8
 9		$this->conn = new PDO('sqlite:' . $this->params['file']);
10		$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
11		$this->conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NAMED);
12	}
13
14	function escapeString($string)
15	{
16		return $this->conn->quote($string);
17	}
18
19		/**
20	 * Checks if a given table exists in the database
21	 *
22	 * @param string $name Name of the table to look for
23	 * @return boolean True if the table exists in this database
24	 */
25	public function tableExists($name)
26	{
27		trigger_error("tableExists method not yet implemented in DbPdo");
28	}
29
30	/**
31	 * Returns an array of table names that exist in the database
32	 *
33	 * @return array Array of table names
34	 */
35	public function getTableNames()
36	{
37		trigger_error("getTableNames is not yet implemented in DbPdo");
38	}
39
40	/**
41	 * Returns field information about the specified table
42	 *
43	 * @param string $tableName Name of the table to return information about
44	 */
45	public function getTableFieldInfo($tableName)
46	{
47		trigger_error("getTableFieldInfo is not yet implemented in DbPdo");
48	}
49
50	function _query($sql)
51	{
52		$result = $this->conn->query($sql);
53		return new DbPdoResult($this->conn, $result);
54	}
55
56	function getLastInsertId()
57	{
58		return $this->conn->lastInsertId();
59	}
60}