GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#1960)
by
unknown
15:18
created

DBMysqli   C

Complexity

Total Complexity 55

Size/Duplication

Total Lines 417
Duplicated Lines 60.19 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 0
Metric Value
dl 251
loc 417
rs 6.8
c 0
b 0
f 0
wmc 55
lcom 2
cbo 1

15 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 4 1
B __connect() 27 27 3
A _close() 0 4 1
A addQuotes() 13 13 4
B __query() 56 56 8
C _prepareQueryParameters() 47 47 8
F _fetch() 97 97 17
A _executeInsertAct() 0 11 2
A _executeUpdateAct() 0 11 2
A _executeDeleteAct() 0 11 2
A _executeSelectAct() 11 11 2
A db_insert_id() 0 5 1
A db_fetch_object() 0 4 1
A db_free_result() 0 4 1
A DBMysqli() 0 5 2

How to fix   Duplicated Code    Complexity   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

Complex Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like DBMysqli often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use DBMysqli, and based on these observations, apply Extract Interface, too.

1
<?php
2
/* Copyright (C) NAVER <http://www.navercorp.com> */
3
4
require_once('DBMysql.class.php');
5
6
/**
7
 * Class to use MySQLi DBMS as mysqli_*
8
 * mysql handling class
9
 *
10
 * Does not use prepared statements, since mysql driver does not support them
11
 *
12
 * @author NAVER ([email protected])
13
 * @package /classes/db
14
 * @version 0.1
15
 */
