<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-775</id>
	<title>Nabble - PostgreSQL - php</title>
	<updated>2009-12-03T01:35:14Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/PostgreSQL---php-f775.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL---php-f775.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26623284</id>
	<title>Re: Problem with utf8 encoding</title>
	<published>2009-12-03T01:35:14Z</published>
	<updated>2009-12-03T01:35:14Z</updated>
	<author>
		<name>Andrew McMillan-5</name>
	</author>
	<content type="html">On Thu, 2009-12-03 at 02:00 -0500, Jorge Miranda Castañeda wrote:
&lt;div class='shrinkable-quote'&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello everyone!
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I'm working in a project using postgres, propel, and php.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; My development environment is:
&lt;br&gt;&amp;gt; SO: Windows vista Business SP2
&lt;br&gt;&amp;gt; Postgres: Postgres v8.4
&lt;br&gt;&amp;gt; Propel: Propel generator/runtime v1.4
&lt;br&gt;&amp;gt; PHP: PHP v5.3
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Currently I'm struggling with a problem caused by the encoding.
&lt;br&gt;&amp;gt; Everytime I try to insert a row into the table CURRENCY, which has ID,
&lt;br&gt;&amp;gt; DESC, and SYMBOL as its columns, I get the following error:
&lt;br&gt;&amp;gt; Unable to execute INSERT statement. [wrapped: SQLSTATE[22021]:
&lt;br&gt;&amp;gt; Character not in repertoire: 7 ERROR: invalid byte sequence for
&lt;br&gt;&amp;gt; encoding &amp;quot;UTF8&amp;quot;: 0x80 HINT: This error can also happen if the byte
&lt;br&gt;&amp;gt; sequence does not match the encoding expected by the server, which is
&lt;br&gt;&amp;gt; controlled by &amp;quot;client_encoding&amp;quot;.]
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I've created the database using this sentence:
&lt;br&gt;&amp;gt; CREATE DATABASE sbs
&lt;br&gt;&amp;gt; &amp;nbsp; WITH OWNER = sbsadmin
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ENCODING = 'UTF8'
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LC_COLLATE = 'Spanish_Peru.1252'
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LC_CTYPE = 'Spanish_Peru.1252'
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CONNECTION LIMIT = -1;
&lt;/div&gt;&lt;/div&gt;Hola Jorge,
&lt;br&gt;&lt;br&gt;I suspect it's the LC_COLLATE and LC_CTYPE that you have there. I don't
&lt;br&gt;*know* this, but they *look* like they are some weird sort of
&lt;br&gt;collation/ctype based on the misguided Windows-1252 encoding. &amp;nbsp;Sadly,
&lt;br&gt;Windows provides data in this encoding into web forms where the accept
&lt;br&gt;charset is supposedly only ISO-8859.
&lt;br&gt;&lt;br&gt;In Windows-1252 the Euro currency symbol is somewhere in the 0x80 - 0x9f
&lt;br&gt;range - possibly it is 0x80, in fact.
&lt;br&gt;&lt;br&gt;I think you would be better to use a consistent locale like es_PE.UTF-8
&lt;br&gt;though if your data is 1252 encoded then you might need to iconv it
&lt;br&gt;first.
&lt;br&gt;&lt;br&gt;If you have data which is a mix of ISO-8859-1, Windows-1252 and UTF-8
&lt;br&gt;then I can point you at a wee bit of PHP code I wrote which will look at
&lt;br&gt;each character in a string and only iconv from 8859/1252 -&amp;gt; UTF-8 if it
&lt;br&gt;is a high-bit byte which is not part of a valid UTF-8 character already.
&lt;br&gt;&lt;br&gt;The code is here:
&lt;br&gt;&lt;br&gt;&amp;nbsp;&lt;a href=&quot;http://repo.or.cz/w/awl.git/blob/HEAD:/inc/AWLUtilities.php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://repo.or.cz/w/awl.git/blob/HEAD:/inc/AWLUtilities.php&lt;/a&gt;&lt;br&gt;&lt;br&gt;You need both of the last two functions - call the first one during
&lt;br&gt;initialisation, and use the second one to clean the strings.
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Andrew McMillan.
&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------
&lt;br&gt;andrew (AT) morphoss (DOT) com &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+64(272)DEBIAN
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; You will feel hungry again in another hour.
&lt;br&gt;------------------------------------------------------------------------
&lt;br&gt;&lt;br&gt;&lt;br /&gt; &lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;signature.asc&lt;/strong&gt; (205 bytes) &lt;a href=&quot;http://old.nabble.com/attachment/26623284/0/signature.asc&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-with-utf8-encoding-tp26621813p26623284.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26621813</id>
	<title>Problem with utf8 encoding</title>
	<published>2009-12-02T23:00:16Z</published>
	<updated>2009-12-02T23:00:16Z</updated>
	<author>
		<name>Jorge Miranda Castañeda</name>
	</author>
	<content type="html">&lt;div&gt;Hello everyone!&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;m working in a project using postgres, propel, and php.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;My development environment is:&lt;/div&gt;&lt;div&gt;SO: Windows vista Business SP2&lt;/div&gt;&lt;div&gt;Postgres: Postgres v8.4&lt;/div&gt;
&lt;div&gt;Propel: Propel generator/runtime v1.4&lt;/div&gt;&lt;div&gt;PHP: PHP v5.3&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Currently I&amp;#39;m struggling with a problem caused by the encoding. Everytime I try to insert a row into the table CURRENCY, which has ID, DESC, and SYMBOL as its columns, I get the following error:&lt;/div&gt;
&lt;div&gt;Unable to execute INSERT statement. [wrapped: SQLSTATE[22021]: Character not in repertoire: 7 ERROR: invalid byte sequence for encoding &amp;quot;UTF8&amp;quot;: 0x80 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by &amp;quot;client_encoding&amp;quot;.]&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;ve created the database using this sentence:&lt;/div&gt;&lt;div&gt;&lt;i&gt;CREATE DATABASE sbs&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;  WITH OWNER = sbsadmin&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;       ENCODING = &amp;#39;UTF8&amp;#39;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;       LC_COLLATE = &amp;#39;Spanish_Peru.1252&amp;#39;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;       LC_CTYPE = &amp;#39;Spanish_Peru.1252&amp;#39;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;       CONNECTION LIMIT = -1;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;When I run the following commands in psql I get this:&lt;/div&gt;&lt;div&gt;&lt;i&gt;sbs=#SHOW SERVER_ENCODING;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;server_encoding&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;---------------&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;UTF8&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;(1 fila)&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;sbs=#SHOW CLIENT_ENCODING;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;client_encoding&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;---------------&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;UTF8&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;(1 fila)&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;The generated file by propel that manages the database connection sets the charset to utf8 too. The insertion fails only everytime I try to insert the currency symbols such as €, ¥, £, ₱, etc. I have no problem with symbols such S/., $, p., Q, L or any other non-special symbol. The curious thing is that when I run the sentence INSERT INTO CURRENCY VALUES(3,&amp;#39;EURO&amp;#39;,&amp;#39;€&amp;#39;); using the query tool of pgAdminIII, I got no error and the query was sucessfully executed. However running the same sentence in psql, I got the row inserted but with ? instead of € as the currency symbol.&lt;/div&gt;
&lt;div&gt;I think the utf8 is the apropiate charset to represent these symbols but I have no idea why I&amp;#39;m getting this problem. I&amp;#39;ve spent the whole day struggling with this problem and I can&amp;#39;t figure it out yet. I have tried many things, none of them worked. So this is why I&amp;#39;m here asking for your help, as my last resource. Any guidance that could put me in the right direction to address this problem will be really appreciated!&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thanks in advance and I&amp;#39;m sorry If I went on a bit long...&lt;/div&gt;&lt;br&gt;-- &lt;br&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(136, 136, 136); &quot;&gt;Jorge Miranda Castañeda.&lt;/span&gt;&lt;br&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(136, 136, 136); &quot;&gt;Simbiosys Software S.A.C.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#888888&quot; face=&quot;arial, sans-serif&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;&lt;a href=&quot;http://www.simbiosysonline.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;www.simbiosysonline.com&lt;/a&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;
&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-with-utf8-encoding-tp26621813p26621813.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26482670</id>
	<title>Re: Use of pg_escape_string()</title>
	<published>2009-11-23T09:31:24Z</published>
	<updated>2009-11-23T09:31:24Z</updated>
	<author>
		<name>Eric Chamberlain-4</name>
	</author>
	<content type="html">Adding an extra apostrophe is one of the ways you can escape another apostrophe with Postgre. &amp;nbsp;I believe Postgre can use an extra apostrophe or a backslash... and the API call you're using just happens to elect using the extra apostrophe over the backslash. &amp;nbsp;If you look at the data inserted into the database is there only one apostrophe in your data? &amp;nbsp;If so, that's what it is. &amp;nbsp;If there's two it could be as the previous poster said and magic quotes is enabled.
