Skip to content

Commit 5caf7b0

Browse files
committed
match other methods naming style
1 parent abd9fa9 commit 5caf7b0

File tree

6 files changed

+22
-32
lines changed

6 files changed

+22
-32
lines changed

lib/Database/ez_mysqli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public function query(string $query, bool $use_prepare = false)
371371
}
372372

373373
// Perform the query via std mysql_query function..
374-
if (!empty($param) && \is_array($param) && ($this->isPrepareActive()))
374+
if (!empty($param) && \is_array($param) && ($this->isPrepareOn()))
375375
return $this->query_prepared($query, $param);
376376
else
377377
$this->result = \mysqli_query($this->dbh, $query);

lib/Database/ez_pdo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public function query(string $query, bool $use_prepare = false)
351351

352352
// Perform the query and log number of affected rows
353353
// Perform the query via std PDO query or PDO prepare function..
354-
if (!empty($param) && is_array($param) && ($this->isPrepareActive())) {
354+
if (!empty($param) && is_array($param) && ($this->isPrepareOn())) {
355355
$this->_affectedRows = $this->query_prepared($query, $param, false);
356356
} else
357357
$this->_affectedRows = $this->dbh->exec($query);
@@ -376,7 +376,7 @@ public function query(string $query, bool $use_prepare = false)
376376

377377
// Perform the query and log number of affected rows
378378
// Perform the query via std PDO query or PDO prepare function..
379-
if (!empty($param) && \is_array($param) && ($this->isPrepareActive())) {
379+
if (!empty($param) && \is_array($param) && ($this->isPrepareOn())) {
380380
$sth = $this->query_prepared($query, $param, true);
381381
} else
382382
$sth = $this->dbh->query($query);

lib/Database/ez_pgsql.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function query(string $query, bool $use_prepare = false)
183183
}
184184

185185
// check for ezQuery placeholder tag and replace tags with proper prepare tag
186-
if (!empty($param) && \is_array($param) && ($this->isPrepareActive()) && (\strpos($query, \_TAG) !== false)) {
186+
if (!empty($param) && \is_array($param) && ($this->isPrepareOn()) && (\strpos($query, \_TAG) !== false)) {
187187
foreach ($param as $i => $value) {
188188
$parameterized = $i + 1;
189189
$needle = \_TAG;
@@ -228,7 +228,7 @@ public function query(string $query, bool $use_prepare = false)
228228
}
229229

230230
// Perform the query via std postgresql_query function..
231-
if (!empty($param) && \is_array($param) && ($this->isPrepareActive())) {
231+
if (!empty($param) && \is_array($param) && ($this->isPrepareOn())) {
232232
$this->result = $this->query_prepared($query, $param);
233233
} else {
234234
$this->result = @\pg_query($this->dbh, $query);

lib/Database/ez_sqlite3.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function query(string $query, bool $use_prepare = false)
211211
}
212212

213213
// Perform the query via std SQLite3 query or SQLite3 prepare function..
214-
if (!empty($param) && \is_array($param) && ($this->isPrepareActive())) {
214+
if (!empty($param) && \is_array($param) && ($this->isPrepareOn())) {
215215
$this->result = $this->query_prepared($query, $param);
216216
} else {
217217
$this->result = $this->dbh->query($query);
@@ -268,7 +268,7 @@ public function query(string $query, bool $use_prepare = false)
268268
$return_val = $this->num_rows;
269269
}
270270

271-
if (($param) && \is_array($param) && ($this->isPrepareActive())) {
271+
if (($param) && \is_array($param) && ($this->isPrepareOn())) {
272272
$this->result->finalize();
273273
}
274274

lib/Database/ez_sqlsrv.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function query(string $query, bool $use_prepare = false)
216216
}
217217

218218
// Perform the query via std sqlsrv_query function..
219-
if (!empty($param) && \is_array($param) && ($this->isPrepareActive())) {
219+
if (!empty($param) && \is_array($param) && ($this->isPrepareOn())) {
220220
$this->result = $this->query_prepared($query, $param);
221221
} else {
222222
$this->result = @\sqlsrv_query($this->dbh, $query);

lib/ezQuery.php

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static function createCertificate(
9898
/**
9999
* Return status of prepare function availability in shortcut method calls
100100
*/
101-
protected function isPrepareActive()
101+
protected function isPrepareOn()
102102
{
103103
return $this->prepareActive;
104104
}
@@ -144,16 +144,6 @@ public function prepareOff()
144144
$this->prepareActive = $this->clearPrepare();
145145
}
146146

147-
public function prepareActive()
148-
{
149-
$this->prepareActive = true;
150-
}
151-
152-
public function prepareInActive()
153-
{
154-
$this->prepareActive = $this->clearPrepare();
155-
}
156-
157147
/**
158148
* Convert array to string, and attach '`, `' for separation, if none is provided.
159149
*
@@ -358,7 +348,7 @@ public function where( ...$whereKeyArray)
358348
else
359349
$myCombineWith = \_AND;
360350

361-
if ($this->isPrepareActive()) {
351+
if ($this->isPrepareOn()) {
362352
$where .= "$key ".$isCondition.' '.\_TAG." AND ".\_TAG." $myCombineWith ";
363353
$this->addPrepare($val);
364354
$this->addPrepare($combineWith);
@@ -369,7 +359,7 @@ public function where( ...$whereKeyArray)
369359
} elseif ($isCondition == \_IN) {
370360
$value = '';
371361
foreach ($val as $inValues) {
372-
if ($this->isPrepareActive()) {
362+
if ($this->isPrepareOn()) {
373363
$value .= \_TAG.', ';
374364
$this->addPrepare($inValues);
375365
} else
@@ -382,7 +372,7 @@ public function where( ...$whereKeyArray)
382372
} elseif ((($isCondition == \_LIKE) || ($isCondition == \_notLIKE)) && ! \preg_match('/[_%?]/', $val)) {
383373
return $this->clearPrepare();
384374
} else {
385-
if ($this->isPrepareActive()) {
375+
if ($this->isPrepareOn()) {
386376
$where .= "$key ".$isCondition.' '.\_TAG." $combineWith ";
387377
$this->addPrepare($val);
388378
} else
@@ -395,7 +385,7 @@ public function where( ...$whereKeyArray)
395385
$where = \rtrim($where, " $combineWith ");
396386
}
397387

398-
if (($this->isPrepareActive()) && !empty($this->prepareValues()) && ($where != '1'))
388+
if (($this->isPrepareOn()) && !empty($this->prepareValues()) && ($where != '1'))
399389
return " $whereOrHaving ".$where.' ';
400390

401391
return ($where != '1') ? " $whereOrHaving ".$where.' ' : ' ' ;
@@ -481,7 +471,7 @@ public function selecting($table ='', $columnFields = '*', ...$conditions)
481471
if (\is_string($where)) {
482472
$sql .= $where;
483473
if ($getSelect_result)
484-
return (($this->isPrepareActive()) && !empty($this->prepareValues()))
474+
return (($this->isPrepareOn()) && !empty($this->prepareValues()))
485475
? $this->get_results($sql, OBJECT, true)
486476
: $this->get_results($sql);
487477
return $sql;
@@ -520,7 +510,7 @@ public function create_select($newTable, $fromColumns, $oldTable = null, ...$fro
520510

521511
$newTableFromTable = $this->select_sql($newTable, $fromColumns, ...$fromWhere);
522512
if (is_string($newTableFromTable))
523-
return (($this->isPrepareActive()) && !empty($this->prepareValues()))
513+
return (($this->isPrepareOn()) && !empty($this->prepareValues()))
524514
? $this->query($newTableFromTable, true)
525515
: $this->query($newTableFromTable);
526516

@@ -537,7 +527,7 @@ public function select_into($newTable, $fromColumns, $oldTable = null, ...$fromW
537527

538528
$newTableFromTable = $this->select_sql($newTable, $fromColumns, ...$fromWhere);
539529
if (is_string($newTableFromTable))
540-
return (($this->isPrepareActive()) && !empty($this->prepareValues()))
530+
return (($this->isPrepareOn()) && !empty($this->prepareValues()))
541531
? $this->query($newTableFromTable, true)
542532
: $this->query($newTableFromTable);
543533

@@ -558,7 +548,7 @@ public function update($table = '', $keyAndValue, ...$whereKeys)
558548
} elseif(\in_array(\strtolower($val), array( 'current_timestamp()', 'date()', 'now()' ))) {
559549
$sql .= "$key = CURRENT_TIMESTAMP(), ";
560550
} else {
561-
if ($this->isPrepareActive()) {
551+
if ($this->isPrepareOn()) {
562552
$sql .= "$key = ".\_TAG.", ";
563553
$this->addPrepare($val);
564554
} else
@@ -569,7 +559,7 @@ public function update($table = '', $keyAndValue, ...$whereKeys)
569559
$where = $this->where(...$whereKeys);
570560
if (\is_string($where)) {
571561
$sql = \rtrim($sql, ', ') . $where;
572-
return (($this->isPrepareActive()) && !empty($this->prepareValues()))
562+
return (($this->isPrepareOn()) && !empty($this->prepareValues()))
573563
? $this->query($sql, true)
574564
: $this->query($sql) ;
575565
}
@@ -588,7 +578,7 @@ public function delete($table = '', ...$whereKeys)
588578
$where = $this->where(...$whereKeys);
589579
if (\is_string($where)) {
590580
$sql .= $where;
591-
return (($this->isPrepareActive()) && !empty($this->prepareValues()))
581+
return (($this->isPrepareOn()) && !empty($this->prepareValues()))
592582
? $this->query($sql, true)
593583
: $this->query($sql);
594584
}
@@ -622,7 +612,7 @@ private function _query_insert_replace($table = '', $keyAndValue, $type = '', $e
622612
elseif (\in_array(\strtolower($val), array( 'current_timestamp()', 'date()', 'now()' )))
623613
$value .= "CURRENT_TIMESTAMP(), ";
624614
else {
625-
if ($this->isPrepareActive()) {
615+
if ($this->isPrepareOn()) {
626616
$value .= _TAG.", ";
627617
$this->addPrepare($val);
628618
} else
@@ -632,7 +622,7 @@ private function _query_insert_replace($table = '', $keyAndValue, $type = '', $e
632622

633623
$sql .= "(". \rtrim($index, ', ') .") VALUES (". \rtrim($value, ', ') .");";
634624

635-
if (($this->isPrepareActive()) && !empty($this->prepareValues()))
625+
if (($this->isPrepareOn()) && !empty($this->prepareValues()))
636626
$ok = $this->query($sql, true);
637627
else
638628
$ok = $this->query($sql);
@@ -673,7 +663,7 @@ public function insert_select($toTable = '', $toColumns = '*', $fromTable = null
673663
$getFromTable = $this->select_sql($fromTable, $fromColumns, ...$fromWhere);
674664

675665
if (\is_string($putToTable) && \is_string($getFromTable))
676-
return (($this->isPrepareActive()) && !empty($this->prepareValues()))
666+
return (($this->isPrepareOn()) && !empty($this->prepareValues()))
677667
? $this->query($putToTable." ".$getFromTable, true)
678668
: $this->query($putToTable." ".$getFromTable) ;
679669

0 commit comments

Comments
 (0)