Luiz Americo Pereira Camara wrote:
Bogusław Brandys escreveu:
Hello,

First: I'm using FPC SVN 2.0.3 from 2006-02-24 TSqlite3Dataset version.
I know that there is some version newer then this but I'd like to stick with SVN.
Platform: Windows XP Home,Lazarus SVN rev.8817

I already sent a patch to fpc maillist. I'm waiting for the commit.
Why is impossible to use Edit,Post,ApplyUpdates,Refresh functions for TSqlite3Dataset in SQLMode ? I have defined PrimaryKey which is INTEGER PRIMARY KEY but is it skipped (for example ApplyUpdates has check for :
  if (FPrimaryKeyNo <> -1) and not FSqlMode then (...)
)

So that code does not update database table at all (in SQLMode):

DB.Edit;
DB.FieldByName('Test').AsString := 'Test';
DB.Post;
DB.ApplyUpdates;
DB.Refresh;


For me it's strange because update/delete SQL should work flawless with SQlMode when PrimaryKey is set (even if table has not define primary key there is ROWID variable to obtain record ID which may be used for update/delete statement)

SqlMode is intended only when you want to use queries that retrieves data from more than one table or use field aliases. It prevines data corruption when using ApplyUpdates. When using queries that retrieve data from only one table, without using aliases, even complex ones, ApplyUpdates will work and SqlMode should be set to false. Notice that only ApplyUpdates is affected by SqlMode. All other functions you cited does not.

This situation is mostly caused by lack of documentation. I will do it ASAP.

About ROWID: to use it would be necessary to parse the Sql, since is not possible to retrieve directly, which could bring a lot of complexity. The current schema keeps the code simple with small cost (user must declare what is the primary key)
Currently I'm populating dbGrid and let user change default value for one record using separate ExecSql function - this require RefetchData and dbGrid row selection is lost.

tSqlite3Dataset is in SQLMode because I need rows ordered so SQL is really simple : select test from table order by test desc
See above.

Also please do not throw exception when field type is unknown (not in supported list) - just treat it as ftString field of size 10.

Already fixed.
You could insist that it's better to use supported field types (INTEGER,NUMERIC,FLOAT,VARCHAR,CHAR) but would would you do for such query:
Me?

select Test || '(default)' as Name from table where Def='T'
union
select Test as Name from table where Def<>'T'
order by Test


Exception :     Field type "''" not recognized on concatenated field

BTW: Please notice that this issue is not Lazarus related. Only fpc related. Maybe would be better to discuss in fpc maillist.

Luiz


Thank you.That explain all situation.


Regards
Boguslaw

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to