summaryrefslogtreecommitdiff
path: root/includes/mysqli_provider.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/mysqli_provider.php')
-rw-r--r--includes/mysqli_provider.php43
1 files changed, 26 insertions, 17 deletions
diff --git a/includes/mysqli_provider.php b/includes/mysqli_provider.php
index 7197b95a..0315c0f1 100644
--- a/includes/mysqli_provider.php
+++ b/includes/mysqli_provider.php
@@ -22,10 +22,11 @@ function sql_null($value = null) {
function sql_transaction_start() {
global $sql_nested_transaction_level;
- if ($sql_nested_transaction_level ++ == 0)
+ if ($sql_nested_transaction_level ++ == 0) {
return sql_query("BEGIN");
- else
- return true;
+ }
+
+ return true;
}
/**
@@ -34,10 +35,11 @@ function sql_transaction_start() {
function sql_transaction_commit() {
global $sql_nested_transaction_level;
- if (-- $sql_nested_transaction_level == 0)
+ if (-- $sql_nested_transaction_level == 0) {
return sql_query("COMMIT");
- else
- return true;
+ }
+
+ return true;
}
/**
@@ -46,10 +48,11 @@ function sql_transaction_commit() {
function sql_transaction_rollback() {
global $sql_nested_transaction_level;
- if (-- $sql_nested_transaction_level == 0)
+ if (-- $sql_nested_transaction_level == 0) {
return sql_query("ROLLBACK");
- else
+ } else {
return true;
+ }
}
/**
@@ -92,12 +95,14 @@ function sql_connect($host, $user, $pass, $db) {
}
$result = $sql_connection->query("SET CHARACTER SET utf8;");
- if (! $result)
+ if (! $result) {
return sql_error("Unable to set utf8 character set (" . $sql_connection->errno . ") " . $sql_connection->error);
+ }
$result = $sql_connection->set_charset('utf8');
- if (! $result)
+ if (! $result) {
return sql_error("Unable to set utf8 names (" . $sql_connection->errno . ") " . $sql_connection->error);
+ }
return $sql_connection;
}
@@ -111,8 +116,9 @@ function sql_connect($host, $user, $pass, $db) {
*/
function sql_select_db($db_name) {
global $sql_connection;
- if (! $sql_connection->select_db($db_name))
+ if (! $sql_connection->select_db($db_name)) {
return sql_error("No database selected.");
+ }
return true;
}
@@ -127,12 +133,14 @@ function sql_select($query) {
$result = $sql_connection->query($query);
if ($result) {
- $data = array();
- while ($line = $result->fetch_assoc())
+ $data = [];
+ while ($line = $result->fetch_assoc()) {
array_push($data, $line);
+ }
return $data;
- } else
- return sql_error("MySQL-query error: " . $query . " (" . $sql_connection->errno . ") " . $sql_connection->error);
+ }
+
+ return sql_error("MySQL-query error: " . $query . " (" . $sql_connection->errno . ") " . $sql_connection->error);
}
/**
@@ -147,8 +155,9 @@ function sql_query($query) {
$result = $sql_connection->query($query);
if ($result) {
return $result;
- } else
- return sql_error("MySQL-query error: " . $query . " (" . $sql_connection->errno . ") " . $sql_connection->error);
+ }
+
+ return sql_error("MySQL-query error: " . $query . " (" . $sql_connection->errno . ") " . $sql_connection->error);
}
/**