473,387 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

pg_get_result() hangs for query length > 65535

I have a script running on PHP v4.3.6 (cgi) that hangs forever
in a call to the Postgres pg_get_result() function when and only
when the query length is 65536 or more bytes.

The query is a simple INSERT, of a single ASCII value into a
'text' type field, and works fine for shorter queries.

(As the code first calls pg_escape_string() on the value to be
inserted, I'm sure the problem doesn't relate to bad characters
in the data.)

Anyone have any ideas? My impression is that few PHP coders use
pg_send_query() and pg_get_result(), despite this being the only
way (AFAIK) of getting specific error codes/text when something
goes wrong (in which event pg_query() just returns false).

The following is an extract from the offending code:

if ($db_type == 'mysql')
{
$qry_id = @mysql_query ($x_qry, $x_db_conn);

$g_db_err_no = mysql_errno ();
$g_db_err_str = mysql_error ();
}

else if ($db_type == 'postgres')
{
# Because pg_query() returns FALSE if the query fails, one must must
# use pg_send_query() and pg_get_result() to get the result handle.
#
# $qry_id = @pg_query ($x_db_conn, $x_qry);
#
if (! pg_send_query ($x_db_conn, $x_qry))
{
die ("pg_send_query");
}
!!!!!!!! QUERY OF LENGTH 64K OR MORE HANGS IN FOLLOWING pg_get_result() CALL
if (! ($qry_id = pg_get_result ($x_db_conn)))
{
die ("pg_get_result");
}

# jr.debug
error_log (" past pg_get_result()!\n", 3, '/tmp/hack.log');

# pg_result_error(), available from PHP v4.2.0+, like pg_result_status(),
# returns a better result then pg_last_error(), as the latter may be set
# by all kinds of internal calls and thus not reflect the app-level error.
#
$g_db_err_no = pg_result_status ($qry_id);
$g_db_err_str = pg_result_error ($qry_id);
}

else if ($db_type == 'mssql')
{

:::

Cheers

John R Ramsden (jo**********@sagitta-ps.cam) <-- com not cam
Nov 23 '05 #1
0 965

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Ramsden | last post by:
I have a script running on PHP v4.3.6 (cgi) that hangs forever in a call to the Postgres pg_get_result() function when and only when the query length is 65536 or more bytes. The query is a...
2
by: Jonathan | last post by:
Hi I'm doing a project for school and wrote an applet that makes a socket connection to a server (smae host as webserver) that was setup for this project. In the applet there are 3 buttons and by...
3
by: Bob | last post by:
I'm currently updating one of our web sites and have encountered a strange problem. The page that is giving me the problem is written in ASP and hits a SQL 2K DB. When I click submit I have 4...
0
by: iqbal | last post by:
Hi, I have 2 sql servers (A and B) and have established a link between them using sp_addlinkedserver. I have created a table (test) on sql server A. I have created a view (test) on sql server B...
9
by: Christian Wetzig | last post by:
hi, i have a table with test_field of type "TEXT". when i do: select test_field from test where id=1; the connection (with psql) hangs and no output is received, so i have to kill psql. ...
14
by: Luiz Antonio Gomes Pican?o | last post by:
How i can store a variable length data in file ? I want to do it using pure C, without existing databases. I'm thinking to use pages to store data. Anyone has idea for the file format ? I...
0
by: Nathan | last post by:
This is a copy of a message at microsoft.public.dotnet.framework.clr: THE CODE: I'm using an HttpWebResponse object to send an HTTP POST to a Java server I have written and are running on the...
36
by: James Harris | last post by:
Initial issue: read in an arbitrary-length piece of text. Perceived issue: handle variable-length data The code below is a suggestion for implementing a variable length buffer that could be used...
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
1
by: sadpony | last post by:
Ok, so I wrote a program and it is supposed to let the user set the size of an array, input the numbers, find the subscript and value of the highest and lowest values, and then ask the user to input...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.