&lt;br&gt;&lt;br&gt;Eric Chamberlain
&lt;br&gt;&lt;br&gt;On Nov 22, 2009, at 11:44 AM, Raymond O'Donnell wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On 22/11/2009 19:22, Sylvain Racine wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I use to hear about to escape every variables who come from user in PHP.
&lt;br&gt;&amp;gt;&amp;gt; Most programmers around me use MySQL with mysql_escape_string(). Because
&lt;br&gt;&amp;gt;&amp;gt; I program with PostgreSQL, I take advantage to use pg_escape_string().
&lt;br&gt;&amp;gt;&amp;gt; Everything goes well, up I entered data with apostrophe(').
&lt;br&gt;&amp;gt;&amp;gt; pg_escape_string() escapes my apostrophe with another apostrophe ('').
&lt;br&gt;&amp;gt;&amp;gt; My data are well store in database. No error... except that appears a
&lt;br&gt;&amp;gt;&amp;gt; double apostrophe. This is not what I want.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Maybe something is wrong in my program. Here is a sample of what I use
&lt;br&gt;&amp;gt;&amp;gt; to store data in table &amp;quot;personnes&amp;quot; which have two columns: firstname,
&lt;br&gt;&amp;gt;&amp;gt; lastname. I remove database connection and construction of objects
&lt;br&gt;&amp;gt;&amp;gt; Minute and Personnes.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Where is the INSERTed data coming from? - Is it coming from data
&lt;br&gt;&amp;gt; submitted by GET or POST? - if so, is magic_quotes_gpc turned on? If it
&lt;br&gt;&amp;gt; is, this could explain what you're seeing.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; BTW, it's much better to use parametrised queries - look up
&lt;br&gt;&amp;gt; pg_query_params in the PHP docs. This looks after all quoting for you
&lt;br&gt;&amp;gt; automatically, and prevents SQL injection attacks.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Ray.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Raymond O'Donnell :: Galway :: Ireland
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26482670&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rod@...&lt;/a&gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26482670&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;&amp;gt; To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;Confidentiality Notice: This e-mail may contain proprietary information some of which may be legally privileged. It is for the intended recipient(s) only. If you believe that it has been sent to you in error, please notify the sender by reply e-mail and delete the message. Any disclosure, copying, distribution or use of this information by someone other than the intended recipient(s) is prohibited and may be unlawful.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26482670&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Use-of-pg_escape_string%28%29-tp26468546p26482670.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26468735</id>
	<title>Re: Use of pg_escape_string()</title>
	<published>2009-11-22T11:44:48Z</published>
	<updated>2009-11-22T11:44:48Z</updated>
	<author>
		<name>Raymond O'Donnell</name>
	</author>
	<content type="html">On 22/11/2009 19:22, Sylvain Racine wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I use to hear about to escape every variables who come from user in PHP.
&lt;br&gt;&amp;gt; Most programmers around me use MySQL with mysql_escape_string(). Because
&lt;br&gt;&amp;gt; I program with PostgreSQL, I take advantage to use pg_escape_string().
&lt;br&gt;&amp;gt; Everything goes well, up I entered data with apostrophe(').
&lt;br&gt;&amp;gt; pg_escape_string() escapes my apostrophe with another apostrophe ('').
&lt;br&gt;&amp;gt; My data are well store in database. No error... except that appears a
&lt;br&gt;&amp;gt; double apostrophe. This is not what I want.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Maybe something is wrong in my program. Here is a sample of what I use
&lt;br&gt;&amp;gt; to store data in table &amp;quot;personnes&amp;quot; which have two columns: firstname,
&lt;br&gt;&amp;gt; lastname. I remove database connection and construction of objects
&lt;br&gt;&amp;gt; Minute and Personnes.
&lt;/div&gt;&lt;br&gt;Where is the INSERTed data coming from? - Is it coming from data
&lt;br&gt;submitted by GET or POST? - if so, is magic_quotes_gpc turned on? If it
&lt;br&gt;is, this could explain what you're seeing.
&lt;br&gt;&lt;br&gt;BTW, it's much better to use parametrised queries - look up
&lt;br&gt;pg_query_params in the PHP docs. This looks after all quoting for you
&lt;br&gt;automatically, and prevents SQL injection attacks.
&lt;br&gt;&lt;br&gt;Ray.
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Raymond O'Donnell :: Galway :: Ireland
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26468735&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rod@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26468735&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Use-of-pg_escape_string%28%29-tp26468546p26468735.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26468546</id>
	<title>Use of pg_escape_string()</title>
	<published>2009-11-22T11:22:07Z</published>
	<updated>2009-11-22T11:22:07Z</updated>
	<author>
		<name>Sylvain Racine-2</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;I use to hear about to escape every variables who come from user in PHP. 
&lt;br&gt;Most programmers around me use MySQL with mysql_escape_string(). Because 
&lt;br&gt;I program with PostgreSQL, I take advantage to use pg_escape_string(). 
&lt;br&gt;Everything goes well, up I entered data with apostrophe('). 
&lt;br&gt;pg_escape_string() escapes my apostrophe with another apostrophe (''). 
&lt;br&gt;My data are well store in database. No error... except that appears a 
&lt;br&gt;double apostrophe. This is not what I want.
&lt;br&gt;&lt;br&gt;Maybe something is wrong in my program. Here is a sample of what I use 
&lt;br&gt;to store data in table &amp;quot;personnes&amp;quot; which have two columns: firstname, 
&lt;br&gt;lastname. I remove database connection and construction of objects 
&lt;br&gt;Minute and Personnes.
&lt;br&gt;&lt;br&gt;Ex: Nathalie Prud'homme gives Nathalie Prud''homme...
&lt;br&gt;&lt;br&gt;$minute-&amp;gt;personnes-&amp;gt;firstname = $_POST[&amp;quot;firstname&amp;quot;];
&lt;br&gt;$minute-&amp;gt;personnes-&amp;gt;lastname = $_POST[&amp;quot;lastname&amp;quot;];
&lt;br&gt;$fields = array(&amp;quot;firstname&amp;quot;,&amp;quot;lastname&amp;quot;);
&lt;br&gt;&lt;br&gt;$query = 
&lt;br&gt;$GLOBALS['phpag']-&amp;gt;db-&amp;gt;record('personnes',$fields,$minute-&amp;gt;personnes);
&lt;br&gt;if (!$GLOBALS['phpag']-&amp;gt;db-&amp;gt;query($query))
&lt;br&gt;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; echo $GLOBALS['phpag']-&amp;gt;db-&amp;gt;error;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;class db
&lt;br&gt;&lt;br&gt;{
&lt;br&gt;function query($query, $offset=0, $num_rows=-1)
&lt;br&gt;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (!$this-&amp;gt;link_ID)
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $this-&amp;gt;error .= '&amp;lt;div style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;Can't connect to 
&lt;br&gt;database.&amp;lt;/div&amp;gt;';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return FALSE;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $this-&amp;gt;record = array();
&lt;br&gt;&amp;nbsp; &amp;nbsp; $this-&amp;gt;count = 0;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; if (!$num_rows &amp;&amp; $this-&amp;gt;debug)
&lt;br&gt;&amp;nbsp; &amp;nbsp; { 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print 'number of lines limit = &amp;nbsp;
&lt;br&gt;'.$GLOBALS['phpag_info']['preferences']['phpag']['lines'];
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $num_rows = $GLOBALS['phpag_info']['preferences']['phpag']['lines'];
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; if ($num_rows &amp;gt; 0)
&lt;br&gt;&amp;nbsp; &amp;nbsp; { &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $query .= ' LIMIT '.$num_rows.' OFFSET '.$offset;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ($this-&amp;gt;debug) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print '&amp;lt;div&amp;gt;Query: '.$query.'&amp;lt;/div&amp;gt;';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $this-&amp;gt;query_ID = pg_query($this-&amp;gt;link_ID, $query);
&lt;br&gt;&amp;nbsp; &amp;nbsp; } else
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ($this-&amp;gt;debug) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print '&amp;lt;div&amp;gt;Query: '.$query.'&amp;lt;/div&amp;gt;';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $this-&amp;gt;query_ID = pg_query($this-&amp;gt;link_ID, $query);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (!$this-&amp;gt;query_ID)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $this-&amp;gt;err = pg_last_error($this-&amp;gt;link_ID);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $this-&amp;gt;error .= '&amp;lt;div style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;Error in query sent 
&lt;br&gt;to database&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;'.$this-&amp;gt;err.&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;\n&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $this-&amp;gt;error .= &amp;quot;&amp;lt;u&amp;gt;Invalid SQL query:&amp;lt;/u&amp;gt;: 
&lt;br&gt;&amp;lt;blockquote&amp;gt;$query&amp;lt;/blockquote&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return FALSE;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ($i = 0; $i &amp;lt; pg_numrows($this-&amp;gt;query_ID); $i++)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $this-&amp;gt;record[$i] = pg_fetch_array($this-&amp;gt;query_ID,$i);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ($this-&amp;gt;debug)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo 'Record #'.$i.' ';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print_r($this-&amp;gt;record[$i]);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print &amp;quot;&amp;lt;br&amp;gt;&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Calculate how many records
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $this-&amp;gt;count = ($this-&amp;gt;record ? count($this-&amp;gt;record): 0);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return $this-&amp;gt;query_ID;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;// Escape string if necessary
&lt;br&gt;function slash ($text)
&lt;br&gt;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; $text = pg_escape_string($text);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return $text;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function record($table,$fields,$values)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (class_exists(get_class($values)))
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $values=get_object_vars($values);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $query = 'INSERT INTO '.$table.'(';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (empty($champs)) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$arg['type'] = 'php';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$arg['message'] = '&amp;lt;div 
&lt;br&gt;style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;SQL Error: You try to insert values in table 
&lt;br&gt;without declare column name!&amp;lt;/div&amp;gt;';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Error::thrown($arg,FALSE,TRUE);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foreach ($fields as $num =&amp;gt;$col) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $query .= ($num ? ',': '').$col;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $query .= ') VALUES (';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (empty($values)) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $arg['type'] = 'php';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $arg['message'] = '&amp;lt;div 
&lt;br&gt;style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;SQL &amp;nbsp;Error: You try to insert data in table 
&lt;br&gt;without giving values!&amp;lt;/div&amp;gt;';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Error::thrown($arg,FALSE,TRUE);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $valueClause = '';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $id = 0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foreach ($values as $num =&amp;gt; $col) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; preg_match('/^id/',$num,$match);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!empty($match[0])) $id += 1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (empty($match[0])) { // Remove column beginning 
&lt;br&gt;with 'id...'
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $valueClause .= ($valueClause ? ',' : 
&lt;br&gt;'').'\''.$this-&amp;gt;slash($col).'\'';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (count($fields) != (count($fields) - $id)) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $arg['type'] = 'php';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $arg['message'] = '&amp;lt;div 
&lt;br&gt;style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;SQL Error: The number of columns mismatches with 
&lt;br&gt;the number of values!&amp;lt;/div&amp;gt;';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Error::thrown($arg,FALSE,TRUE);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $query .= $valueClause.');';
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return $query;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&lt;br&gt;Anybody have an idea?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26468546&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Use-of-pg_escape_string%28%29-tp26468546p26468546.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25989072</id>
	<title>Re: [GENERAL] PostgreSQL driver for Joomla review</title>
	<published>2009-10-21T02:17:59Z</published>
	<updated>2009-10-21T02:17:59Z</updated>
	<author>
		<name>Thom Brown</name>
	</author>
	<content type="html">2009/10/21 Csaba Nagy &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25989072&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nagy@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi Thom,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Sorry for the delay, I got sick in the meantime. I see that others
&lt;br&gt;&amp;gt; already did some review, I will do a quick one too, later maybe I'll
&lt;br&gt;&amp;gt; actually try it out... so after a quick review:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; * on line 218, the &amp;quot; ENCODING '$DBname')&amp;quot; part feels wrong, you probably
&lt;br&gt;&amp;gt; want hardcoded UTF8 encoding there ?
&lt;br&gt;&amp;gt; * as Merlin already commented, transactions are always safe in postgres,
&lt;br&gt;&amp;gt; this is no mysql ;-)
&lt;br&gt;&amp;gt; * again, as Merlin commented, getTableList is getting the data bases,
&lt;br&gt;&amp;gt; which doesn't make sense, but maybe you actually wanted to get the
&lt;br&gt;&amp;gt; tables - in this case you don't have a typo but you need to change the
&lt;br&gt;&amp;gt; query ;-)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; If I'll get some time I'll test it too, but likely not this week...
&lt;/div&gt;&lt;br&gt;Thanks for the feedback Csaba,
&lt;br&gt;&lt;br&gt;Yes, I will change the function which uses transactions, and also
&lt;br&gt;replace any conditional UTF8 statements with hard-coded ones.
&lt;br&gt;&lt;br&gt;The getTableList function...erm... not sure what I was thinking there.
&lt;br&gt;&amp;nbsp;How about:
&lt;br&gt;&lt;br&gt;select tablename from pg_tables where schemaname='public';
&lt;br&gt;&lt;br&gt;As for testing it, you won't be able to with the existing Joomla code
&lt;br&gt;base as most of the queries will fail as they've been terribly
&lt;br&gt;written, and that's because MySQL lets you get away with it for some
&lt;br&gt;reason. &amp;nbsp;I imagine the only way to test it is to either get a copy of
&lt;br&gt;modified Joomla from me (although it still needs work), or create a
&lt;br&gt;test app which uses that class, but you will need the parent JDatabase
&lt;br&gt;class from Joomla too... and not sure how deep that rabbit hole goes
&lt;br&gt;as that will also in turn inherit from another class.
&lt;br&gt;&lt;br&gt;Thanks again.
&lt;br&gt;&lt;br&gt;Thom
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25989072&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL-driver-for-Joomla-review-tp25973881p25989072.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25980637</id>
	<title>Re: [GENERAL] PostgreSQL driver for Joomla review</title>
	<published>2009-10-20T12:00:19Z</published>
	<updated>2009-10-20T12:00:19Z</updated>
	<author>
		<name>Thom Brown</name>
	</author>
	<content type="html">2009/10/20 Alban Hertroys &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25980637&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dalroi@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt; You miss a keyword in your query in renameTable; it should be &amp;quot; RENAME TO &amp;quot;,
&lt;br&gt;&amp;gt; not &amp;quot; TO &amp;quot;.
&lt;br&gt;&lt;br&gt;Thanks for spotting that. &amp;nbsp;I've made my amendments for next submit.
&lt;br&gt;&lt;br&gt;&amp;gt; Wouldn't it be convenient to have an EXPLAIN ANALYSE version of explain()?
&lt;br&gt;&amp;gt; Maybe with a boolean parameter?
&lt;br&gt;&lt;br&gt;The problem is, I don't see where they're using this function, so if
&lt;br&gt;they're using it to EXPLAIN an INSERT, UPDATE or DELETE statement,
&lt;br&gt;ANALYZE would execute it... unless I roll it back straight after.
&lt;br&gt;&lt;br&gt;&amp;gt; In insertObject() you have a query &amp;quot;SELECT $keyName AS 'id' FROM $table'&amp;quot; -
&lt;br&gt;&amp;gt; That line contains two syntax errors: 'id' (You probably meant &amp;quot;id&amp;quot;) and
&lt;br&gt;&amp;gt; $table' (spurious trailing quote).
&lt;br&gt;&lt;br&gt;Again, you're right and well spotted. :) &amp;nbsp;Fixed both of those.
&lt;br&gt;&lt;br&gt;Cheers for helping out Alban! :D
&lt;br&gt;&lt;br&gt;Thom
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25980637&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL-driver-for-Joomla-review-tp25973881p25980637.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25975669</id>
	<title>Re: [GENERAL] PostgreSQL driver for Joomla review</title>
	<published>2009-10-20T07:02:18Z</published>
	<updated>2009-10-20T07:02:18Z</updated>
	<author>
		<name>Thom Brown</name>
	</author>
	<content type="html">2009/10/20 Merlin Moncure &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25975669&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mmoncure@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Tue, Oct 20, 2009 at 8:02 AM, Thom Brown &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25975669&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;thombrown@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; If anyone has a moment, could they review the PostgreSQL driver I
&lt;br&gt;&amp;gt;&amp;gt; wrote for Joomla's next major release?  The developers at Joomla have
&lt;br&gt;&amp;gt;&amp;gt; listened to the persistent noise created about only having MySQL as an
&lt;br&gt;&amp;gt;&amp;gt; option and are now accepting submissions for alternative database
&lt;br&gt;&amp;gt;&amp;gt; systems. (see &lt;a href=&quot;http://groups.google.com/group/joomla-dev-cms/browse_thread/thread/1382dc6f4af56278#msg_9b95648941ef6fa7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.google.com/group/joomla-dev-cms/browse_thread/thread/1382dc6f4af56278#msg_9b95648941ef6fa7&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt; for this development)
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; My submission can be found at:
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=18384&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=18384&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Things to watch out for a version-dependent features and clumsy implementations.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; *) why bother with the version check in queryBatch?  why not just do
&lt;br&gt;&amp;gt; begin-&amp;gt;commit always?
&lt;/div&gt;&lt;br&gt;To be honest, I hadn't touched that function. &amp;nbsp;That's entirely
&lt;br&gt;inherited from the MySQL one, but you're right, for Postgres there's
&lt;br&gt;no need to check the version.
&lt;br&gt;&lt;br&gt;&amp;gt; *) no ability to delete?
&lt;br&gt;&lt;br&gt;The driver has to match that of the MySQL one in Joomla, so I couldn't
&lt;br&gt;implement functionality which wouldn't be used by every driver. &amp;nbsp;The
&lt;br&gt;only thing I added which differed was a concatentation operator which
&lt;br&gt;I put in for future implementation as I believe it will be necessary
&lt;br&gt;if they're going to adapt the existing codebase to support multiple
&lt;br&gt;database systems.
&lt;br&gt;&lt;br&gt;&amp;gt; *) looks like typo on line 713
&lt;br&gt;&lt;br&gt;Yes, that's just left over from me quickly trying to tidy up my
&lt;br&gt;comments as I couldn't get the proper version from the site. &amp;nbsp;Please
&lt;br&gt;ignore it as it isn't in my actual submission.
&lt;br&gt;&lt;br&gt;Thanks Merlin!
&lt;br&gt;&lt;br&gt;Thom
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25975669&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL-driver-for-Joomla-review-tp25973881p25975669.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25975127</id>
	<title>Re: [GENERAL] PostgreSQL driver for Joomla review</title>
	<published>2009-10-20T06:28:58Z</published>
	<updated>2009-10-20T06:28:58Z</updated>
	<author>
		<name>Thom Brown</name>
	</author>
	<content type="html">2009/10/20 Reid Thompson &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25975127&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;reid.thompson@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; your attachment contains this...
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;iso-8859-1&amp;quot;?&amp;gt;
&lt;br&gt;&amp;gt; &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot;
&lt;br&gt;&amp;gt;         &amp;quot;&lt;a href=&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&lt;/a&gt;&amp;quot;&amp;gt;
&lt;br&gt;&amp;gt; &amp;lt;html xmlns=&amp;quot;&lt;a href=&quot;http://www.w3.org/1999/xhtml&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.w3.org/1999/xhtml&lt;/a&gt;&amp;quot; xml:lang=&amp;quot;en&amp;quot; lang=&amp;quot;en&amp;quot;&amp;gt;
&lt;br&gt;&amp;gt;  &amp;lt;head&amp;gt;
&lt;br&gt;&amp;gt;  &amp;lt;title&amp;gt;403 - Forbidden&amp;lt;/title&amp;gt;
&lt;br&gt;&amp;gt;  &amp;lt;/head&amp;gt;
&lt;br&gt;&amp;gt;  &amp;lt;body&amp;gt;
&lt;br&gt;&amp;gt;  &amp;lt;h1&amp;gt;403 - Forbidden&amp;lt;/h1&amp;gt;
&lt;br&gt;&amp;gt;  &amp;lt;/body&amp;gt;
&lt;br&gt;&amp;gt; &amp;lt;/html&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;/div&gt;Erk.. that's weird. &amp;nbsp;I got that too even after being logged in. &amp;nbsp;I'm
&lt;br&gt;not sure how anyone can review it if no-one has access to it.
&lt;br&gt;&lt;br&gt;I've attached my working version which differs only slightly to
&lt;br&gt;conform with coding-styles required by Joomla.
&lt;br&gt;&lt;br&gt;Apologies
&lt;br&gt;&lt;br&gt;Thom
&lt;br&gt;&lt;br /&gt; &lt;br /&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25975127&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;postgresql.php&lt;/strong&gt; (23K) &lt;a href=&quot;http://old.nabble.com/attachment/25975127/0/postgresql.php&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL-driver-for-Joomla-review-tp25973881p25975127.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25974667</id>
	<title>Re: [GENERAL] PostgreSQL driver for Joomla review</title>
	<published>2009-10-20T06:00:17Z</published>
	<updated>2009-10-20T06:00:17Z</updated>
	<author>
		<name>Thom Brown</name>
	</author>
	<content type="html">2009/10/20 Csaba Nagy &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25974667&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nagy@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi Thom,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I would like to review it, but I get &amp;quot;403 - Forbidden&amp;quot; when clicking:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://downloads.joomlacode.org/trackeritem/4/5/0/45041/postgresql.php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://downloads.joomlacode.org/trackeritem/4/5/0/45041/postgresql.php&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Not sure what that means, probably I need some kind of login to the
