|
From: John L. <JL...@ib...> - 2004-02-18 15:50:41
|
Mmm, the problem goes a way when I call the sqlrelay functions from within
my own database class. It seems like the problem may occur when you use the
same connection for a long period of time. Here's my version of the execute
method that works:
def execute(query)
connection = SQLRConnection.new(@host, @port, '', @user, @password,
0, 1)
raise ConnectionError, "Error connecting to port #{@port} on host
#{@host}" if connection.ping != 1
cursor = SQLRCursor.new(connection)
cursor.getNullsAsNils
raise QueryError, "Error while fetching rows from
database:\n#{cursor.errorMessage}" if cursor.sendQuery(query) == 0
connection.endSession
if cursor.rowCount < 1
nil
else
results = []
for index in 0...cursor.rowCount
results << cursor.getRowHash(index)
end
results
end
end
As you can see the connection is preserved for only one query. Incidentally
I seem to get faster results with this approach.
--
John Long
http://wiseheartdesign.com
> -----Original Message-----
> From: John Long
> Sent: Tuesday, February 17, 2004 5:19 PM
> To: 'rub...@li...'
> Subject: Trouble Using Ruby/DBI and Microsoft Sql Server 7
>
>
> Hi,
>
> I've been using ruby/dbi with sqlrelay lately and am having
> some problems with code pausing indefinately. When I kill
> sqlrelay I get the following stack trace:
. . .
> Thanks.
>
> --
> John Long
> http://wiseheartdesign.com
>
|