DooPHP IRC channel


DooPHP with PostgreSQL

Share your tips, snippets and experiences about DooPHP, and discuss about best DooPHP practices.

DooPHP with PostgreSQL

Postby gusarg » Sat Aug 01, 2009 2:49 am

First step
- db.conf.php
$dbconfig['dev'] = array('localhost', 'dbname', 'username', 'password', 'pgsql', false); //do not to use persistent connections to test :)
- additional configurations

//The right way :D
Add it on app/index.php
Tip: See reason in http://www.doophp.com/doc/guide/basic/mvc. Because you must have been wondering ;)


....
Doo::db()->setDb($dbconfig, $config['APP_MODE']);
Doo::db()->sql_tracking = true;
//CHANGE DATABASE SCHEMA
$st = Doo::db()->query('SET search_path TO myschema');
//CHANGE DATABASE CLIENT CHARSET
$st = Doo::db()->query("SET NAMES 'utf8'"); //View http://www.postgresql.org/docs/8.2/stat ... ibyte.html
//TEST - Not add!!
$st = Doo::db()->query('select * from mytable');
$result = $st->fetch(PDO::FETCH_ASSOC);
var_dump($result);
//END Test
....
Doo::app()->route = $route;
Doo::app()->run();

//Unfriendly way!!! not recommended!!!! :shock:
Add a table name with _table=myschema.mytable in the model "MyTable"
Last edited by gusarg on Mon Aug 03, 2009 5:12 pm, edited 1 time in total.
gusarg
 
Posts: 70
Joined: Wed Jul 29, 2009 3:17 pm
Location: Argentina

Re: DooPHP with PostgreSQL

Postby leng » Sat Aug 01, 2009 7:22 am

a nice headstart, thumbs up to gusarg!
Just Doo IT!
leng
 
Posts: 1482
Joined: Thu Jul 16, 2009 11:33 pm

Re: DooPHP with PostgreSQL

Postby enriqueism » Fri May 04, 2012 4:16 pm

Hi!, What happen if I have to work with several schemas at the same time?
enriqueism
 
Posts: 1
Joined: Fri May 04, 2012 4:12 pm


Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 0 guests

cron