&lt;br&gt;&amp;gt; joomla tracker system, and I don't have one, and I would prefer not to
&lt;br&gt;&amp;gt; create one... is it possible to access that somehow without full access
&lt;br&gt;&amp;gt; to the joomla tracker ?
&lt;/div&gt;&lt;/div&gt;Hi Csaba,
&lt;br&gt;&lt;br&gt;I didn't realise it wasn't publicly viewable. &amp;nbsp;I've attached a copy of
&lt;br&gt;the php file anyhow. &amp;nbsp;Can you see the tracker page at all?
&lt;br&gt;&lt;br&gt;Thom
&lt;br&gt;&lt;br /&gt; &lt;br /&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25974667&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;postgresql.php&lt;/strong&gt; (476 bytes) &lt;a href=&quot;http://old.nabble.com/attachment/25974667/0/postgresql.php&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL-driver-for-Joomla-review-tp25973881p25974667.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25973881</id>
	<title>PostgreSQL driver for Joomla review</title>
	<published>2009-10-20T05:02:47Z</published>
	<updated>2009-10-20T05:02:47Z</updated>
	<author>
		<name>Thom Brown</name>
	</author>
	<content type="html">If anyone has a moment, could they review the PostgreSQL driver I
&lt;br&gt;wrote for Joomla's next major release? &amp;nbsp;The developers at Joomla have
&lt;br&gt;listened to the persistent noise created about only having MySQL as an
&lt;br&gt;option and are now accepting submissions for alternative database
&lt;br&gt;systems. (see &lt;a href=&quot;http://groups.google.com/group/joomla-dev-cms/browse_thread/thread/1382dc6f4af56278#msg_9b95648941ef6fa7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.google.com/group/joomla-dev-cms/browse_thread/thread/1382dc6f4af56278#msg_9b95648941ef6fa7&lt;/a&gt;&lt;br&gt;for this development)
&lt;br&gt;&lt;br&gt;My submission can be found at:
&lt;br&gt;&lt;a href=&quot;http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=18384&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=18384&lt;/a&gt;&lt;br&gt;&lt;br&gt;Things to watch out for a version-dependent features and clumsy implementations.
&lt;br&gt;&lt;br&gt;Thanks
&lt;br&gt;&lt;br&gt;Thom Brown
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25973881&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL-driver-for-Joomla-review-tp25973881p25973881.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25863219</id>
	<title>Re: PHP suddenly not recognising pg_connect</title>
	<published>2009-10-12T14:03:15Z</published>
	<updated>2009-10-12T14:03:15Z</updated>
	<author>
		<name>Thom Brown</name>
	</author>
	<content type="html">Okay, ignore me.  It appears that the ini files hadn&amp;#39;t been updated, although looking at the merge, I don&amp;#39;t see exactly how that helped.&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;It&amp;#39;s working now anyway.  Postgres and MySQL are both showing in phpinfo() now.&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thom&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;2009/10/12 Thom Brown &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25863219&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;thombrown@...&lt;/a&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;

I restarted apache today and suddenly a site I managed stopped working.  It seems php no longer recognises the pg_connect command.  I&amp;#39;m running PostgreSQL 8.4.1 and PHP 5.2.11 on Gentoo.  I recompiled PHP just in case I&amp;#39;d upgraded PostgreSQL before without recompiling PHP with it, but no luck.  I&amp;#39;ve checked what gentoo says I&amp;#39;ve got installed, and it says that it used postgres as one of the includes with dev-lang/php.&lt;div&gt;


&lt;br&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;ve also noticed PHP has also dropped MySQL support.  Doing a phpinfo() check, I&amp;#39;ve got --with-pgsql=shared showing and also mysql=shared,/usr&amp;#39; &amp;#39;--with-mysql-sock=/var/run/mysqld/mysqld.sock&amp;#39; &amp;#39;--with-mysqli=shared,/usr/bin/mysql_config, but there&amp;#39;s no section for PostgreSQL on the page, or MySQL.&lt;/div&gt;


&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I installed pgbouncer a couple days ago too, but I don&amp;#39;t expect that&amp;#39;s got anything to do with this.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;What&amp;#39;s going on?&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;font color=&quot;#888888&quot;&gt;&lt;div&gt;

Thom&lt;/div&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PHP-suddenly-not-recognising-pg_connect-tp25862853p25863219.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25862853</id>
	<title>PHP suddenly not recognising pg_connect</title>
	<published>2009-10-12T13:38:15Z</published>
	<updated>2009-10-12T13:38:15Z</updated>
	<author>
		<name>Thom Brown</name>
	</author>
	<content type="html">I restarted apache today and suddenly a site I managed stopped working.  It seems php no longer recognises the pg_connect command.  I&amp;#39;m running PostgreSQL 8.4.1 and PHP 5.2.11 on Gentoo.  I recompiled PHP just in case I&amp;#39;d upgraded PostgreSQL before without recompiling PHP with it, but no luck.  I&amp;#39;ve checked what gentoo says I&amp;#39;ve got installed, and it says that it used postgres as one of the includes with dev-lang/php.&lt;div&gt;

&lt;br&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;ve also noticed PHP has also dropped MySQL support.  Doing a phpinfo() check, I&amp;#39;ve got --with-pgsql=shared showing and also mysql=shared,/usr&amp;#39; &amp;#39;--with-mysql-sock=/var/run/mysqld/mysqld.sock&amp;#39; &amp;#39;--with-mysqli=shared,/usr/bin/mysql_config, but there&amp;#39;s no section for PostgreSQL on the page, or MySQL.&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I installed pgbouncer a couple days ago too, but I don&amp;#39;t expect that&amp;#39;s got anything to do with this.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;What&amp;#39;s going on?&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thom&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PHP-suddenly-not-recognising-pg_connect-tp25862853p25862853.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25759873</id>
	<title>Re: checking select query syntax and semantics via php without executing</title>
	<published>2009-10-05T15:06:45Z</published>
	<updated>2009-10-05T15:06:45Z</updated>
	<author>
		<name>Christophe Pettus-2</name>
	</author>
	<content type="html">&lt;br&gt;On Oct 5, 2009, at 3:03 PM, Marco Dieckhoff wrote:
&lt;br&gt;&amp;gt; Must be one of the quickest &amp;quot;case solved, thread closed&amp;quot; I have ever &amp;nbsp;
&lt;br&gt;&amp;gt; seen :)
&lt;br&gt;&lt;br&gt;And you can present the user with the query plan, so they can tell if &amp;nbsp;
&lt;br&gt;they are about to do something horrible to the database. :)
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;-- Christophe Pettus
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25759873&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;xof@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25759873&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/checking-select-query-syntax-and-semantics-via-php-without-executing-tp25759575p25759873.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25759847</id>
	<title>Re: checking select query syntax and semantics via php without executing</title>
	<published>2009-10-05T15:03:36Z</published>
	<updated>2009-10-05T15:03:36Z</updated>
	<author>
		<name>Marco Dieckhoff-2</name>
	</author>
	<content type="html">Bill Moran schrieb:
