Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Recommended Posts

Всем доброго времени суток.

Opencart 1.5.6.1

Сделал дамп базы mysql, подправил синтаксис, залил в базу postgresql.

В конфигах прописываю драйвер postgre, но сайт не работает, если подключиться к базе через драйвер mysql, сайт работает, но в админку не пускает, постоянно пишет логин или пароль неверный.

Подскажите, пожалуйста, с чем может быть связано, куда копать?

 

Edited by spik
Link to comment
Share on other sites


Модули все стандартные, на чистом движке пока пытаюсь.

Так драйвер postgre в opencart для вида лежит?

Заказчику приспичило базу postgresql, то что она быстрее и большой объем данных тянет.

Link to comment
Share on other sites


Кто нибудь правил драйвер postgre? 
Сейчас подключая драйвер - просто белый экран.

Может кто знает, подскажет что не так?

<?php
final class DBPostgre {
	private $link;

	public function __construct($hostname, $username, $password, $database) {
		if (!$this->link = pg_connect('hostname=' . $hostname . 'port=5432 username=' . $username . ' password='	. $password . ' database=' . $database)) {
			trigger_error('Error: Could not make a database link using ' . $username . '@' . $hostname);
		} 

		if (!mysql_select_db($database, $this->link)) {
			trigger_error('Error: Could not connect to database ' . $database);
		}

		pg_query($this->link, "SET CLIENT_ENCODING TO 'UTF8'");
	}

	public function query($sql) {
		$resource = pg_query($this->link, $sql);

		if ($resource) {
			if (is_resource($resource)) {
				$i = 0;

				$data = array();

				while ($result = pg_fetch_assoc($resource)) {
					$data[$i] = $result;

					$i++;
				}

				pg_free_result($resource);

				$query = new stdClass();
				$query->row = isset($data[0]) ? $data[0] : array();
				$query->rows = $data;
				$query->num_rows = $i;

				unset($data);

				return $query;
			} else {
				return true;
			}
		} else {
			trigger_error('Error: ' . pg_result_error($this->link) . '<br />' . $sql);
			exit();
		}
	}

	public function escape($value) {
		return pg_escape_string($this->link, $value);
	}

	public function countAffected() {
		return pg_affected_rows($this->link);
	}

	public function getLastId() {
		$query = $this->query("SELECT LASTVAL() AS `id`");
		return $query->row['id'];
	}

	public function __destruct() {
		pg_close($this->link);
	}
}

 

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.