DelphiFan Magazine

Top Menu

Main Menu

  • DELPHI
  • CODE SAMPLES
  • FIREMONKEY
  • DATABASE
  • RELEASES
  • VIDEOS
  • REVIEW
  • TECH NEWS

logo

DelphiFan Magazine

  • DELPHI
  • CODE SAMPLES
  • FIREMONKEY
  • DATABASE
  • RELEASES
  • VIDEOS
  • REVIEW
  • TECH NEWS
  • How to add a server application written in UNIGUI to startup?

  • UniGUI Expiry Link Anonymizer

  • UniGUI Add CAPTCHA to the WEB project

  • UniGui. Unique hybrid of Delphi and JS

  • How to transform a blob field into string lines (varchar) in SQL Firebird?

CODE SAMPLESDELPHI
Home›CODE SAMPLES›Connect And Manage A SQLite Database For Delphi

Connect And Manage A SQLite Database For Delphi

By admin
October 8, 2020
309
0
Share:

SQLite becomes popular for working with light weight embedded, mobile, IoT, and desktop applications. Do you want your Delphi and C++ Builder Applications to connect with SQLite Database? How to start? Don’t worry, FireDAC offers robust components to connect with MySQL Database.

FireDAC.SQLLite Sample app demonstrates how to use FireDAC to work with SQLite Database.

You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

Components used in the Sample App:

  • TFDQuery : To execute SQL queries, browse the result sets, and edit the result set records.
  • TFDPhysSQLiteDriverLink: To link the SQLite driver to an application and set it up. In general, it is enough to only include the FireDAC.Phys.SQLite unit into your application uses clause. The TFDPhySQLiteDriverLink component can be used to specify: The VendorHome – the SQLite installation root folder. The VendorLib – the name and the optional path to the SQLite client library.
  • TFDConnection : To establish a connection to a DBMS and to manage associated datasets.
  • TFDSQLLiteFunction :  To register a custom SQLite function. A registered function then may be used in any place in a SQL command, where an expression may be used.
  • TFDSQLiteBackup : Add a backup, restore, copy database capability to an application. 
  • TFDSQLiteSecurity :  To add SQLite database security management capabilities to an application. 
  • TFDSQLiteValidate : Add a database validation capability to an application. This is a programmatic method to invoke the specific SQLite PRAGMA and other commands. 
  • TFDSQLiteCollation : To register a custom SQLite collation. A registered collation then may be used in any place in a SQL command where a collation may be specified.
  • And some of the components, like TDBGrid,TDBComboBox, TFDGUIxWaitCursor1,TFDGUIxLoginDialog1,TFDGUIxErrorDialog1.

Implementation Details:

The simplest to configure connection to SQLite database at run-time is to build a temporary connection definition: In the sample, the temporary definition is created when the <Open database…> item is selected in the Connection combo box. Open the following database: C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\data\FDDemo.sdb.

In the demo database, the Categories and Products tables have one-to-many relation by CategoryID field. Mention the query to the qryCategories.SQL property and qryProducts.SQL property.

Finally, the qryProducts.MasterSource property is set to dsCategories, while the MasterFields property is set to CategoryID. This creates a master-details relationship between the datasets. StockPrice function is a custom function defined using the TFDSQLiteFunction component. The calculation is configured using a OnCalculate event:The event occurs when fetching records from the database. It returns the calculated value.Simple queries execution is demonstrated via ExecSQL method of TFDConnection.

Managing the SQLite Database : The sample also shows how to perform several Management of databases such as:

  • Database management
  • Validating database
  • Creating database backup
  • Using custom collations and functions

All this Management of databases is done using the following components: TFDSQLiteBackup, TFDSQLiteSecurity, TFDSQLiteValidate, TFDSQLiteCollation and TFDSQLiteFunction.

This demo demonstrates managing database encryption, validating database and creating database backup: Check out the full article in the DocWiki about the FireDAC SQLite Sample.

Tagsconnect sqlitedatabasedelphisqlitevcl
Previous Article

Check Out 30+ Delphi Units To Take ...

Next Article

Implementation of uniGUI login-free

0
Shares
  • 0
  • +
  • 0
  • 0
  • 0
  • 0

admin

Related articles More from author

  • CODE SAMPLESDELPHI

    UniGUI’s forms and modules

    November 9, 2020
    By admin
  • CODE SAMPLESDELPHI

    Introduction to the properties of the delphi TForm class

    December 2, 2020
    By admin
  • DELPHIVIDEOS

    Android Permissions in Delphi

    October 2, 2020
    By admin
  • CODE SAMPLESDATABASE

    How to add or remove hours from a SQL Firebird timestamp field

    January 13, 2021
    By admin
  • CODE SAMPLESDELPHI

    DBGrid beautification and SQLite display problem

    November 24, 2020
    By admin
  • VIDEOS

    Setting up, running and debugging your first MacOS application from Delphi

    September 27, 2020
    By admin

Leave a reply Cancel reply

You may interested

  • CODE SAMPLESDELPHIFIREMONKEY

    Delphi Android permissions

  • CODE SAMPLESDELPHI

    UniGUI Add CAPTCHA to the WEB project

  • CODE SAMPLESDELPHI

    Simple instructions for using uniGUI’s HyperServer (load balancing)

  • LATEST REVIEWS

  • TOP REVIEWS

Timeline

  • January 27, 2021

    How to add a server application written in UNIGUI to startup?

  • January 27, 2021

    UniGUI Expiry Link Anonymizer

  • January 26, 2021

    UniGUI Add CAPTCHA to the WEB project

  • January 26, 2021

    UniGui. Unique hybrid of Delphi and JS

  • January 13, 2021

    How to transform a blob field into string lines (varchar) in SQL Firebird?

Latest Comments

Find us on Facebook

Follow Us on Instagram

logo

Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.

About us

  • 660 Pennsylvania Avenue Southeast #100 Washington, DC 20003
  • 0123456789
  • adsdelphi@gmail.com
  • Recent

  • Popular

  • Comments

  • How to add a server application written in UNIGUI to startup?

    By admin
    January 27, 2021
  • UniGUI Expiry Link Anonymizer

    By admin
    January 27, 2021
  • UniGUI Add CAPTCHA to the WEB project

    By admin
    January 26, 2021
  • UniGui. Unique hybrid of Delphi and JS

    By admin
    January 26, 2021
  • How to add a server application written in UNIGUI to startup?

    By admin
    January 27, 2021
  • Amazing Cross Platform Email App Sample In Delphi 10.4.1 FireMonkey For Android And IOS

    By admin
    August 13, 2020
  • Critical Update Available For Delphi FireMonkey 10.4.1 On Android, IOS, OSX, Windows, And Linux

    By admin
    September 4, 2020
  • Setting up the IDE for your first Android Application in Delphi

    By admin
    September 7, 2020

Follow us

Find us on Facebook

© Copyright Delphifan Forum. All rights reserved.