[Sqlrelay-discussion] Question on Suspending and Resuming SqlRelay Sessions in PHP
Brought to you by:
mused
From: Himsl, J. <jas...@mc...> - 2005-06-10 23:45:26
|
Hello, I have run into an interesting series of problems implementing sqlrelay's suspend/resume functions. My development environment consists of the following: 1) A Debian server running Apache with PHP 4.3.4 2) The same Debian server running sqlrelay (4 pooled connections to the DB) 3) A Solaris server running Oracle 9.2 Scenario: I'm trying to create a dynamic page where users can run an Oracle procedure and view an ordered subset of the records returned on a per page basis. Users would be shown (x) number of records and be able to click a link which would return the next (x) set of records from the original RecordSet.=20 SqlRelay's suspend/resume functionality supposedly allows for the same RecordSet session to be suspended and resumed across pages without having to run the DB procedure multiple times. The sqlrelay documentation gives a small example on how to suspend and resume a simple insert session. Basically you store the connection vars (RSID, Port, Socket), call the suspend functions and clear your resources. On the next page you call the resume functions passing the appropriate RecordSetID, Port and Socket values to retrieve the suspended Session's RecordSet. The example was quite vague on how to actually pass the appropriate RecordSetID, Port and Socket values though. The example also referenced incorrect function names and parameters to retrieve the port and socket from the current connection.=20 I thumbed through the API and found the correct function names for retrieving the Port and Socket information. However, I have found the return values for both functions to be horribly inconsistent. In most instances calling the 'sqlrcon_getConnectionSocket' function will segfault Apache, display garbage characters or even display text values from the RecordSet. Also calling 'sqlrcon_getConnectionPort' almost never returns a valid port number and a lot of the time it only returns 0. Keep in mind these are values pulled from a working sqlrelay connection which successfully queries the database and returns a valid RecordSet. I am bewildered as to why the 'sqlrcon_getConnectionSocket' function is returning anything other then null or empty string. Since sqlrelay runs on a separate server than the database, the sqlrelay connections should only rely on the hostname and port number. It should not be using Unix Sockets at all. I'm assuming that the connection session we are suspending is the connection between sqlrelay and the Database. Please correct me if I am wrong in this assumption. I have a slightly different scenario then what was given in the sqlrelay example. I'm calling an Oracle procedure which returns a refcursor that I bind a sqlrelay cursor to too. After some experimenting I have suspended and resumed a RecordSet within the same page call. However, once I attempted to split the Suspend and Resume functions across pages I get nothing but 'Unknown errors' from the debugger and Segfaults from Apache. I believe I have narrowed the problem down to the sqlrelay connection object. This all comes back to the 'sqlrcon_getConnectionPort' and 'sqlrcon_getConnectionSocket' functions. Passing the RecordSetID and Connection Port to another page in PHP is trivial since they are simple value types. The Connection Socket is another issue though. PHP considers Unix Sockets to be resources. Resources can not be serialized in PHP and therefore can not be stored in a session or passed as a value to the GET or POST vars.=20 Here are my questions: Why do I see or what would cause so many inconsistencies in the values returned by the 'sqlrcon_getConnectionPort' and 'sqlrcon_getConnectionSocket' functions? How do I ensure I get either a valid Port or Socket? How do I effectively pass the Socket information from one PHP page to another? J.D.H. |