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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
<?php
abstract class N2DBConnectorAbstract {
public $tableName;
protected $_prefixJoker = '#__';
protected $_prefix = '';
public function setTableName($name = "") { if (empty($name)) { $name = $this->tableName; }
$this->tableName = $this->_prefix . $name; }
public function parsePrefix($query) { return str_replace($this->_prefixJoker, $this->_prefix, $query); }
abstract public function query($query, $attributes = false);
abstract public function findByPk($primaryKey);
abstract public function findByAttributes(array $attributes, $fields = false, $order = false);
abstract public function findAll($order = false);
/** * Return with all row by attributes * * @param array $attributes * @param bool|array $fields * @param bool|string $order * * @return mixed */ abstract public function findAllByAttributes(array $attributes, $fields = false, $order = false);
/** * Return with one row by query string * * @param string $query * @param array|bool $attributes for parameter binding * * @return mixed */ abstract public function queryRow($query, $attributes = false);
abstract public function queryAll($query, $attributes = false, $type = "assoc", $key = null);
/** * Insert new row * * @param array $attributes * * @return mixed|void */ abstract public function insert(array $attributes);
abstract public function insertId();
/** * Update row(s) by param(s) * * @param array $attributes * @param array $conditions * * @return mixed */ abstract public function update(array $attributes, array $conditions);
/** * Update one row by primary key with $attributes * * @param mixed $primaryKey * @param array $attributes * * @return mixed */ abstract public function updateByPk($primaryKey, array $attributes);
/** * Delete one with by primary key * * @param mixed $primaryKey * * @return mixed */ abstract public function deleteByPk($primaryKey);
/** * Delete all rows by attributes * * @param array $conditions * * @return mixed */ abstract public function deleteByAttributes(array $conditions);
/** * @param string $text * @param bool $escape * * @return string */ abstract public function quote($text, $escape = true);
/** * @param string $name * @param null $as * * @return mixed */ abstract public function quoteName($name, $as = null); }
N2Loader::import("libraries.mvc.db", "platform");
|