&lt;br&gt;&amp;gt; In response to Marco Dieckhoff &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25759847&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dieck@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt;&amp;gt; Hi there!
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Is it possible in PHP to give a sql (select) query to Postgres via pg_* 
&lt;br&gt;&amp;gt;&amp;gt; so that it is NOT executed but merely checked for syntax including 
&lt;br&gt;&amp;gt;&amp;gt; correct, existing field and table names, and data types?
&lt;br&gt;&lt;br&gt;&amp;gt; Off the top of my head, you could prefix the query with EXPLAIN, which
&lt;br&gt;&amp;gt; will cause it to be planned (thus checking syntax) and return an
&lt;br&gt;&amp;gt; execution plan, but not actually run the query.
&lt;br&gt;&lt;br&gt;Works as a charm, thanks to both of you.
&lt;br&gt;&lt;br&gt;Must be one of the quickest &amp;quot;case solved, thread closed&amp;quot; I have ever seen :)
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25759847&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/checking-select-query-syntax-and-semantics-via-php-without-executing-tp25759575p25759847.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25759806</id>
	<title>Re: checking select query syntax and semantics via php without executing</title>
	<published>2009-10-05T15:01:39Z</published>
	<updated>2009-10-05T15:01:39Z</updated>
	<author>
		<name>Bill Moran</name>
	</author>
	<content type="html">In response to Marco Dieckhoff &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25759806&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dieck@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Hi there!
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Is it possible in PHP to give a sql (select) query to Postgres via pg_* 
&lt;br&gt;&amp;gt; so that it is NOT executed but merely checked for syntax including 
&lt;br&gt;&amp;gt; correct, existing field and table names, and data types?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I'm working on a system where users may assemble their own query in a 
&lt;br&gt;&amp;gt; construction kit, and want that to be checked, so that they don't e.g. 
&lt;br&gt;&amp;gt; compare UUID &amp;quot;&amp;lt;&amp;quot; datetime or something like this.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; If I try to execute the generated query, bad queries are instantly found 
&lt;br&gt;&amp;gt; by pg_query.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; But good ones are fully executed, which can take a long time depending 
&lt;br&gt;&amp;gt; on joins and aggregations.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; It seems that pg_prepare doesn't return errors on bad queries, 
&lt;br&gt;&amp;gt; pg_last_error() is empty.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The asynchronous pg_send_query (and pg_cancel_query) seem not to return 
&lt;br&gt;&amp;gt; any errors, either.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I tried with three queries:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;quot;SELECT * FROM tableok&amp;quot;
&lt;br&gt;&amp;gt; &amp;quot;SELECT nonexistingfield FROM nonexistingtable&amp;quot;
&lt;br&gt;&amp;gt; &amp;quot;SELECT complete bad / sql query FROM nonsense&amp;quot;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Any ideas?
&lt;/div&gt;&lt;br&gt;Off the top of my head, you could prefix the query with EXPLAIN, which
&lt;br&gt;will cause it to be planned (thus checking syntax) and return an
&lt;br&gt;execution plan, but not actually run the query.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Bill Moran
&lt;br&gt;&lt;a href=&quot;http://www.potentialtech.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.potentialtech.com&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://people.collaborativefusion.com/~wmoran/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://people.collaborativefusion.com/~wmoran/&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25759806&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/checking-select-query-syntax-and-semantics-via-php-without-executing-tp25759575p25759806.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25759642</id>
	<title>Re: checking select query syntax and semantics via php without executing</title>
	<published>2009-10-05T14:50:51Z</published>
	<updated>2009-10-05T14:50:51Z</updated>
	<author>
		<name>Raymond O'Donnell</name>
	</author>
	<content type="html">On 05/10/2009 22:34, Marco Dieckhoff wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Is it possible in PHP to give a sql (select) query to Postgres via pg_*
