PHP Classes

postgresQL Support

Recommend this page to a friend!

      Eyesis Data Grid Control  >  All threads  >  postgresQL Support  >  (Un) Subscribe thread alerts  
Subject:postgresQL Support
Summary:Add postgresql support.
Messages:6
Author:Nicolas Machado
Date:2009-01-09 14:56:30
Update:2011-08-25 11:36:53
 

  1. postgresQL Support   Reply   Report abuse  
Picture of Nicolas Machado Nicolas Machado - 2009-01-09 14:56:30
Hi, I added ( created a new Adapter ) for supporting postgresql,
I'n na totally newby php coder, so I only want to know if there is another workaround to the one I meet.

I think that the problema was in SelectOneValue return, so I create an specific selectCount function.

I will try to send the file.

Best Regards

  2. Re: postgresQL Support   Reply   Report abuse  
Picture of Nicolas Machado Nicolas Machado - 2009-01-09 15:05:44 - In reply to message 1 from Nicolas Machado
I also change some lines in the main class because LIMIT clause is not allowed like mysql.

its the opsite, an you must use LIMIT OFSET
so I:
/**
* Sets the limit by clause
*
* @param integer $low The minimum row number
* @param integer $high The maximum row number
*/
//private function setLimit($low, $high)
private function setLimit($high, $low)
{
$this->limit = array('Low' => $low,
'High' => $high);
}


and the sql clause:
// LIMIT
if ($this->limit)
//ver funcion SetLimit, en postgres SQL se usa el Offset
//$limit = "LIMIT " . $this->limit['Low'] . ", " . $this->limit['High'];
$limit = "LIMIT " . $this->limit['Low'] . " OFFSET " . $this->limit['High'];
//$limit = "LIMIT " . $this->limit['High'];
else
$limit = '';


Best Regards

  3. Re: postgresQL Support   Reply   Report abuse  
Picture of Alain Cheng Alain Cheng - 2009-01-21 13:47:23 - In reply to message 2 from Nicolas Machado
Can you send me your code of connection to postgresql?

I can connect to my postgresql
but i always have 0 results.

I don't understand why
DO i have to change anything in printTable()?


  4. Re: postgresQL Support   Reply   Report abuse  
Picture of ptx ptx - 2009-07-16 01:10:42 - In reply to message 3 from Alain Cheng
i "rewrite" a few line in this method (and replace the mysql function for valid function in pgsql

public function selectOneValue($field, $table, $where = false, $orderby = false){

$result = $this->selectOne($field, $table, $where, $orderby);
$carac= array('(',')','*');
$field = str_replace($carac,"",$field );

return $result[$field];

}

  5. Re: postgresQL Support   Reply   Report abuse  
Picture of ionutz ionutz ionutz ionutz - 2009-08-18 07:08:43 - In reply to message 1 from Nicolas Machado
hi
i didn't find the code
can you send the code please
thank you
ionutzpi@yahoo.com

  6. Re: postgresQL Support   Reply   Report abuse  
Picture of Karol Karol - 2011-08-25 11:36:53 - In reply to message 4 from ptx
This code is Ok, but You must change line:
$field = str_replace($carac,"",$field );

public function selectOneValue($field, $table, $where = false, $orderby = false){

$result = $this->selectOne($field, $table, $where, $orderby);
$carac= array('(',')','*');
$field = strtolower(str_replace($carac,"",$field ));

return $result[$field];

}