Recent

Author Topic: [SOLVED] Sqlite - database alias doesn't work with TSQLite3Connection?  (Read 3406 times)

Dibo

  • Hero Member
  • *****
  • Posts: 1057
Hi,

I'm using "attach database <database file> as coll'". Then I can use this alias for create tables: CREATE TABLE coll.<table name>. But when try with SELECT/INSERT/UPDATE:
Code: [Select]
    q.SQL.Text := 'SELECT 1 FROM coll.coll_paths LIMIT 1';
    q.Open;
... then I get error "EDatabaseError near "." : syntax error " . Copy paste into sqlitebrowser or sqliteman is working fine without syntax error. Even "select * from main.<some table>" raise same exception since "main" should always exists.

Regards
« Last Edit: December 04, 2014, 08:14:05 pm by Dibo »

kapibara

  • Hero Member
  • *****
  • Posts: 656
Re: Sqlite - database alias doesn't work with TSQLite3Connection?
« Reply #1 on: December 03, 2014, 04:37:23 am »
I had the same problem a while ago, but it was quickly solved here:

http://forum.lazarus.freepascal.org/index.php/topic,24751.msg149381.html#msg149381
Lazarus trunk / fpc 3.2.2 / Kubuntu 24.04 - 64 bit

Dibo

  • Hero Member
  • *****
  • Posts: 1057
Re: Sqlite - database alias doesn't work with TSQLite3Connection?
« Reply #2 on: December 04, 2014, 08:13:53 pm »
Thanks! That was it!

Fripsy

  • New Member
  • *
  • Posts: 14
Re: [SOLVED] Sqlite - database alias doesn't work with TSQLite3Connection?
« Reply #3 on: February 09, 2016, 02:57:14 pm »
For those having the same problem, and finding that the link above doen't work anymore...

Just set ParseSQL to false in TSQLQuery, that's all!
Lazarus 1.4.0 r48774 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018