&lt;br&gt;&amp;gt; so that it is NOT executed but merely checked for syntax including
&lt;br&gt;&amp;gt; correct, existing field and table names, and data types?
&lt;br&gt;&lt;br&gt;How about prepending &amp;quot;explain&amp;quot; to the query? Just a wild notion.
&lt;br&gt;&lt;br&gt;Ray.
&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------
&lt;br&gt;Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25759642&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rod@...&lt;/a&gt;
&lt;br&gt;Galway Cathedral Recitals: &lt;a href=&quot;http://www.galwaycathedral.org/recitals&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.galwaycathedral.org/recitals&lt;/a&gt;&lt;br&gt;------------------------------------------------------------------
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25759642&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/checking-select-query-syntax-and-semantics-via-php-without-executing-tp25759575p25759642.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25759575</id>
	<title>checking select query syntax and semantics via php without executing</title>
	<published>2009-10-05T14:34:32Z</published>
	<updated>2009-10-05T14:34:32Z</updated>
	<author>
		<name>Marco Dieckhoff-2</name>
	</author>
	<content type="html">&lt;br&gt;Hi there!
&lt;br&gt;&lt;br&gt;Is it possible in PHP to give a sql (select) query to Postgres via pg_* 
&lt;br&gt;so that it is NOT executed but merely checked for syntax including 
&lt;br&gt;correct, existing field and table names, and data types?
&lt;br&gt;&lt;br&gt;&lt;br&gt;I'm working on a system where users may assemble their own query in a 
&lt;br&gt;construction kit, and want that to be checked, so that they don't e.g. 
&lt;br&gt;compare UUID &amp;quot;&amp;lt;&amp;quot; datetime or something like this.
&lt;br&gt;&lt;br&gt;&lt;br&gt;If I try to execute the generated query, bad queries are instantly found 
&lt;br&gt;by pg_query.
&lt;br&gt;&lt;br&gt;&lt;br&gt;But good ones are fully executed, which can take a long time depending 
&lt;br&gt;on joins and aggregations.
&lt;br&gt;&lt;br&gt;It seems that pg_prepare doesn't return errors on bad queries, 
&lt;br&gt;pg_last_error() is empty.
&lt;br&gt;&lt;br&gt;The asynchronous pg_send_query (and pg_cancel_query) seem not to return 
&lt;br&gt;any errors, either.
&lt;br&gt;&lt;br&gt;I tried with three queries:
&lt;br&gt;&lt;br&gt;&amp;quot;SELECT * FROM tableok&amp;quot;
&lt;br&gt;&amp;quot;SELECT nonexistingfield FROM nonexistingtable&amp;quot;
&lt;br&gt;&amp;quot;SELECT complete bad / sql query FROM nonsense&amp;quot;
&lt;br&gt;&lt;br&gt;&lt;br&gt;Any ideas?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25759575&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/checking-select-query-syntax-and-semantics-via-php-without-executing-tp25759575p25759575.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25562607</id>
	<title>Re: Error code</title>
	<published>2009-09-22T08:54:27Z</published>
	<updated>2009-09-22T08:54:27Z</updated>
	<author>
		<name>Gustavo Amarilla Santacruz</name>
	</author>
	<content type="html">Thank you, all.&lt;br&gt;&lt;br&gt;I will have all proposals in mind.&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Tue, Sep 22, 2009 at 11:08 AM, Bill Moran &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25562607&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wmoran@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;

&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div class=&quot;im&quot;&gt;In response to Gustavo Amarilla Santacruz &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25562607&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gusamasan@...&lt;/a&gt;&amp;gt;:&lt;br&gt;


