#6 access violation in execute function (mysql)

closed
René Tegel
None
5
2005-10-30
2005-10-24
Anonymous
No

I use a TMyDB to connect to a database on a local MySQL
server. Then I use mydb.execute(..) to send a SELECT
statement. This works fine. After that, because the
SELECT returned a rowcount of zero, I try to execute
the following statement :

INSERT INTO object_info (object_type, size) VALUES (11,
12 )

This generates an access violation. The exact line is in

TMyDB.execute -> FillFieldInfo ->
"for i:=0 to mf.mysql_num_fields(res)-1 do"

where res is NIL.

It seems like the function is trying to access a result
set that is not returned from the server. Maybe a
separate "execute" function for INSERT and UPDATE
statements would be a good idea ? It should be possible
to retrieve the "RowsAffected" by the query of course.
I only starting to play with LibSQL so maybe I'm doing
something wrong too. Still seems like a bug...

I also tried to use the MySQL-ODBC driver and do the
same thing with TODBCBC. This works fine.

my email : tlenders@gmx.de

oh, and thanks for your work on LibSQL btw. :-)

Discussion

  • René Tegel
    René Tegel
    2005-10-25

    • assigned_to: nobody --> artee
     
  • René Tegel
    René Tegel
    2005-10-30

    Logged In: YES
    user_id=764063

    Added a check to TMyDB.Execute method to see if there are
    any results no fetch. New code is in CVS but needs some
    testing (have no mysql installed yet on my new development
    system - hang on).

     
  • René Tegel
    René Tegel
    2005-10-30

    • status: open --> closed