Sqlite under FireDAC [3]-Get basic information about a database

Source: Internet
Author: User



Add on a blank form: tfdconnection, Tfdphyssqlitedriverlink, Tfdguixwaitcursor, TMemo
Procedure TForm1.FormCreate(Sender: TObject);
Var
  List: TStrings;
  V: Variant;
Begin
  FDConnection1.Open(‘DriverID=SQLite; Database=C:\Temp\FDDemo.sdb‘);

  List := TStringList.Create;

  FDConnection1.GetInfoReport(List);
  Memo1.Clear;
  Memo1.Lines.Add(‘==> Get connection information: ‘);
  Memo1.Lines.AddStrings(List);

  FDConnection1.GetTableNames(‘‘, ‘‘, ‘‘, List);
  Memo1.Lines.Add(#13#10‘==> Get a list of table names in the database: ‘);
  Memo1.Lines.AddStrings(List);

  FDConnection1.GetTableNames(‘‘, ‘‘, ‘‘, List, [], [tkView]);
  Memo1.Lines.Add(#13#10‘==> Get the list of query names in the database: ‘);
  Memo1.Lines.AddStrings(List);

  FDConnection1.GetFieldNames(‘‘, ‘‘, ‘Orders‘, ‘‘, List);
  Memo1.Lines.Add(#13#10‘==> Get a list of field names in the Orders table: ‘);
  Memo1.Lines.AddStrings(List);

  V := FDConnection1.ConnectionMetaDataIntf.GetTables([], [tkTable], ‘‘, ‘‘, ‘‘).Rows[0].GetData(0);
  Memo1.Lines.Add(#13#10‘==> Get the first data in the first column of the first table: ‘);
  Memo1.Lines.Add(V);

  List.Free;
End;

{Results are as follows:}
{................................................. ..............
==> Get connection information:
=================================
Connection definition parameters
=================================
Name=Unnamed
DriverID=SQLite
Database=C:\Temp\FDDemo.sdb
=================================
FireDAC info
=================================
Tool = RAD Studio XE6
FireDAC = 10.0.1 (Build 69712)
Platform = Windows 32 bit
Defines = FireDAC_NOLOCALE_META;FireDAC_MONITOR
=================================
Client info
=================================
Loading driver SQLite ...
DLL =
Client version = 3.8.3.1
Compile options = ENABLE_COLUMN_METADATA;ENABLE_FTS3;
  ENABLE_FTS3_PARENTHESIS;ENABLE_FTS4;ENABLE_RTREE;
  ENABLE_STAT4; HAS_CODEC; OMIT_AUTOINIT;
  OMIT_DEPRECATED; SYSTEM_MALLOC; TEMP_STORE=2;
  THREADSAFE=2
=================================
Session info
=================================
Current catalog =
Current schema =
Total changes = 0
Database encoding = UTF8
Encryption mode =
Cache size = 10000

==> Get a list of table names in the database:
Categories
CustomerCustomerDemo
CustomerDemographics
Customers
Employees
EmployeeTerritories
FDQA_all_types
FDQA_ascii_types
FDQA_batch_test
FDQA_bcd
FDQA_blob
FDQA_Categories
FDQA_db_types
FDQA_details_autoinc
FDQA_FK_tab
FDQA_ForAsync
FDQA_identity_tab
FDQA_locktable
FDQA_map1
FDQA_map2
FDQA_map3
FDQA_map4
FDQA_master_autoinc
FDQA_Maxlength
FDQA_novalstable
FDQA_numbers
FDQA_OrderDetails
FDQA_parambind
FDQA_Products
FDQA_tabwithpk
FDQA_timestamp
FDQA_transtable
FDQA_V_Test
FDQA_WString
"Order Details"
Orders
Products
Region
Shippers
Suppliers
Territories

==> Get a list of query names in the database:
FDQA_V_Test

==> Get a list of field names in the Orders table:
OrderID
CustomerID
EmployeeID
OrderDate
RequiredDate
ShippedDate
ShipVia
Freight
ShipName
ShipAddress
ShipCity
ShipRegion
ShipPostalCode
ShipCountry

==> Get the first data in the first column of the first table:
1
.................................................. .............} 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.