16
class DBMysqli extends DBMysql
17
{
18
19
	/**
20
	 * Constructor
21
	 * @return void
22
	 */
23
	function DBMysqli($auto_connect = TRUE)
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
24
	{
25
		$this->_setDBInfo();
26
		if($auto_connect) $this->_connect();
27
	}
28
29
	/**
30
	 * Create an instance of this class
31
	 * @return DBMysqli return DBMysqli object instance
32
	 */
33
	function create()
34
	{
35
		return new DBMysqli;
36
	}
37
38
	/**
39
	 * DB Connect
40
	 * this method is private
41
	 * @param array $connection connection's value is db_hostname, db_port, db_database, db_userid, db_password
42
	 * @return resource
43
	 */
44 View Code Duplication
	function __connect($connection)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
45
	{
46
		// Attempt to connect
47
		if($connection["db_port"])
48
		{
49
			$result = @mysqli_connect($connection["db_hostname"]
50
							, $connection["db_userid"]
51
							, $connection["db_password"]
52
							, $connection["db_database"]
53
							, $connection["db_port"]);
54
		}
55
		else
56
		{
57
			$result = @mysqli_connect($connection["db_hostname"]
58
							, $connection["db_userid"]
59
							, $connection["db_password"]
60
							, $connection["db_database"]);
61
		}
62
		$error = mysqli_connect_errno();
63
		if($error)
64
		{
65
			$this->setError($error, mysqli_connect_error());
66
			return;
67
		}
68
		mysqli_set_charset($result, 'utf8');
69
		return $result;
70
	}
71
72
	/**
73
	 * DB disconnection
74
	 * this method is private
75
	 * @param resource $connection
76
	 * @return void
77
	 */
78
	function _close($connection)
79
	{
80
		mysqli_close($connection);
81
	}
82
83
	/**
84
	 * Handles quatation of the string variables from the query
85
	 * @param string $string
86
	 * @return string
87
	 */
88 View Code Duplication
	function addQuotes($string)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
89
	{
90
		if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
91
		{
92
			$string = stripslashes(str_replace("\\", "\\\\", $string));
93
		}
94
		if(!is_numeric($string))
95
		{
96
			$connection = $this->_getConnection('master');
97
			$string = mysqli_escape_string($connection, $string);
98
		}
99
		return $string;
100
	}
101
102
	/**
103
	 * Execute the query
104
	 * this method is private
105
	 * @param string $query
106
	 * @param resource $connection
107
	 * @return resource
108
	 */
109 View Code Duplication
	function __query($query, $connection)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
110
	{
111
		if($this->use_prepared_statements == 'Y')
112
		{
113
			// 1. Prepare query
114
			$stmt = mysqli_prepare($connection, $query);
115
			if($stmt)
116
			{
117
				$types = '';
118
				$params = array();
119
				$this->_prepareQueryParameters($types, $params);
120
121
				if(!empty($params))
122
				{
123
					$args[0] = $stmt;
0 ignored issues
show
Coding Style Comprehensibility introduced by
$args was never initialized. Although not strictly required by PHP, it is generally a good practice to add $args = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
124
					$args[1] = $types;
125
126
					$i = 2;
127
					foreach($params as $key => $param)
128
					{
129
						$copy[$key] = $param;
0 ignored issues
show
Coding Style Comprehensibility introduced by
$copy was never initialized. Although not strictly required by PHP, it is generally a good practice to add $copy = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
130
						$args[$i++] = &$copy[$key];
0 ignored issues
show
Bug introduced by
The variable $copy does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
131
					}
132
133
					// 2. Bind parameters
134
					$status = call_user_func_array('mysqli_stmt_bind_param', $args);
135
					if(!$status)
136
					{
137
						$this->setError(-1, "Invalid arguments: $query" . mysqli_error($connection) . PHP_EOL . print_r($args, true));
138
					}
139
				}
140
141
				// 3. Execute query
142
				$status = mysqli_stmt_execute($stmt);
143
144
				if(!$status)
145
				{
146
					$this->setError(-1, "Prepared statement failed: $query" . mysqli_error($connection) . PHP_EOL . print_r($args, true));
0 ignored issues
show
Bug introduced by
The variable $args does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
147
				}
148
149
				// Return stmt for other processing - like retrieving resultset (_fetch)
150
				return $stmt;
151
				// mysqli_stmt_close($stmt);
152
			}
153
		}
154
		// Run the query statement
155
		$result = mysqli_query($connection, $query);
156
		// Error Check
157
		$error = mysqli_error($connection);
158
		if($error)
159
		{
160
			$this->setError(mysqli_errno($connection), $error);
161
		}
162
		// Return result
163
		return $result;
164
	}
165
166
	/**
167
	 * Before execute query, prepare statement
168
	 * this method is private
169
	 * @param string $types
170
	 * @param array $params
171
	 * @return void
172
	 */
173 View Code Duplication
	function _prepareQueryParameters(&$types, &$params)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
174
	{
175
		$types = '';
176
		$params = array();
177
		if(!$this->param)
0 ignored issues
show
Bug introduced by
The property param does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
178
		{
179
			return;
180
		}
181
182
		foreach($this->param as $k => $o)
183
		{
184
			$value = $o->getUnescapedValue();
185
			$type = $o->getType();
186
187
			// Skip column names -> this should be concatenated to query string
188
			if($o->isColumnName())
189
			{
190
				continue;
191
			}
192
193
			switch($type)
194
			{
195
				case 'number' :
196
					$type = 'i';
197
					break;
198
				case 'varchar' :
199
					$type = 's';
200
					break;
201
				default:
202
					$type = 's';
203
			}
204
205
			if(is_array($value))
206
			{
207
				foreach($value as $v)
208
				{
209
					$params[] = $v;
210
					$types .= $type;
211
				}
212
			}
213
			else
214
			{
215
				$params[] = $value;
216
				$types .= $type;
217
			}
218
		}
219
	}
220
221
	/**
222
	 * Fetch the result
223
	 * @param resource $result
224
	 * @param int|NULL $arrayIndexEndValue
225
	 * @return array
226
	 */
227 View Code Duplication
	function _fetch($result, $arrayIndexEndValue = NULL)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
228
	{
229
		if($this->use_prepared_statements != 'Y')
230
		{
231
			return parent::_fetch($result, $arrayIndexEndValue);
232
		}
233
		$output = array();
234
		if(!$this->isConnected() || $this->isError() || !$result)
235
		{
236
			return $output;
237
		}
238
239
		// Prepared stements: bind result variable and fetch data
240
		$stmt = $result;
241
		$meta = mysqli_stmt_result_metadata($stmt);
242
		$fields = mysqli_fetch_fields($meta);
243
244
		/**
245
		 * Mysqli has a bug that causes LONGTEXT columns not to get loaded
246
		 * Unless store_result is called before
247
		 * MYSQLI_TYPE for longtext is 252
248
		 */
249
		$longtext_exists = false;
250
		foreach($fields as $field)
251
		{
252
			if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails
253
			{
254
				$field->name = 'repeat_' . $field->name;
255
			}
256
257
			// Array passed needs to contain references, not values
258
			$row[$field->name] = "";
0 ignored issues
show
Coding Style Comprehensibility introduced by
$row was never initialized. Although not strictly required by PHP, it is generally a good practice to add $row = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
259
			$resultArray[$field->name] = &$row[$field->name];
0 ignored issues
show
Bug introduced by
The variable $resultArray does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
Bug introduced by
The variable $row does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
260
261
			if($field->type == 252)
262
			{
263
				$longtext_exists = true;
264
			}
265
		}
266
		$resultArray = array_merge(array($stmt), $resultArray);
267
268
		if($longtext_exists)
269
		{
270
			mysqli_stmt_store_result($stmt);
271
		}
272
273
		call_user_func_array('mysqli_stmt_bind_result', $resultArray);
274
275
		$rows = array();
276
		while(mysqli_stmt_fetch($stmt))
277
		{
278
			$resultObject = new stdClass();
279
280
			foreach($resultArray as $key => $value)
281
			{
282
				if($key === 0)
283
				{
284
					continue; // Skip stmt object
285
				}
286
				if(strpos($key, 'repeat_'))
287
				{
288
					$key = substr($key, 6);
289
				}
290
				$resultObject->$key = $value;
291
			}
292
293
			$rows[] = $resultObject;
294
		}
295
296
		mysqli_stmt_close($stmt);
297
298
		if($arrayIndexEndValue)
0 ignored issues
show
Bug Best Practice introduced by
The expression $arrayIndexEndValue of type integer|null is loosely compared to true; this is ambiguous if the integer can be zero. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
299
		{
300
			foreach($rows as $row)
301
			{
302
				$output[$arrayIndexEndValue--] = $row;
303
			}
304
		}
305
		else
306
		{
307
			$output = $rows;
308
		}
309
310
		if(count($output) == 1)
311
		{
312
			if(isset($arrayIndexEndValue))
313
			{
314
				return $output;
315
			}
316
			else
317
			{
318
				return $output[0];
319
			}
320
		}
321
322
		return $output;
323
	}
324
325
	/**
326
	 * Handles insertAct
327
	 * @param Object $queryObject
328
	 * @param boolean $with_values
329
	 * @return resource
330
	 */
331
	function _executeInsertAct($queryObject, $with_values = false)
332
	{
333
		if($this->use_prepared_statements != 'Y')
334
		{
335
			return parent::_executeInsertAct($queryObject);
336
		}
337
		$this->param = $queryObject->getArguments();
338
		$result = parent::_executeInsertAct($queryObject, $with_values);
339
		unset($this->param);
340
		return $result;
341
	}
342
343
	/**
344
	 * Handles updateAct
345
	 * @param Object $queryObject
346
	 * @param boolean $with_values
347
	 * @return resource
348
	 */
349
	function _executeUpdateAct($queryObject, $with_values = false)
350
	{
351
		if($this->use_prepared_statements != 'Y')
352
		{
353
			return parent::_executeUpdateAct($queryObject);
354
		}
355
		$this->param = $queryObject->getArguments();
356
		$result = parent::_executeUpdateAct($queryObject, $with_values);
357
		unset($this->param);
358
		return $result;
359
	}
360
361
	/**
362
	 * Handles deleteAct
363
	 * @param Object $queryObject
364
	 * @param boolean $with_values
365
	 * @return resource
366
	 */
367
	function _executeDeleteAct($queryObject, $with_values = false)
368
	{
369
		if($this->use_prepared_statements != 'Y')
370
		{
371
			return parent::_executeDeleteAct($queryObject);
372
		}
373
		$this->param = $queryObject->getArguments();
374
		$result = parent::_executeDeleteAct($queryObject, $with_values);
375
		unset($this->param);
376
		return $result;
377
	}
378
379
	/**
380
	 * Handle selectAct
381
	 * In order to get a list of pages easily when selecting \n
382
	 * it supports a method as navigation
383
	 * @param Object $queryObject
384
	 * @param resource $connection
385
	 * @param boolean $with_values
386
	 * @return Object
387
	 */
388 View Code Duplication
	function _executeSelectAct($queryObject, $connection = null, $with_values = false)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
389
	{
390
		if($this->use_prepared_statements != 'Y')
391
		{
392
			return parent::_executeSelectAct($queryObject, $connection);
393
		}
394
		$this->param = $queryObject->getArguments();
395
		$result = parent::_executeSelectAct($queryObject, $connection, $with_values);
396
		unset($this->param);
397
		return $result;
398
	}
399
400
	/**
401
	 * Get the ID generated in the last query
402
	 * Return next sequence from sequence table
403
	 * This method use only mysql
404
	 * @return int
405
	 */
406
	function db_insert_id()
407
	{
408
		$connection = $this->_getConnection('master');
409
		return mysqli_insert_id($connection);
410
	}
411
412
	/**
413
	 * Fetch a result row as an object
414
	 * @param resource $result
415
	 * @return object
416
	 */
417
	function db_fetch_object(&$result)
418
	{
419
		return mysqli_fetch_object($result);
420
	}
421
422
	/**
423
	 * Free result memory
424
	 * @param resource $result
425
	 * @return boolean Returns TRUE on success or FALSE on failure.
426
	 */
427
	function db_free_result(&$result)
428
	{
429
		return mysqli_free_result($result);
430
	}
431
432
}
433
434
DBMysqli::$isSupported = function_exists('mysqli_connect');
0 ignored issues
show
Bug introduced by
The property isSupported cannot be accessed from this context as it is declared private in class DB.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
435
436
/* End of file DBMysqli.class.php */
437
/* Location: ./classes/db/DBMysqli.class.php */
438