diff options
author | msquare <msquare@notrademark.de> | 2016-09-27 17:24:18 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-09-27 17:49:39 +0200 |
commit | 45bbf95972777e9499996d56a873c2a304815b3f (patch) | |
tree | e4acec80f969e1d220f7ec1a1e975c8ce3d4b541 /includes/mysqli_provider.php | |
parent | f82a3fb1d81c4800bbe343231479ee29f935b190 (diff) |
fix settings validation
Diffstat (limited to 'includes/mysqli_provider.php')
-rw-r--r-- | includes/mysqli_provider.php | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/includes/mysqli_provider.php b/includes/mysqli_provider.php index 4a3f2a45..7197b95a 100644 --- a/includes/mysqli_provider.php +++ b/includes/mysqli_provider.php @@ -5,7 +5,7 @@ */ function sql_close() { global $sql_connection; - + return $sql_connection->close(); } @@ -21,7 +21,7 @@ function sql_null($value = null) { */ function sql_transaction_start() { global $sql_nested_transaction_level; - + if ($sql_nested_transaction_level ++ == 0) return sql_query("BEGIN"); else @@ -33,7 +33,7 @@ function sql_transaction_start() { */ function sql_transaction_commit() { global $sql_nested_transaction_level; - + if (-- $sql_nested_transaction_level == 0) return sql_query("COMMIT"); else @@ -45,7 +45,7 @@ function sql_transaction_commit() { */ function sql_transaction_rollback() { global $sql_nested_transaction_level; - + if (-- $sql_nested_transaction_level == 0) return sql_query("ROLLBACK"); else @@ -55,17 +55,17 @@ function sql_transaction_rollback() { /** * Logs an sql error. * - * @param string $message + * @param string $message * @return false */ function sql_error($message) { sql_close(); - + $message = trim($message) . "\n"; $message .= debug_string_backtrace() . "\n"; - + error_log('mysql_provider error: ' . $message); - + return false; } @@ -84,21 +84,21 @@ function sql_error($message) { */ function sql_connect($host, $user, $pass, $db) { global $sql_connection; - + $sql_connection = new mysqli($host, $user, $pass, $db); if ($sql_connection->connect_errno) { - error("Unable to connect to MySQL: " . $sql_connection->connect_error); + error("Unable to connect to MySQL: " . $sql_connection->connect_error); return sql_error("Unable to connect to MySQL: " . $sql_connection->connect_error); } - + $result = $sql_connection->query("SET CHARACTER SET utf8;"); 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) return sql_error("Unable to set utf8 names (" . $sql_connection->errno . ") " . $sql_connection->error); - + return $sql_connection; } @@ -119,12 +119,12 @@ function sql_select_db($db_name) { /** * MySQL SELECT query * - * @param string $query + * @param string $query * @return Result array or false on error */ function sql_select($query) { global $sql_connection; - + $result = $sql_connection->query($query); if ($result) { $data = array(); @@ -138,12 +138,12 @@ function sql_select($query) { /** * MySQL execute a query * - * @param string $query + * @param string $query * @return mysqli_result boolean resource or false on error */ function sql_query($query) { global $sql_connection; - + $result = $sql_connection->query($query); if ($result) { return $result; @@ -164,7 +164,7 @@ function sql_id() { /** * Escape a string for a sql query. * - * @param string $query + * @param string $query * @return string */ function sql_escape($query) { @@ -175,7 +175,7 @@ function sql_escape($query) { /** * Convert a boolean for mysql-queries. * - * @param boolean $boolean + * @param boolean $boolean * @return string */ function sql_bool($boolean) { @@ -185,7 +185,7 @@ function sql_bool($boolean) { /** * Count query result lines. * - * @param string $query + * @param string $query * @return int Count of result lines */ function sql_num_query($query) { |