Recent

Author Topic: SISEGV on opening SQLQuery1.  (Read 3639 times)

cov

  • Full Member
  • ***
  • Posts: 241
SISEGV on opening SQLQuery1.
« on: April 10, 2013, 10:23:38 pm »
I'm getting SIGSEGV errors on my firebird Database.

Code: [Select]
        with IBConnection1 do
        begin
          DatabaseName:='localhost:'+dbpath+PathDelim+dbname+'.fdb';
          UserName:='sysdba';
          Password:='myp4ssw0rd';
        end;     
        SQLQuery1.Close;
        SQLQuery1.SQL.Text:='SELECT '+QFields+' FROM FIELDS'+QFilter+Qsort;
        SQLQuery1.ExecSQL;
        IBConnection1.Connected:=True;
        SQLTransaction1.Active:=True;
        SQLQuery1.Open;<- SIGSEGV occurs here.
 

Can anyone suggest anything to try?

goodname

  • Sr. Member
  • ****
  • Posts: 297
Re: SISEGV on opening SQLQuery1.
« Reply #1 on: April 11, 2013, 03:12:44 am »
You seam to be trying to execute a select query before connecting to the database. Remove the SQLQuery1.ExecSQL;

The database may be returning a error which is not being caught. Use a try except block around the SQLQuery1.Open;.

WallE

  • New member
  • *
  • Posts: 9
Re: SISEGV on opening SQLQuery1.
« Reply #2 on: April 11, 2013, 08:15:14 am »

try commenting out these lines !!
Code: [Select]
        SQLQuery1.ExecSQL;
        IBConnection1.Connected:=True;
        SQLTransaction1.Active:=True;
 


BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: SISEGV on opening SQLQuery1.
« Reply #3 on: April 11, 2013, 08:53:48 am »
I wouldn't disable the transaction stuff. Spelling things out can be good ;)
You'd get something like this:
Code: [Select]
        with IBConnection1 do
        begin           DatabaseName:='localhost:'+dbpath+PathDelim+dbname+'.fdb';
          UserName:='sysdba';
          Password:='myp4ssw0rd';
        end;     
// open database connection and transaction first. The query should be linked to the transaction
        IBConnection1.Connected:=True;
        SQLTransaction1.Active:=True;

// you must have linked sqlquery1 to the database/transaction somewher - probably in the GUI/object inspector?
        SQLQuery1.Close;
        SQLQuery1.SQL.Text:='SELECT '+QFields+' FROM FIELDS'+QFilter+Qsort;
        //SQLQuery1.ExecSQL; // open and execsql are mutually exclusive. Use open for getting results, use execute if you don't want or expect results.
        SQLQuery1.Open;
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

exdatis

  • Hero Member
  • *****
  • Posts: 668
    • exdatis

cov

  • Full Member
  • ***
  • Posts: 241
Re: SISEGV on opening SQLQuery1.
« Reply #5 on: April 11, 2013, 09:17:51 am »
Hi,

Thanks for all the replies.

I was a little quick on the trigger as I'm building Dynamic Forms and I was getting a little exasperated by the SIGSEGV exceptions.  :-[

The problem was that the IBConnection was improperly set.

My bad.  :(

 

TinyPortal © 2005-2018