1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram

  5. Delphifan Magazine
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

VCL Component SQLite Lang - DB Provider and Query Constructor

Discussion in 'Delphi Components,Freeware, Open Source' started by AdminDF, Oct 16, 2020.

  1. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    Module and interface for working with sqlite file database

    The module allows you to connect to a database file through the SqliteEx.dll library (Library with the ability to encrypt the database AES-256)

    The constructor allows you to compose a query using Delphi code (SQL.Select, SQL.Delete, SQL.Update ...) The constructor eliminates the need to write queries and store them in the code.

    Available constructs: select, update, delete, insert into, drop table, create table, where, order by, left | inner | outer | right join, pragma, incfield *, decfield *.

    SELECT

    with SQL.Select(tnTableName, [fnID, fnName, fnDesc, fnDateCreate]) do
    begin
    OrderBy(fnName, True);
    Table := FDB.DB.GetTable(GetSQL);
    EndCreate;
    Table.MoveFirst;
    while not Table.EOF do
    begin
    Item.ID := Table.FieldAsInteger(fnID);
    Item.Name := Table.FieldAsString(fnName);
    Item.Desc := Table.FieldAsString(fnDesc);
    Item.DateCreate := Table.FieldAsDateTime(fnDateCreate);
    Add(Item);
    Table.Next;
    end;
    Table.Free;
    end;
    INSERT

    with SQL.InsertInto(tnTableName) do
    begin
    AddValue(fnName, Item.Name);
    AddValue(fnDesc, Item.Desc);
    AddValue(fnDateCreate, Item.DateCreate);
    FDB.DB.ExecSQL(GetSQL);
    Item.ID := FDB.DB.GetLastInsertRowID;
    EndCreate;
    end;
    UPDATE

    with SQL.Update(tnTableName) do
    begin
    AddValue(fnName, Item.Name);
    AddValue(fnDesc, Item.Desc);
    AddValue(fnDateCreate, Item.DateCreate);
    WhereFieldEqual(fnID, Item.ID);
    FDB.DB.ExecSQL(GetSQL);
    EndCreate;
    end;
    UPDATE BLOB

    with SQL.UpdateBlob(tnTableName, fnImage) do
    begin
    WhereFieldEqual(fnID, Item.ID);
    Item.Image.SaveToStream(Mem);
    FDB.DB.UpdateBlob(GetSQL, Mem);
    Mem.Free;
    EndCreate;
    end;
    DELETE

    with SQL.Delete(tnTableName) do
    begin
    WhereFieldEqual(fnID, Items[Index].ID);
    FDB.DB.ExecSQL(GetSQL);
    EndCreate;
    end;
    CREATE TABLE

    with SQL.CreateTable(tnTableName) do
    begin
    AddField(fnID, ftInteger, True, True);
    AddField(fnName, ftString);
    AddField(fnDesc, ftString);
    AddField(fnDateCreate, ftDateTime);
    FDB.DB.ExecSQL(GetSQL);
    EndCreate;
    end;

    Hidden Content:
    **Hidden Content: You must click 'Like' before you can see the hidden data contained here.**
     

Share This Page