473,811 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_strin g() 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_statu s(),
# 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_statu s ($qry_id);
$g_db_err_str = pg_result_error ($qry_id);
}

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

:::

Cheers

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

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

Similar topics

1
2502
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 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.)
2
3564
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 pressing one of them it triggers a specific query, like getting the server uptime, date or who (is online). The problem is that when I press one of the buttons it send the query to the server, reads from the BufferedReader. This goes all well but...
3
2842
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 procs that need to be executed. I always get a sql server timeout error. I opened up Profiler and traced the events. The page hangs on the last proc called which is basically a select * where id = @id. If I run the same proc that hangs in query...
0
2583
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 that selects from the table (test) on sql server A. When I select from the view on sql server B I am able to retrieve rows from the view(on B)/table(on A) with the following query: Query on sql server B (where test is the view)
9
2278
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. this occurs, at first sight, if length(test_field)>32748.
14
5852
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 want to store data like a database: ---------------------------------- Custumer:
0
2912
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 same machine (for dev and testing). Here is the C# code snippet: 1 string clientAddr = "http://127.0.0.1:22225/"; 2 try 3 { 4 webreq = (HttpWebRequest)WebRequest.Create( clientAddr );
36
3825
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 to read text or handle arrays of arbitrary length. I don't have the expertise in C of many folks here so I feel like I'm offering a small furry animal for sacrifice to a big armour plated one... but will offer it anyway. Please do suggest...
4
4594
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 reservation of available resources (laptops, beamers, etc). The MySql database queries are already in place, as is the ASP administration panel. The frontend that users will see however, still needs some work. I'm really close, but since I'm no...
1
1721
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 a value which the program will then check for it in the array and tell the user if it is in the array and how many times. So, I wrote it all, and I thought that it should be working. It compiles fine, but once I run it, it just hangs up and...
0
9607
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10397
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10410
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9214
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7674
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3878
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3027
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.