[PHP-DB] php 5.2.9 and Postgres 8.3.7

2009-06-17 Thread Didier Gasser-Morlay

Hello,

I tried all day yesterday to setup a brand new machine with a fresh 
Linux install; with apache 2.2.10 (from source) php 5.2.9 (from source) 
and PostgresQL 8.3.7 (from the very neat one-click installer provided by 
Enterprisedb) ; everything compiles and installs fine but when trying to 
run the first query  to my database I consistently get a message about 
pg_escape_string function missing.


I am connecting through ADODB which filters any query via

 '.pg_escape_string($this-_connectionID,$s).';

I had no problem using the same build with php 5.2.8 and Postgres 8.3.4, 
so I ended up using the mod_php5.so module for apache build with these 
versions, but would like to get to the bottom of it.



Any idea or comment ?

Didier



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Postgres query failing, not enough info for debugging...

2009-06-17 Thread Ford, Mike
On 16 June 2009 15:57, Carol Walter advised:

 Hello,
 
 I'm using PHP 5 and PostgreSQL 8.3.6.  I have a query that is failing
 and I don't know how to troubleshoot the problem.  The error message
 that it is giving is quite vague.  The error message is as follows:
 
 
 Warning: pg_query_params() [function.pg-query-params]: Query failed:
 ERROR: syntax error at end of input at character 156 in /home/walterc/
 ssl/PHP/km_input_test2c.php on line 631
 ERROR: syntax error at end of input at character 156
 
 The query that is failing looks like this...
 
 $pg_pres_ins6 = pg_query_params(INSERT INTO \brdgMediaCallsEvents
 \ (\mediumId\, \eventId\, rank) VALUES
 ((currval('\tblMedia_mediumId_seq\'),
 (currval('\tblCallsEvents_eventId_seq\'), $1), array($ev_rank));
   echo pg_last_error($pg_connection);

You have 2 more opening parentheses than close parentheses in that SQL
-- in both cases, the parenthesis immediately preceding currval should
be omitted.

Also, to ameliorate your quote hell, you might consider using a heredoc
(http://php.net/manual/language.types.string.php#language.types.string.s
yntax.heredoc) for this:

  $pg_pres_ins6 = pg_query_params(SQL
  INSERT INTO brdgMediaCallsEvents (mediumId, eventId, rank)
  VALUES (currval('tblMedia_mediumId_seq'),
  currval('tblCallsEvents_eventId_seq'), $1)
  SQL
 , array($ev_rank));

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.f...@leedsmet.ac.uk
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] php 5.2.9 and Postgres 8.3.7

2009-06-17 Thread danaketh
Do you have postgres module for PHP installed? This will probably be the 
cause.


Didier Gasser-Morlay napsal(a):

Hello,

I tried all day yesterday to setup a brand new machine with a fresh 
Linux install; with apache 2.2.10 (from source) php 5.2.9 (from 
source) and PostgresQL 8.3.7 (from the very neat one-click installer 
provided by Enterprisedb) ; everything compiles and installs fine but 
when trying to run the first query  to my database I consistently get 
a message about pg_escape_string function missing.


I am connecting through ADODB which filters any query via

 '.pg_escape_string($this-_connectionID,$s).';

I had no problem using the same build with php 5.2.8 and Postgres 
8.3.4, so I ended up using the mod_php5.so module for apache build 
with these versions, but would like to get to the bottom of it.



Any idea or comment ?

Didier





--

S pozdravem

Daniel Tlach
Freelance webdeveloper

Email: m...@danaketh.com
ICQ: 160914875
MSN: danak...@hotmail.com
Jabber: danak...@jabbim.cz


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] What is SAPI?

2009-06-17 Thread info
Dear Sir/Madam,

SilkWise.com is a popular question answer website. Some of our users asked the 
above question, and we think you are the domain expert who can provide a great 
answer to it. Can you help to answer the question or improve the current answer 
at the following link?

http://www.silkwise.com/content/viewthread_thread,7748

Everyone has unique expertise. SilkWise is the place to share your wisdom, 
build your networks, and market yourself! 

SilkWise Team






To stop future messages from me, visit 
http://silkwise.com/content/viewthread_thread,6667 


 contact PO BOX 36092 Milpitas,CA

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] php 5.2.9 and Postgres 8.3.7

2009-06-17 Thread Didier Gasser-Morlay

Lester,

Sorry, I should have said:
Yes: Postgres is up  running happily on the machine
yes : Postgres is listed in phpinfo; with the correct version; php was 
connecting fine to the dababase, this message only happens on the 1st 
query which is when the function pg_escape_string is called.







--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] php 5.2.9 and Postgres 8.3.7

2009-06-17 Thread Didier Gasser-Morlay

Lester,

Sorry, I should have said:
Yes: Postgres is up  running happily on the machine
yes : Postgres is listed in phpinfo; with the correct version; php was 
connecting fine to the dababase, this message only happens on the 1st 
query which is when the function pg_escape_string is called.







--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Using a PostgreSQL refcursor.

2009-06-17 Thread Hartman, Matthew
Good morning.

Is there a way to use a returned refcursor from PostgreSQL using PDO? I
have scoured the web and have yet to find a good result. Here's a few
things I've tried.

This example simply does not work.
-
$database = Database::load(); // Returns a singleton object with PDO
connected to the database.
$sql = select my_function();;
$p = $database-query($sql);
$p-execute();
$result = $p-fetchAll();
$p-closeCursor();
-

This example is closer but PDO complains that the cursor is already
open.
-
$database = Database::load(); // Returns a singleton object with PDO
connected to the database.
$sql = BEGIN; select my_function('my_refcursor'); FETCH ALL from
'my_refcursor';;
$p = $database-query($sql);
$p-execute();
$result = $p-fetchAll();
$p-closeCursor();
-



Matthew Hartman
Programmer/Analyst
Information Management, ICP
Kingston General Hospital
(613) 549- x4294 
 
.now.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php