Skip to content

Commit 8550a96

Browse files
Database - Make sql query mixed instead of string since most nosql databases use arrays
1 parent da6b7eb commit 8550a96

15 files changed

+49
-49
lines changed

system/Database/BaseConnection.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,11 @@ public function addTableAlias(string $table)
586586
/**
587587
* Executes the query against the database.
588588
*
589-
* @param string $sql
589+
* @param mixed $sql
590590
*
591591
* @return mixed
592592
*/
593-
abstract protected function execute(string $sql);
593+
abstract protected function execute($sql);
594594

595595
//--------------------------------------------------------------------
596596

@@ -602,14 +602,14 @@ abstract protected function execute(string $sql);
602602
* Should automatically handle different connections for read/write
603603
* queries if needed.
604604
*
605-
* @param string $sql
605+
* @param mixed $sql
606606
* @param mixed ...$binds
607607
* @param boolean $setEscapeFlags
608608
* @param string|null $queryClass
609609
*
610610
* @return BaseResult|Query|false
611611
*/
612-
public function query(string $sql, $binds = null, bool $setEscapeFlags = true, ?string $queryClass = null)
612+
public function query($sql, $binds = null, bool $setEscapeFlags = true, ?string $queryClass = null)
613613
{
614614
$queryClass = $queryClass ?: $this->queryClass;
615615

@@ -699,11 +699,11 @@ public function query(string $sql, $binds = null, bool $setEscapeFlags = true, ?
699699
* is performed, nor are transactions handled. Simply takes a raw
700700
* query string and returns the database-specific result id.
701701
*
702-
* @param string $sql
702+
* @param mixed $sql
703703
*
704704
* @return mixed
705705
*/
706-
public function simpleQuery(string $sql)
706+
public function simpleQuery($sql)
707707
{
708708
if (empty($this->connID))
709709
{

system/Database/BasePreparedQuery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ public function __construct(BaseConnection $db)
7676
* NOTE: This version is based on SQL code. Child classes should
7777
* override this method.
7878
*
79-
* @param string $sql
79+
* @param mixed $sql
8080
* @param array $options Passed to the connection's prepare statement.
8181
* @param string $queryClass
8282
*
8383
* @return mixed
8484
*/
85-
public function prepare(string $sql, array $options = [], string $queryClass = 'CodeIgniter\\Database\\Query')
85+
public function prepare($sql, array $options = [], string $queryClass = 'CodeIgniter\\Database\\Query')
8686
{
8787
// We only supports positional placeholders (?)
8888
// in order to work with the execute method below, so we

system/Database/ConnectionInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ public function getVersion(): string;
123123
* Should automatically handle different connections for read/write
124124
* queries if needed.
125125
*
126-
* @param string $sql
127-
* @param mixed ...$binds
126+
* @param mixed $sql
127+
* @param mixed ...$binds
128128
*
129129
* @return mixed
130130
*/
131-
public function query(string $sql, $binds = null);
131+
public function query($sql, $binds = null);
132132

133133
//--------------------------------------------------------------------
134134

@@ -137,11 +137,11 @@ public function query(string $sql, $binds = null);
137137
* is performed, nor are transactions handled. Simply takes a raw
138138
* query string and returns the database-specific result id.
139139
*
140-
* @param string $sql
140+
* @param mixed $sql
141141
*
142142
* @return mixed
143143
*/
144-
public function simpleQuery(string $sql);
144+
public function simpleQuery($sql);
145145

146146
//--------------------------------------------------------------------
147147

system/Database/MySQLi/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,11 @@ public function getVersion(): string
295295
/**
296296
* Executes the query against the database.
297297
*
298-
* @param string $sql
298+
* @param mixed $sql
299299
*
300300
* @return mixed
301301
*/
302-
public function execute(string $sql)
302+
public function execute($sql)
303303
{
304304
while ($this->connID->more_results())
305305
{

system/Database/MySQLi/PreparedQuery.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ class PreparedQuery extends BasePreparedQuery
2626
* NOTE: This version is based on SQL code. Child classes should
2727
* override this method.
2828
*
29-
* @param string $sql
30-
* @param array $options Passed to the connection's prepare statement.
31-
* Unused in the MySQLi driver.
29+
* @param mixed $sql
30+
* @param array $options Passed to the connection's prepare statement.
31+
* Unused in the MySQLi driver.
3232
*
3333
* @return mixed
3434
*/
35-
public function _prepare(string $sql, array $options = [])
35+
public function _prepare($sql, array $options = [])
3636
{
3737
// Mysqli driver doesn't like statements
3838
// with terminating semicolons.

system/Database/Postgre/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ public function getVersion(): string
159159
/**
160160
* Executes the query against the database.
161161
*
162-
* @param string $sql
162+
* @param mixed $sql
163163
*
164164
* @return mixed
165165
*/
166-
public function execute(string $sql)
166+
public function execute($sql)
167167
{
168168
try
169169
{

system/Database/Postgre/PreparedQuery.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ class PreparedQuery extends BasePreparedQuery
4343
* NOTE: This version is based on SQL code. Child classes should
4444
* override this method.
4545
*
46-
* @param string $sql
47-
* @param array $options Passed to the connection's prepare statement.
48-
* Unused in the MySQLi driver.
46+
* @param mixed $sql
47+
* @param array $options Passed to the connection's prepare statement.
48+
* Unused in the MySQLi driver.
4949
*
5050
* @return mixed
5151
* @throws Exception
5252
*/
53-
public function _prepare(string $sql, array $options = [])
53+
public function _prepare($sql, array $options = [])
5454
{
5555
$this->name = (string) random_int(1, 10000000000000000);
5656

system/Database/PreparedQueryInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ public function execute(...$data);
3232
* Prepares the query against the database, and saves the connection
3333
* info necessary to execute the query later.
3434
*
35-
* @param string $sql
36-
* @param array $options Passed to the connection's prepare statement.
35+
* @param mixed $sql
36+
* @param array $options Passed to the connection's prepare statement.
3737
*
3838
* @return mixed
3939
*/
40-
public function prepare(string $sql, array $options = []);
40+
public function prepare($sql, array $options = []);
4141

4242
//--------------------------------------------------------------------
4343

system/Database/Query.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ public function __construct(ConnectionInterface &$db)
101101
/**
102102
* Sets the raw query string to use for this statement.
103103
*
104-
* @param string $sql
104+
* @param mixed $sql
105105
* @param mixed $binds
106106
* @param boolean $setEscape
107107
*
108108
* @return $this
109109
*/
110-
public function setQuery(string $sql, $binds = null, bool $setEscape = true)
110+
public function setQuery($sql, $binds = null, bool $setEscape = true)
111111
{
112112
$this->originalQueryString = $sql;
113113

@@ -166,9 +166,9 @@ public function setBinds(array $binds, bool $setEscape = true)
166166
* Returns the final, processed query string after binding, etal
167167
* has been performed.
168168
*
169-
* @return string
169+
* @return mixed
170170
*/
171-
public function getQuery(): string
171+
public function getQuery()
172172
{
173173
if (empty($this->finalQueryString))
174174
{

system/Database/QueryInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ interface QueryInterface
2222
/**
2323
* Sets the raw query string to use for this statement.
2424
*
25-
* @param string $sql
25+
* @param mixed $sql
2626
* @param mixed $binds
2727
* @param boolean $setEscape
2828
*
2929
* @return mixed
3030
*/
31-
public function setQuery(string $sql, $binds = null, bool $setEscape = true);
31+
public function setQuery($sql, $binds = null, bool $setEscape = true);
3232

3333
//--------------------------------------------------------------------
3434

0 commit comments

Comments
 (0)