summaryrefslogtreecommitdiffstats
path: root/codebase/db_sqlite.php
blob: 04df7e5152b21ad1f1a7afbc530c2f61fcc0284f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/*
	@author dhtmlx.com
	@license GPL, see license.txt
*/
require_once("db_common.php");
/*! SQLite implementation of DataWrapper
**/
class SQLiteDBDataWrapper extends DBDataWrapper{

	public function query($sql){
		LogMaster::log($sql);
		
		$res = sqlite_query($this->connection,$sql);
		if ($res === false)
			throw new Exception("SQLLite - sql execution failed\n".sqlite_error_string(sqlite_last_error($this->connection)));
			
		return $res;
	}
	
	public function get_next($res){
		$data = sqlite_fetch_array($res, SQLITE_ASSOC);
		return $data;
	}
	
	public function get_new_id(){
		return sqlite_last_insert_rowid($this->connection);
	}
	
	public function escape($data){
		return sqlite_escape_string($data);
	}		
}
?>