1: <?php
2:
3: namespace PHPixie\Database;
4:
5: abstract class Connection
6: {
7: protected $name;
8: protected $config;
9: protected $driver;
10:
11: public function __construct($driver, $name, $config)
12: {
13: $this->driver = $driver;
14: $this->name = $name;
15: $this->config = $config;
16:
17: $this->connect();
18: }
19:
20: public function selectQuery()
21: {
22: return $this->driver->query('select', $this->name);
23: }
24:
25: public function updateQuery()
26: {
27: return $this->driver->query('update', $this->name);
28: }
29:
30: public function deleteQuery()
31: {
32: return $this->driver->query('delete', $this->name);
33: }
34:
35: public function insertQuery()
36: {
37: return $this->driver->query('insert', $this->name);
38: }
39:
40: public function countQuery()
41: {
42: return $this->driver->query('count', $this->name);
43: }
44:
45: public function config()
46: {
47: return $this->config;
48: }
49:
50: abstract public function insertId();
51:
52: public function reconnect()
53: {
54: $this->disconnect();
55: $this->connect();
56: }
57:
58: abstract public function connect();
59: abstract public function disconnect();
60: }
61: