Vergleich inc/db_pgsql.php - 1.8.21 - 1.8.29

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 181Zeile 181
			}
}


			}
}


		$this->db_encoding = $config['encoding'];




		if(isset($config['encoding']))
{
$this->db_encoding = $config['encoding'];
}


// Actually connect to the specified servers
foreach(array('read', 'write') as $type)


// Actually connect to the specified servers
foreach(array('read', 'write') as $type)

Zeile 189Zeile 192
			if(!isset($connections[$type]) || !is_array($connections[$type]))
{
break;

			if(!isset($connections[$type]) || !is_array($connections[$type]))
{
break;

			}


			}


			if(array_key_exists('hostname', $connections[$type]))
{
$details = $connections[$type];

			if(array_key_exists('hostname', $connections[$type]))
{
$details = $connections[$type];

				unset($connections);

				unset($connections[$type]);

				$connections[$type][] = $details;
}


				$connections[$type][] = $details;
}


Zeile 211Zeile 214
				}

$link = $type."_link";

				}

$link = $type."_link";





				get_execution_time();

$this->connect_string = "dbname={$single_connection['database']} user={$single_connection['username']}";

				get_execution_time();

$this->connect_string = "dbname={$single_connection['database']} user={$single_connection['username']}";





				if(strpos($single_connection['hostname'], ':') !== false)

				if(strpos($single_connection['hostname'], ':') !== false)

				{

				{

					list($single_connection['hostname'], $single_connection['port']) = explode(':', $single_connection['hostname']);

					list($single_connection['hostname'], $single_connection['port']) = explode(':', $single_connection['hostname']);

 
				}
else
{
$single_connection['port'] = null;

				}

if($single_connection['port'])

				}

if($single_connection['port'])

Zeile 278Zeile 285

/**
* Query the database.


/**
* Query the database.

	 *
* @param string $string The query SQL.
* @param boolean|int $hide_errors 1 if hide errors, 0 if not.

	 *
* @param string $string The query SQL.
* @param boolean|int $hide_errors 1 if hide errors, 0 if not.

	 * @param integer $write_query 1 if executes on slave database, 0 if not.
* @return resource The query data.
*/

	 * @param integer $write_query 1 if executes on slave database, 0 if not.
* @return resource The query data.
*/

Zeile 288Zeile 295
	{
global $mybb;


	{
global $mybb;


		$string = preg_replace("#LIMIT (\s*)([0-9]+),(\s*)([0-9]+)$#im", "LIMIT $4 OFFSET $2", trim($string));

		$string = preg_replace("#LIMIT (\s*)([0-9]+),(\s*)([0-9]+);?$#im", "LIMIT $4 OFFSET $2", trim($string));


$this->last_query = $string;



$this->last_query = $string;


Zeile 346Zeile 353
	function write_query($query, $hide_errors=0)
{
return $this->query($query, $hide_errors, 1);

	function write_query($query, $hide_errors=0)
{
return $this->query($query, $hide_errors, 1);

	}


	}


	/**
* Explain a query on the database.
*

	/**
* Explain a query on the database.
*

Zeile 412Zeile 419
	 * @return array The array of results. Note that all fields are returned as string: http://php.net/manual/en/function.pg-fetch-array.php
*/
function fetch_array($query, $resulttype=PGSQL_ASSOC)

	 * @return array The array of results. Note that all fields are returned as string: http://php.net/manual/en/function.pg-fetch-array.php
*/
function fetch_array($query, $resulttype=PGSQL_ASSOC)

	{

	{

		switch($resulttype)
{
case PGSQL_NUM:

		switch($resulttype)
{
case PGSQL_NUM:

Zeile 421Zeile 428
			default:
$resulttype = PGSQL_ASSOC;
break;

			default:
$resulttype = PGSQL_ASSOC;
break;

		}

$array = pg_fetch_array($query, NULL, $resulttype);


		}

$array = pg_fetch_array($query, NULL, $resulttype);


		return $array;
}


		return $array;
}


Zeile 441Zeile 448
		if($row === false)
{
$array = $this->fetch_array($query);

		if($row === false)
{
$array = $this->fetch_array($query);

			return $array[$field];
}
else
{
return pg_fetch_result($query, $row, $field);

			if($array !== null && $array !== false)
{
return $array[$field];
}
return null;

		}

		}

 

return pg_fetch_result($query, $row, $field);

	}

/**

	}

/**

Zeile 479Zeile 488
	 */
function insert_id()
{

	 */
function insert_id()
{

		$this->last_query = str_replace(array("\r", "\t"), '', $this->last_query);
$this->last_query = str_replace("\n", ' ', $this->last_query);
preg_match('#INSERT INTO ([a-zA-Z0-9_\-]+)#i', $this->last_query, $matches);

		preg_match('#INSERT\s+INTO\s+([a-zA-Z0-9_\-]+)#i', $this->last_query, $matches);




$table = $matches[1];



$table = $matches[1];


Zeile 964Zeile 971
	 */
function escape_string_like($string)
{

	 */
function escape_string_like($string)
{

		return $this->escape_string(str_replace(array('%', '_') , array('\\%' , '\\_') , $string));

		return $this->escape_string(str_replace(array('\\', '%', '_') , array('\\\\', '\\%' , '\\_') , $string));

	}

/**

	}

/**