Delphi work with SQLite (Auto ID, Default value and Trigger)

This is an example show you about Delphi work with  SQLite database.

SQLite Data Schema

CREATE TABLE "blog" (
  "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  "blog_title" varchar(50) NOT NULL,
  "blog_remark" varchar(50),
  "sys_createdate" timestamp DEFAULT CURRENT_TIMESTAMP,
  "sys_updatedate" timestamp
)


Next step, Use Delphi Rio to create Application for manage database.

Set
FDQuery1ID Field

AutoGenerateValue = arAutoInc
ProviderFlags
 pfInUpdate = false
 pfInWhere = true
 pfInKey = True

ReadOnly = true

Set
FDQuery1sys_createdate, FDQuery1sys_updatedate field
AutoGenerateValue = arDefault
ProviderFlags
 pfInUpdate = false
 pfInWhere = false
 pfInKey = false

ReadOnly = true

Download source github

Comments