&lt;br&gt;
&lt;/div&gt;&lt;div class=&quot;im&quot;&gt;&amp;gt; Thank you, Bill.&lt;br&gt;
&amp;gt; I can not use the numeric error code such as 23505 ( by coding convention );&lt;br&gt;
&amp;gt; I need to do this:&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;That&amp;#39;s fine.  Note, however, that those codes are not numeric.&lt;br&gt;
Also, you&amp;#39;ll be better served putting them in constants, to avoid&lt;br&gt;
bugs where the values are accidentally changed.&lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;h5&quot;&gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ------------------------ CODE&lt;br&gt;
&amp;gt; -----------------------------------------------------------&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; include( &amp;quot;PostgresqlErrorList.php&amp;quot; );&lt;br&gt;
&amp;gt;  .&lt;br&gt;
&amp;gt;  .&lt;br&gt;
&amp;gt;  .&lt;br&gt;
&amp;gt;  if( $errorCode == $UNIQUE_VIOLATION )&lt;br&gt;
&amp;gt;  echo( &amp;quot;message&amp;quot; );&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ------------------------ CODE&lt;br&gt;
&amp;gt; -----------------------------------------------------------&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Here, &amp;quot;PostgresqlErrorList.php&amp;quot; is a file included in  PHP libraries. This&lt;br&gt;
&amp;gt; file would can contain code such as:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;lt;php?&lt;br&gt;
&amp;gt;     $UNIQUE_VIOLATION      = 23505;&lt;br&gt;
&amp;gt;     $DATETIME_FIELD_OVERFLOW  = 22008;&lt;br&gt;
&amp;gt;    .&lt;br&gt;
&amp;gt;    .&lt;br&gt;
&amp;gt;    .&lt;br&gt;
&amp;gt; ?&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Exists this file for in Postgresql-PHP library?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; On Tue, Sep 22, 2009 at 9:38 AM, Bill Moran &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25562607&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wmoran@...&lt;/a&gt;&amp;gt;wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; In response to Gustavo Amarilla Santacruz &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25562607&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gusamasan@...&lt;/a&gt;&amp;gt;:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Thank you, Chris.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Now, I need to do this in PHP:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; -------------------- CODE&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ---------------------------------------------------------------&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; $errorCode = pg_result_error_field($res1, PGSQL_DIAG_SQLSTATE) ;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; if( $errorCode == UNIQUE_VIOLATION )&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; if ( $errorCode == &amp;#39;23505&amp;#39; )&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; --&lt;br&gt;
&amp;gt; &amp;gt; Bill Moran&lt;br&gt;
&amp;gt; &amp;gt; &lt;a href=&quot;http://www.potentialtech.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.potentialtech.com&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt; &lt;a href=&quot;http://people.collaborativefusion.com/%7Ewmoran/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://people.collaborativefusion.com/~wmoran/&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; --&lt;br&gt;
&amp;gt; Gustavo Amarilla&lt;br&gt;
&amp;gt; ISMEB&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;--&lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;h5&quot;&gt;Bill Moran&lt;br&gt;
&lt;a href=&quot;http://www.potentialtech.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.potentialtech.com&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://people.collaborativefusion.com/%7Ewmoran/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://people.collaborativefusion.com/~wmoran/&lt;/a&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Gustavo Amarilla&lt;br&gt;ISMEB&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Error-code-tp25552869p25562607.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25561803</id>
	<title>Re: Error code</title>
	<published>2009-09-22T08:08:35Z</published>
	<updated>2009-09-22T08:08:35Z</updated>
	<author>
		<name>Bill Moran</name>
	</author>
	<content type="html">In response to Gustavo Amarilla Santacruz &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25561803&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gusamasan@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&lt;br&gt;&amp;gt; Thank you, Bill.
&lt;br&gt;&amp;gt; I can not use the numeric error code such as 23505 ( by coding convention );
&lt;br&gt;&amp;gt; I need to do this:
&lt;br&gt;&lt;br&gt;That's fine. &amp;nbsp;Note, however, that those codes are not numeric.
&lt;br&gt;Also, you'll be better served putting them in constants, to avoid
&lt;br&gt;bugs where the values are accidentally changed.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ------------------------ CODE
&lt;br&gt;&amp;gt; -----------------------------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; include( &amp;quot;PostgresqlErrorList.php&amp;quot; );
&lt;br&gt;&amp;gt; &amp;nbsp;.
&lt;br&gt;&amp;gt; &amp;nbsp;.
&lt;br&gt;&amp;gt; &amp;nbsp;.
&lt;br&gt;&amp;gt; &amp;nbsp;if( $errorCode == $UNIQUE_VIOLATION )
&lt;br&gt;&amp;gt; &amp;nbsp;echo( &amp;quot;message&amp;quot; );
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ------------------------ CODE
&lt;br&gt;&amp;gt; -----------------------------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Here, &amp;quot;PostgresqlErrorList.php&amp;quot; is a file included in &amp;nbsp;PHP libraries. This
&lt;br&gt;&amp;gt; file would can contain code such as:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;lt;php?
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; $UNIQUE_VIOLATION &amp;nbsp; &amp;nbsp; &amp;nbsp;= 23505;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; $DATETIME_FIELD_OVERFLOW &amp;nbsp;= 22008;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;.
&lt;br&gt;&amp;gt; ?&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Exists this file for in Postgresql-PHP library?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; On Tue, Sep 22, 2009 at 9:38 AM, Bill Moran &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25561803&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wmoran@...&lt;/a&gt;&amp;gt;wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; In response to Gustavo Amarilla Santacruz &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25561803&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gusamasan@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; Thank you, Chris.
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; Now, I need to do this in PHP:
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; -------------------- CODE
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; ---------------------------------------------------------------
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; $errorCode = pg_result_error_field($res1, PGSQL_DIAG_SQLSTATE) ;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; if( $errorCode == UNIQUE_VIOLATION )
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; if ( $errorCode == '23505' )
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; --
&lt;br&gt;&amp;gt; &amp;gt; Bill Moran
&lt;br&gt;&amp;gt; &amp;gt; &lt;a href=&quot;http://www.potentialtech.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.potentialtech.com&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;gt; &lt;a href=&quot;http://people.collaborativefusion.com/~wmoran/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://people.collaborativefusion.com/~wmoran/&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; Gustavo Amarilla
&lt;br&gt;&amp;gt; ISMEB
&lt;/div&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Bill Moran
&lt;br&gt;&lt;a href=&quot;http://www.potentialtech.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.potentialtech.com&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://people.collaborativefusion.com/~wmoran/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://people.collaborativefusion.com/~wmoran/&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25561803&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Error-code-tp25552869p25561803.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25560899</id>
	<title>Re: Error code</title>
	<published>2009-09-22T07:20:11Z</published>
	<updated>2009-09-22T07:20:11Z</updated>
	<author>
		<name>Gustavo Amarilla Santacruz</name>
	</author>
	<content type="html">Thank you, Bill.&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I can not use the numeric error code such as 23505 ( by coding convention ); I need to do this:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;------------------------ CODE -----------------------------------------------------------&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;include( &amp;quot;PostgresqlErrorList.php&amp;quot; );&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;

&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;.&lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;.&lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;.&lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;if( $errorCode == $UNIQUE_VIOLATION )&lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;		&lt;/font&gt;&lt;/span&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;echo( &amp;quot;message&amp;quot; );&lt;/font&gt;&lt;/div&gt;

&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;------------------------ CODE -----------------------------------------------------------&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Here, &amp;quot;PostgresqlErrorList.php&amp;quot; is a file included in  PHP libraries. This file would can contain code such as:&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;&amp;lt;php?&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;    $UNIQUE_VIOLATION      = 23505;&lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;    $&lt;/font&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; border-collapse: collapse; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;DATETIME_FIELD_OVERFLOW &lt;/font&gt;&lt;/span&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt; = 22008;&lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;   .&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;   .&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;   .&lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;?&amp;gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Exists this file for in Postgresql-PHP library?&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Tue, Sep 22, 2009 at 9:38 AM, Bill Moran &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25560899&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wmoran@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;

&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;In response to Gustavo Amarilla Santacruz &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25560899&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gusamasan@...&lt;/a&gt;&amp;gt;:&lt;br&gt;
&lt;div class=&quot;im&quot;&gt;&lt;br&gt;
&amp;gt; Thank you, Chris.&lt;br&gt;
&amp;gt; Now, I need to do this in PHP:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; -------------------- CODE&lt;br&gt;
&amp;gt; ---------------------------------------------------------------&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; $errorCode = pg_result_error_field($res1, PGSQL_DIAG_SQLSTATE) ;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; if( $errorCode == UNIQUE_VIOLATION )&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;if ( $errorCode == &amp;#39;23505&amp;#39; )&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;
--&lt;br&gt;
Bill Moran&lt;br&gt;
&lt;a href=&quot;http://www.potentialtech.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.potentialtech.com&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://people.collaborativefusion.com/~wmoran/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://people.collaborativefusion.com/~wmoran/&lt;/a&gt;&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Gustavo Amarilla&lt;/div&gt;&lt;div&gt;ISMEB&lt;br&gt;&lt;br&gt;
&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Error-code-tp25552869p25560899.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25560216</id>
	<title>Re: Error code</title>
	<published>2009-09-22T06:38:15Z</published>
	<updated>2009-09-22T06:38:15Z</updated>
	<author>
		<name>Bill Moran</name>
	</author>
	<content type="html">In response to Gustavo Amarilla Santacruz &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25560216&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gusamasan@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&lt;br&gt;&amp;gt; Thank you, Chris.
&lt;br&gt;&amp;gt; Now, I need to do this in PHP:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -------------------- CODE
&lt;br&gt;&amp;gt; ---------------------------------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; $errorCode = pg_result_error_field($res1, PGSQL_DIAG_SQLSTATE) ;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; if( $errorCode == UNIQUE_VIOLATION )
&lt;br&gt;&lt;br&gt;if ( $errorCode == '23505' )
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Bill Moran
&lt;br&gt;&lt;a href=&quot;http://www.potentialtech.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.potentialtech.com&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://people.collaborativefusion.com/~wmoran/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://people.collaborativefusion.com/~wmoran/&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25560216&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Error-code-tp25552869p25560216.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25559871</id>
	<title>Re: Error code</title>
	<published>2009-09-22T06:17:21Z</published>
	<updated>2009-09-22T06:17:21Z</updated>
	<author>
		<name>Gustavo Amarilla Santacruz</name>
	</author>
	<content type="html">Thank you, Chris.&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Now, I need to do this in PHP:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;-------------------- CODE ---------------------------------------------------------------&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;$errorCode = pg_result_error_field($res1, PGSQL_DIAG_SQLSTATE) ;&lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;if( $errorCode == UNIQUE_VIOLATION )&lt;/font&gt;&lt;/div&gt;&lt;div&gt;

&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;   echo( &amp;quot;message 1&amp;quot; );&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;else if( $errorCode == &lt;/font&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;DATETIME_FIELD_OVERFLOW &lt;/font&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;)&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;

&lt;div&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;   echo( &amp;quot;message 2&amp;quot; );&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;-------------------- CODE ---------------------------------------------------------------&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;How I can do it?; how I can compare &lt;font class=&quot;Apple-style-span&quot; face=&quot;&amp;#39;courier new&amp;#39;, monospace&quot;&gt;$errorCode&lt;/font&gt; with a Postgres error name ( as in &lt;a href=&quot;http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html&lt;/a&gt; ).&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thank you, again.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Mon, Sep 21, 2009 at 9:00 PM, Chris &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25559871&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dmagick@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;


&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex&quot;&gt;&lt;div&gt;Gustavo Amarilla Santacruz wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex&quot;&gt;
Hello all.&lt;br&gt;&lt;br&gt;
How I can get the postgres error code from PHP?. I can get the error text, but I need error code to verbose ( and country dependient) messages.&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/div&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.pg-result-error-field.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.php.net/manual/en/function.pg-result-error-field.php&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
seems to be the best fit.&lt;br&gt;&lt;font color=&quot;#888888&quot;&gt;
&lt;br&gt;
-- &lt;br&gt;
Postgresql &amp;amp; php tutorials&lt;br&gt;
&lt;a href=&quot;http://www.designmagick.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.designmagick.com/&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Gustavo Amarilla&lt;br&gt;&lt;br&gt;
&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Error-code-tp25552869p25559871.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25553161</id>
	<title>Re: Error code</title>
	<published>2009-09-21T18:00:45Z</published>
	<updated>2009-09-21T18:00:45Z</updated>
	<author>
		<name>chris smith-9</name>
	</author>
	<content type="html">Gustavo Amarilla Santacruz wrote:
&lt;br&gt;&amp;gt; Hello all.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; How I can get the postgres error code from PHP?. I can get the error 
&lt;br&gt;&amp;gt; text, but I need error code to verbose ( and country dependient) messages.
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.pg-result-error-field.php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.php.net/manual/en/function.pg-result-error-field.php&lt;/a&gt;&lt;br&gt;&lt;br&gt;seems to be the best fit.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Postgresql &amp; php tutorials
&lt;br&gt;&lt;a href=&quot;http://www.designmagick.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.designmagick.com/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25553161&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Error-code-tp25552869p25553161.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25552869</id>
	<title>Error code</title>
	<published>2009-09-21T07:56:17Z</published>
	<updated>2009-09-21T07:56:17Z</updated>
	<author>
		<name>Gustavo Amarilla Santacruz</name>
	</author>
	<content type="html">Hello all.&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;How I can get the postgres error code from PHP?. I can get the error text, but I need error code to verbose ( and country dependient) messages.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thank you, in advance.&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;----------------------- &lt;/div&gt;&lt;div&gt;Gustavo Amarilla&lt;/div&gt;&lt;div&gt;ISMEB: I am Sorry, My English is Bad.&lt;br&gt;&lt;br&gt;
&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Error-code-tp25552869p25552869.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25392306</id>
	<title>Re: pg_connect() error</title>
	<published>2009-09-10T15:51:14Z</published>
	<updated>2009-09-10T15:51:14Z</updated>
	<author>
		<name>chris smith-9</name>
	</author>
	<content type="html">Arun Oakley wrote:
&lt;br&gt;&amp;gt; hi guys,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; we have a postgres db with a hosting company and have been trying to 
&lt;br&gt;&amp;gt; connect to. error is below.
&lt;br&gt;&amp;gt; *Warning*: pg_connect() [function.pg-connect 
&lt;br&gt;&amp;gt; &amp;lt;&lt;a href=&quot;http://hoopsgm.net/test/function.pg-connect&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://hoopsgm.net/test/function.pg-connect&lt;/a&gt;&amp;gt;]: Unable to connect to 
&lt;br&gt;&amp;gt; PostgreSQL server: could not connect to server: Connection refused Is 
&lt;br&gt;&amp;gt; the server running on host &amp;quot;pgdb1.host-ed.net 
&lt;br&gt;&amp;gt; &amp;lt;&lt;a href=&quot;http://pgdb1.host-ed.net&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://pgdb1.host-ed.net&lt;/a&gt;&amp;gt;&amp;quot; and accepting TCP/IP connections on port 3306?
&lt;br&gt;&lt;br&gt;Port 3306 is usually mysql not postgres.
&lt;br&gt;&lt;br&gt;Postgres (by default) uses 5432.
&lt;br&gt;&lt;br&gt;&amp;gt; from my trawling around google i have found that it could be related to 
&lt;br&gt;&amp;gt; the postgres.conf file and turning on tcpip sockets to true?? (i cannot 
&lt;br&gt;&amp;gt; view/edit any postgres conf files)
&lt;br&gt;&lt;br&gt;&amp;gt; oh and those are the host/port details supplied by hosting provider
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; any help would be appreciated in pointing on the right path.
&lt;br&gt;&lt;br&gt;Make sure they know you want a postgres db, not mysql.
&lt;br&gt;&lt;br&gt;Apart from that, if you can't view a postgres.conf file let alone change 
&lt;br&gt;it, you need to raise a support issue with them to fix it.
&lt;br&gt;&lt;br&gt;Do they allow remote connections to their database? Maybe they don't for 
&lt;br&gt;security reasons.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Postgresql &amp; php tutorials
&lt;br&gt;&lt;a href=&quot;http://www.designmagick.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.designmagick.com/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25392306&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/pg_connect%28%29-error-tp25391096p25392306.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25376796</id>
	<title>Web based visual query builder</title>
	<published>2009-09-09T20:48:54Z</published>
	<updated>2009-09-09T20:48:54Z</updated>
	<author>
		<name>Santiago Galindo Hidalgo</name>
	</author>
	<content type="html">&lt;html xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; xmlns:o=&quot;urn:schemas-microsoft-com:office:office&quot; xmlns:w=&quot;urn:schemas-microsoft-com:office:word&quot; xmlns:m=&quot;http://schemas.microsoft.com/office/2004/12/omml&quot; xmlns=&quot;http://www.w3.org/TR/REC-html40&quot;&gt;

&lt;head&gt;
&lt;META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; charset=us-ascii&quot;&gt;
&lt;meta name=Generator content=&quot;Microsoft Word 12 (filtered medium)&quot;&gt;

&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapedefaults v:ext=&quot;edit&quot; spidmax=&quot;1026&quot; /&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapelayout v:ext=&quot;edit&quot;&gt;
  &lt;o:idmap v:ext=&quot;edit&quot; data=&quot;1&quot; /&gt;
 &lt;/o:shapelayout&gt;&lt;/xml&gt;&lt;![endif]--&gt;
&lt;/head&gt;

&lt;body lang=ES-EC link=blue vlink=purple&gt;

&lt;div class=Section1&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US&gt;Hi everyone.. I&amp;#8217;m looking for a web
based visual query builder for postgresql and php do you know about a good tool
to do this?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US&gt;Thanks in advance&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;/body&gt;

&lt;/html&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Web-based-visual-query-builder-tp25376796p25376796.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25391099</id>
	<title>Re: Stored procedures, PDO, and PHP issue</title>
	<published>2009-09-08T22:24:32Z</published>
	<updated>2009-09-08T22:24:32Z</updated>
	<author>
		<name>Ronald D. Willis</name>
	</author>
	<content type="html">Add this as a PDO option
&lt;br&gt;&lt;br&gt;array(PDO::ATTR_ERRMODE =&amp;gt; PDO::ERRMODE_EXCEPTION)
&lt;br&gt;&lt;br&gt;I bet there's a PDOException being thrown and I would NOT be at all 
&lt;br&gt;surprised if it is a HY000 error where PDO is complaining about 
&lt;br&gt;unbuffered queries....
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On 2009-08-19 20:47, Eric Chamberlain wrote:
&lt;br&gt;&amp;nbsp;&amp;gt; Wow, I apologize. The code is exactly like what yours is. In my rush
&lt;br&gt;&amp;nbsp;&amp;gt; I missed the correct code.
&lt;br&gt;&amp;nbsp;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;gt; Eric
&lt;br&gt;&amp;nbsp;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;gt; &amp;gt; &amp;gt;&amp;gt;&amp;gt; $stmt-&amp;gt;bindParam(1, $userId, $hashPass, PDO::PARAM_INT);
&lt;br&gt;&amp;nbsp;&amp;gt; &amp;gt;
&lt;br&gt;&amp;nbsp;&amp;gt; &amp;gt;
&lt;br&gt;&amp;nbsp;&amp;gt; &amp;gt; You should be calling bindParam once for each parameter
&lt;br&gt;&amp;nbsp;&amp;gt; &amp;gt; $stmt-&amp;gt;bindParam(1, $userId, PDO::PARAM_INT);
&lt;br&gt;&amp;nbsp;&amp;gt; &amp;gt; $stmt-&amp;gt;bindParam(2, $hashPass, PDO::PARAM_STR);
&lt;br&gt;&amp;nbsp;&amp;gt; &amp;gt;
&lt;br&gt;&amp;nbsp;&amp;gt; &amp;gt;
&lt;br&gt;&amp;nbsp;&amp;gt; &amp;gt; Nick
&lt;br&gt;&amp;nbsp;&amp;gt; &amp;gt;
&lt;br&gt;&amp;nbsp;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;gt;
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25391099&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Stored-procedures%2C-PDO%2C-and-PHP-issue-tp25051350p25391099.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25328570</id>
	<title>Re: How to select the source ip address for a connection to the database server</title>
	<published>2009-09-07T03:49:42Z</published>
	<updated>2009-09-07T03:49:42Z</updated>
	<author>
		<name>Jasen Betts-5</name>
	</author>
	<content type="html">On 2009-09-06, Dimitris Sakellarios &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25328570&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dimitris.sakellarios@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; That is the way sockets normally work, the primary address is always 
&lt;br&gt;&amp;gt; used for outgoing connections. It can not be changed without some low 
&lt;br&gt;&amp;gt; level programming. It is necessary to bind the socket to the specific IP 
&lt;br&gt;&amp;gt; address before opening the connection. I have done it with Perl, but not 
&lt;br&gt;&amp;gt; PHP.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Bob McConnell
&lt;br&gt;&amp;gt; N2SPP
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;basically what you need to do is take the libpq source extend the
&lt;br&gt;conneection-string facility to include
&lt;br&gt;bind-to-port and bind-to-address parameters which bind the outgoing
&lt;br&gt;connection to the named resources and then recompile it and get it
&lt;br&gt;installed on your server
&lt;br&gt;&lt;br&gt;no changes are likely to be needed to PHP
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25328570&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-to-select-the-source-ip-address-for-a-connection-to-the-database-server-tp25270539p25328570.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25328475</id>
	<title>Re: How to select the source ip address for a connection to the database server</title>
	<published>2009-09-07T03:40:21Z</published>
	<updated>2009-09-07T03:40:21Z</updated>
	<author>
		<name>Jasen Betts-5</name>
	</author>
	<content type="html">On 2009-09-02, &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25328475&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dimitris.sakellarios@...&lt;/a&gt; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25328475&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dimitris.sakellarios@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Hi,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;I am currently=A0working with PHP5+PGSQL 8.2.13 and i have the =20
&lt;br&gt;&amp;gt; following problem to solve and i need your help.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;The server hosting PHP+psql=A0client=A0has 1 physical network =20
&lt;br&gt;&amp;gt; interfaces with multiple=A0subinterfaces using different IPs.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;One of those IP=A0is dedicated to my domain, but it is not servers =20
&lt;br&gt;&amp;gt; default IP address since i share the server.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;So the problem that i need to solve is how am i going to be able to =20
&lt;br&gt;&amp;gt; use-select my domains IP address as source=A0to connect to the remote =20
&lt;br&gt;&amp;gt; databases.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Is there any configuration to settle default source IP the client will us=
&lt;br&gt;&amp;gt; e?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;At the moment all my attempts to connect to the database=A0make use =20
&lt;br&gt;&amp;gt; of=A0servers default interface IP as source.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Thanks in advance for your help.
&lt;/div&gt;&lt;br&gt;easiest way it probably by setting a routing rule, you need
&lt;br&gt;root/adimnistrator to do this.
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25328475&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-to-select-the-source-ip-address-for-a-connection-to-the-database-server-tp25270539p25328475.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25321047</id>
	<title>Re: How to select the source ip address for a connection to the	database server</title>
	<published>2009-09-06T12:35:32Z</published>
	<updated>2009-09-06T12:35:32Z</updated>
	<author>
		<name>Bob McConnell-2</name>
	</author>
	<content type="html">Dimitris Sakellarios wrote:
&lt;br&gt;&amp;gt; Bob hi I would be very interested in giving me some small hint of how you
&lt;br&gt;&amp;gt; did that in PERL so I can start from someplace in PHP.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; BR.
&lt;br&gt;&lt;br&gt;Well, stripping it down to the basics, here is what I used:
&lt;br&gt;&lt;br&gt;-------------8&amp;lt;------------------------------
&lt;br&gt;$port = 23 unless $port;
&lt;br&gt;$them = 'localhost' unless $them;
&lt;br&gt;$AF_INET = 2;
&lt;br&gt;$SOCK_STREAM = 1;
&lt;br&gt;&lt;br&gt;$sockaddr = 'S n a4 x8';
&lt;br&gt;&lt;br&gt;($name,$aliases,$proto) = getprotobyname('tcp');
&lt;br&gt;($name,$aliases,$port) = getservbyname($port,'tcp')
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;unless $port =~ /^\d+$/;;
&lt;br&gt;($name,$aliases,$type,$len,$thisaddr) =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gethostbyname($hostname);
&lt;br&gt;($name,$aliases,$type,$len,$thataddr) = gethostbyname($them);
&lt;br&gt;&lt;br&gt;$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
&lt;br&gt;$that = pack($sockaddr, $AF_INET, $port, $thataddr);
&lt;br&gt;&lt;br&gt;if (socket(S, $AF_INET, $SOCK_STREAM, $proto)) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print &amp;quot;socket ok\n&amp;quot;;
&lt;br&gt;}
&lt;br&gt;else {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;die $!;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;if (bind(S, $this)) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print &amp;quot;bind ok\n&amp;quot;;
&lt;br&gt;}
&lt;br&gt;else {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;die $!;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;if (connect(S,$that)) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print &amp;quot;connect ok\n&amp;quot;;
&lt;br&gt;}
&lt;br&gt;else {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;die $!;
&lt;br&gt;}
&lt;br&gt;-------------8&amp;lt;------------------------------
&lt;br&gt;&lt;br&gt;The key is the variable $thisaddr. Put your server's DNS name or IP 
&lt;br&gt;address as the parameter for the 'gethostbyname($hostname)' call that 
&lt;br&gt;initializes it. That binds the outgoing connection to your IP. In my 
&lt;br&gt;test platform I use &amp;quot;gethostbyname('10.3.1.70')&amp;quot;, which binds it 
&lt;br&gt;directly to one of the three network cards in that computer. The rest is 
&lt;br&gt;pretty normal for a socket definition.
&lt;br&gt;&lt;br&gt;But as I said, this is pretty low level. It doesn't use any of the 
&lt;br&gt;socket libraries or classes most people favor for Perl coding these 
&lt;br&gt;days. If you need more ideas, I located this code again today doing a 
&lt;br&gt;Google search on &amp;quot;Perl socket bind connect&amp;quot;.
&lt;br&gt;&lt;br&gt;Good luck,
&lt;br&gt;&lt;br&gt;Bob McConnell
&lt;br&gt;N2SPP
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25321047&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-to-select-the-source-ip-address-for-a-connection-to-the-database-server-tp25270539p25321047.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25317700</id>
	<title>Re: How to select the source ip address for a connection to the	database server</title>
	<published>2009-09-06T06:13:26Z</published>
	<updated>2009-09-06T06:13:26Z</updated>
	<author>
		<name>dimitris.sakellarios</name>
	</author>
	<content type="html">Bob hi I would be very interested in giving me some small hint of how you
&lt;br&gt;did that in PERL so I can start from someplace in PHP.
&lt;br&gt;&lt;br&gt;BR.
&lt;br&gt;&lt;br&gt;-----Original Message-----
&lt;br&gt;From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25317700&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php-owner@...&lt;/a&gt; [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25317700&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php-owner@...&lt;/a&gt;]
&lt;br&gt;On Behalf Of Bob McConnell
&lt;br&gt;Sent: Sunday, September 06, 2009 3:58 AM
&lt;br&gt;To: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25317700&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dimitris.sakellarios@...&lt;/a&gt;
&lt;br&gt;Cc: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25317700&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;
&lt;br&gt;Subject: Re: [PHP] How to select the source ip address for a connection to
&lt;br&gt;the database server
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25317700&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dimitris.sakellarios@...&lt;/a&gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; I am currently working with PHP5+PGSQL 8.2.13 and i have the following 
&lt;br&gt;&amp;gt; problem to solve and i need your help.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; The server hosting PHP+psql client has 1 physical network interfaces 
&lt;br&gt;&amp;gt; with multiple subinterfaces using different IPs.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; One of those IP is dedicated to my domain, but it is not servers 
&lt;br&gt;&amp;gt; default IP address since i share the server.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; So the problem that i need to solve is how am i going to be able to 
&lt;br&gt;&amp;gt; use-select my domains IP address as source to connect to the remote 
&lt;br&gt;&amp;gt; databases.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; Is there any configuration to settle default source IP the client will 
&lt;br&gt;&amp;gt; use?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; At the moment all my attempts to connect to the database make use 
&lt;br&gt;&amp;gt; of servers default interface IP as source.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; Thanks in advance for your help.
&lt;/div&gt;&lt;br&gt;That is the way sockets normally work, the primary address is always 
&lt;br&gt;used for outgoing connections. It can not be changed without some low 
&lt;br&gt;level programming. It is necessary to bind the socket to the specific IP 
&lt;br&gt;address before opening the connection. I have done it with Perl, but not 
&lt;br&gt;PHP.
&lt;br&gt;&lt;br&gt;Bob McConnell
&lt;br&gt;N2SPP
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25317700&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;&lt;br&gt;__________ Information from ESET NOD32 Antivirus, version of virus signature
&lt;br&gt;database 4398 (20090905) __________
&lt;br&gt;&lt;br&gt;The message was checked by ESET NOD32 Antivirus.
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.eset.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.eset.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;__________ Information from ESET NOD32 Antivirus, version of virus signature
&lt;br&gt;database 4398 (20090905) __________
&lt;br&gt;&lt;br&gt;The message was checked by ESET NOD32 Antivirus.
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.eset.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.eset.com&lt;/a&gt;&lt;br&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25317700&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-to-select-the-source-ip-address-for-a-connection-to-the-database-server-tp25270539p25317700.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25313699</id>
	<title>Re: How to select the source ip address for a connection to the	database server</title>
	<published>2009-09-05T17:57:56Z</published>
	<updated>2009-09-05T17:57:56Z</updated>
	<author>
		<name>Bob McConnell-2</name>
	</author>
	<content type="html">&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25313699&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dimitris.sakellarios@...&lt;/a&gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; I am currently working with PHP5+PGSQL 8.2.13 and i have the following 
&lt;br&gt;&amp;gt; problem to solve and i need your help.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; The server hosting PHP+psql client has 1 physical network interfaces 
&lt;br&gt;&amp;gt; with multiple subinterfaces using different IPs.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; One of those IP is dedicated to my domain, but it is not servers 
&lt;br&gt;&amp;gt; default IP address since i share the server.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; So the problem that i need to solve is how am i going to be able to 
&lt;br&gt;&amp;gt; use-select my domains IP address as source to connect to the remote 
&lt;br&gt;&amp;gt; databases.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; Is there any configuration to settle default source IP the client will 
&lt;br&gt;&amp;gt; use?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; At the moment all my attempts to connect to the database make use 
&lt;br&gt;&amp;gt; of servers default interface IP as source.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; Thanks in advance for your help.
&lt;/div&gt;&lt;br&gt;That is the way sockets normally work, the primary address is always 
&lt;br&gt;used for outgoing connections. It can not be changed without some low 
&lt;br&gt;level programming. It is necessary to bind the socket to the specific IP 
&lt;br&gt;address before opening the connection. I have done it with Perl, but not 
&lt;br&gt;PHP.
&lt;br&gt;&lt;br&gt;Bob McConnell
&lt;br&gt;N2SPP
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25313699&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-to-select-the-source-ip-address-for-a-connection-to-the-database-server-tp25270539p25313699.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25291943</id>
	<title>Re: How to select the source ip address for a connection to the database server</title>
	<published>2009-09-04T03:21:20Z</published>
	<updated>2009-09-04T03:21:20Z</updated>
	<author>
		<name>dimitris.sakellarios</name>
	</author>
	<content type="html">Greg and Anrew thanks for your concern on the issue.
&lt;br&gt;&lt;br&gt;Indeed selecting the source interface - ip would be a great option since for
&lt;br&gt;me (but many other) trying to connect to a secure postgresql server over
&lt;br&gt;internet is must accompanied with username + password + ssl but it is one
&lt;br&gt;more L3 criteria.
&lt;br&gt;&lt;br&gt;And also I feel sure that my application will run whatever the server admin
&lt;br&gt;changes.
&lt;br&gt;&lt;br&gt;Pls let me know if any modification in libpq code could help to bind address
&lt;br&gt;or interface alias temporary.
&lt;br&gt;&lt;br&gt;DS
&lt;br&gt;-----Original Message-----
&lt;br&gt;From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25291943&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gsstark@...&lt;/a&gt; [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25291943&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gsstark@...&lt;/a&gt;] On Behalf Of Greg Stark
&lt;br&gt;Sent: Thursday, September 03, 2009 3:51 PM
&lt;br&gt;To: Andrew McMillan
&lt;br&gt;Cc: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25291943&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dimitris.sakellarios@...&lt;/a&gt;; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25291943&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;
&lt;br&gt;Subject: Re: How to select the source ip address for a connection to the
&lt;br&gt;database server
&lt;br&gt;&lt;br&gt;On Thu, Sep 3, 2009 at 12:31 PM, Andrew McMillan&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25291943&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;andrew@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Nope, unless you're root you're unlikely to be able to choose the source
&lt;br&gt;&amp;gt; address for your connection, and even then it would be tricky.
&lt;br&gt;&lt;br&gt;I don't think you need to be root to select a source address. But
&lt;br&gt;that's not helpful since libpq doesn't support binding to a particular
&lt;br&gt;interface. That would be a useful feature and we should probably add
&lt;br&gt;it to the TODO.
&lt;br&gt;&lt;br&gt;You should note that the source address isn't actually a very secure
&lt;br&gt;way to protect your connections since any other host on that network
&lt;br&gt;could spoof your address.
&lt;br&gt;&lt;br&gt;It sounds like what you're looking for is to control the interface the
&lt;br&gt;packets are routed through. This is separate from the source address
&lt;br&gt;as packets are often routed through multiple hosts along their way.
&lt;br&gt;Routing rules are not something individual applications normally get
&lt;br&gt;involved in. If the connections are being routed through the wrong
&lt;br&gt;interface then you have a global problem, not just with the database
&lt;br&gt;and it requires system-wide configuration changes.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;greg
&lt;br&gt;&lt;a href=&quot;http://mit.edu/~gsstark/resume.pdf&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mit.edu/~gsstark/resume.pdf&lt;/a&gt;&lt;br&gt;&lt;br&gt;__________ Information from ESET NOD32 Antivirus, version of virus signature
&lt;br&gt;database 4393 (20090904) __________
&lt;br&gt;&lt;br&gt;The message was checked by ESET NOD32 Antivirus.
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.eset.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.eset.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;__________ Information from ESET NOD32 Antivirus, version of virus signature
&lt;br&gt;database 4394 (20090904) __________
&lt;br&gt;&lt;br&gt;The message was checked by ESET NOD32 Antivirus.
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.eset.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.eset.com&lt;/a&gt;&lt;br&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-php mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25291943&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-php@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-php&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-to-select-the-source-ip-address-for-a-connection-to-the-database-server-tp25270539p25291943.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25391096</id>
	<title>pg_connect() error</title>
	<published>2009-09-03T21:19:59Z</published>
	<updated>2009-09-03T21:19:59Z</updated>
	<author>
		<name>Arun Oakley</name>
	</author>
	<content type="html">hi guys,&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;we have a postgres db with a hosting company and have been trying to connect to. error is below.&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;; font-size: medium; &quot;&gt;&lt;b&gt;Warning&lt;/b&gt;: pg_connect() [&lt;a href=&quot;http://hoopsgm.net/test/function.pg-connect&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;function.pg-connect&lt;/a&gt;]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host &amp;quot;&lt;a href=&quot;http://pgdb1.host-ed.net&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgdb1.host-ed.net&lt;/a&gt;&amp;quot; and accepting TCP/IP connections on port 3306?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;from my trawling around google i have found that it could be related to the postgres.conf file and turning on tcpip sockets to true?? (i cannot view/edit any postgres conf files)&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;
oh and those are the host/port details supplied by hosting provider&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;any help would be appreciated in pointing on the right path.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Cheers&lt;/div&gt;&lt;div&gt;&lt;br&gt;Arun&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/pg_connect%28%29-error-tp25391096p25391096.html" />
</entry>

</feed>
