@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | $this->connection = []; |
10 | 10 | $this->currentConnection = null; |
11 | 11 | } |
12 | - public function addConnection( $_path, $_name = "default" ) { |
|
13 | - if(!is_string($_path)) |
|
12 | + public function addConnection($_path, $_name = "default") { |
|
13 | + if (!is_string($_path)) |
|
14 | 14 | throw new JException("Parameter must be a string.", 1); |
15 | 15 | try { |
16 | 16 | $jConfig = new JConfig($_path); |
17 | - if($jConfig->enable) { |
|
17 | + if ($jConfig->enable) { |
|
18 | 18 | $connection = new Connection($jConfig); |
19 | 19 | $this->addConnectionMan($connection, $_name); |
20 | 20 | } |
@@ -22,30 +22,30 @@ discard block |
||
22 | 22 | throw new JException($e->getMessage(), 1); |
23 | 23 | } |
24 | 24 | } |
25 | - public function addConnectionMan( $_connection, $_name = "default") { |
|
26 | - if(!is_object($_connection) || !is_a($_connection, "Connection")) |
|
25 | + public function addConnectionMan($_connection, $_name = "default") { |
|
26 | + if (!is_object($_connection) || !is_a($_connection, "Connection")) |
|
27 | 27 | throw new JException("Parameter must be a Connection object.", 1); |
28 | 28 | try { |
29 | 29 | $this->connection["$_name"] = $_connection; |
30 | 30 | $this->currentConnection = $_connection; |
31 | 31 | foreach ($this->modules as &$module) |
32 | - if(isset($this->currentConnection)) |
|
32 | + if (isset($this->currentConnection)) |
|
33 | 33 | $module->addConnectionMan($this->currentConnection, $_name); |
34 | 34 | } catch (Exception $e) { |
35 | 35 | throw new JException($e->getMessage(), 1); |
36 | 36 | } |
37 | 37 | } |
38 | - public function setConnection( $_name = "default" ) { |
|
39 | - if(!is_string($_name)) |
|
38 | + public function setConnection($_name = "default") { |
|
39 | + if (!is_string($_name)) |
|
40 | 40 | throw new JException("Parameter must be a string.", 1); |
41 | - if(!isset($this->connection["$_name"])) |
|
41 | + if (!isset($this->connection["$_name"])) |
|
42 | 42 | throw new JException("This connection name does not exist.", 1); |
43 | 43 | $this->currentConnection = $this->connection["$_name"]; |
44 | 44 | } |
45 | - public function query( $_query ) { |
|
46 | - if(!is_string($_query)) |
|
45 | + public function query($_query) { |
|
46 | + if (!is_string($_query)) |
|
47 | 47 | throw new JException("Parameter must be a string.", 1); |
48 | - if($this->currentConnection == null) |
|
48 | + if ($this->currentConnection == null) |
|
49 | 49 | throw new JException("No connection selected.", 1); |
50 | 50 | try { |
51 | 51 | $temp = $this->currentConnection->database->query($_query); |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | } |
55 | 55 | return $temp; |
56 | 56 | } |
57 | - public function queryInsert( $_query ) { |
|
58 | - if(!is_string($_query)) |
|
57 | + public function queryInsert($_query) { |
|
58 | + if (!is_string($_query)) |
|
59 | 59 | throw new JException("Parameter must be a string.", 1); |
60 | - if($this->currentConnection == null) |
|
60 | + if ($this->currentConnection == null) |
|
61 | 61 | throw new JException("No connection selected.", 1); |
62 | 62 | try { |
63 | 63 | $temp = $this->currentConnection->database->queryInsert($_query); |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | } |
67 | 67 | return $temp; |
68 | 68 | } |
69 | - public function queryFetch( $_query ) { |
|
70 | - if(!is_string($_query)) |
|
69 | + public function queryFetch($_query) { |
|
70 | + if (!is_string($_query)) |
|
71 | 71 | throw new JException("Parameter must be a string.", 1); |
72 | - if($this->currentConnection == null) |
|
72 | + if ($this->currentConnection == null) |
|
73 | 73 | throw new JException("No connection selected.", 1); |
74 | 74 | try { |
75 | 75 | $temp = $this->currentConnection->database->queryFetch($_query); |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | } |
79 | 79 | return $temp; |
80 | 80 | } |
81 | - public function queryArray( $_query ) { |
|
82 | - if(!is_string($_query)) |
|
81 | + public function queryArray($_query) { |
|
82 | + if (!is_string($_query)) |
|
83 | 83 | throw new JException("Parameter must be a string.", 1); |
84 | - if($this->currentConnection == null) |
|
84 | + if ($this->currentConnection == null) |
|
85 | 85 | throw new JException("No connection selected.", 1); |
86 | 86 | try { |
87 | 87 | $temp = $this->currentConnection->database->queryArray($_query); |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | } |
91 | 91 | return $temp; |
92 | 92 | } |
93 | - public function newTable( $_query ) { |
|
94 | - if(!is_string($_query)) |
|
93 | + public function newTable($_query) { |
|
94 | + if (!is_string($_query)) |
|
95 | 95 | throw new JException("Parameter must be a string.", 1); |
96 | - if($this->currentConnection == null) |
|
96 | + if ($this->currentConnection == null) |
|
97 | 97 | throw new JException("No connection selected.", 1); |
98 | 98 | try { |
99 | 99 | $temp = $this->currentConnection->database->newTable($_query); |