blob: b9486f9f86f0675977e542eba664076be3041a57 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
(******************************************************************************
* *
* (c) 2005 CNOC v.o.f. *
* *
* File: cFillTable.pp *
* Author: Joost van der Sluis (joost@cnoc.nl) *
* Description: SQLDB example and test program *
* License: GPL *
* *
******************************************************************************)
program CFillTable;
{$mode objfpc}{$H+}
uses
Classes,
sqldb,
SqldbExampleUnit;
begin
ReadIniFile;
CreateFConnection;
CreateFTransaction;
// create FQuery
Fquery := TSQLQuery.create(nil);
with Fquery do
begin
database := Fconnection;
transaction := Ftransaction;
end;
with Fquery do
begin
SQL.Clear;
SQL.Add('insert into FPDEV ( ');
SQL.Add(' id, ');
SQL.Add(' Name, ');
SQL.Add(' Email, ');
SQL.Add(' Birthdate) ');
SQL.Add('values ( ');
SQL.Add(' 1, ');
SQL.Add(' ''Florian Klaempfl'', ');
SQL.Add(' ''florian@freepascal.org'',');
// Please update the date format according to your database (ie. MySQL 1975-1-1)
SQL.Add(' ''1-jan-1975'' ');
SQL.Add(') ');
ExecSql;
end;
Ftransaction.CommitRetaining;
Fquery.Free;
Ftransaction.Free;
Fconnection.Free;
end.
|