[Sqlrelay-discussion] In SQLRelay for FreeTDS, sqlrconnction->ping() makes following queries fail w
Brought to you by:
mused
|
From: sz l. <shu...@gm...> - 2007-09-25 17:37:03
|
Hi, We are using sqlrelay 0.37 to connect to SQL Server via FreeTDS in Linux box. We want to check whether the SQL Server is down or not using sqlrconnction->ping(). However, it seems that it does not work as expected: (1) Restart the sqlrelay, make sure it works. (2) Stop the SQL service. (3) In a program, call sqlrconnction->ping() and then exit. (4) Restart the SQL service. (5) %query =96id instanceName "select 1" It gives out error message: "Error: Attempt to initiate a new SQL Server operation with results pending." In the sqlrelay/src/connections/freetds/freetdsconnection.C, the bool freetdscursor::executeQuery(const char* query, unit32_t length, bool execute) is used to send out the query using freetds: ct_send(cmd). When there are some errors, it would call cleanUpData to clean the result set. However, the discardResults() depends on the data member "results" which would not got initialized until the ct_send is successful. If we initialize= : results=3DCS_SUCCEED; before calling ct_send(cmd), the %query =96id instanceName "select 1" would work. Does this fix make sense? Thanks. |