Init ci
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
class Pgsql implements iDbDriver {
|
||||
|
||||
private $_connection = false;
|
||||
|
||||
public function connect($host, $port, $dbname, $login, $pass) {
|
||||
$this->connection = pg_connect('host='. $host .' port='. $port .' dbname='. $dbname .' user='. $login .' password='. $pass);
|
||||
}
|
||||
|
||||
public function q($q) {
|
||||
return pg_query($q);
|
||||
}
|
||||
|
||||
public function getRows($r, $key = false) {
|
||||
$rows = array();
|
||||
while($row = pg_fetch_assoc($r)) {
|
||||
if (!$key) {
|
||||
$rows[] = $row;
|
||||
} else {
|
||||
$rows[$row[$key]] = $row;
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function getRow($r) {
|
||||
return pg_fetch_assoc($r);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
interface iDbDriver {
|
||||
|
||||
public function connect($host, $port, $dbname, $login, $pass);
|
||||
|
||||
public function q($q);
|
||||
|
||||
public function getRows($r, $key);
|
||||
|
||||
public function getRow($r);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user