I am using Windows 7 64 bit, Firebird 2.5.6 64 bit server, Lazarus 1.6.0 32 bit, FPC 3.0.0 32 bit.
fbclient.dll (Firebird 2.5.6 32 bit) and test.fdb are on the the same folder of project1.exe.
Connection to local database file is tested and working correctly.
Why does line 32 "SQLTransaction1 := TSQLTransaction.Create(nil);" shows error "project1.lpr(32,19) Error: Operator is not overloaded: - 'TSQLTransaction' "?
----------------------------
Compile Project, Target: project1.exe: Exit code 1, Errors: 6, Warnings: 2
project1.lpr(32,3) Warning: Variable "SQLTransaction1" does not seem to be initialized
project1.lpr(32,19) Error: Operator is not overloaded: - "TSQLTransaction"
project1.lpr(48,3) Warning: Variable "SQLQuery1" does not seem to be initialized
project1.lpr(48,13) Error: Operator is not overloaded: - "TSQLQuery"
project1.lpr(63,18) Error: Incompatible types: got "untyped" expected "LongInt"
project1.lpr(63,25) Error: Illegal expression
project1.lpr(67,16) Error: Incompatible types: got "untyped" expected "LongInt"
project1.lpr(67,21) Error: Illegal expression
----------------------------
program project1;
{$mode objfpc}
uses
Classes, SysUtils, IBConnection, sqldb;
var
IBConnection1: TIBConnection;
SQLTransaction1: TSQLTransaction;
SQLQuery1: TSQLQuery;
begin
IBConnection1 := TIBConnection.Create(nil);
IBConnection1.HostName := 'localhost';
IBConnection1.DatabaseName := 'test.fdb';
IBConnection1.UserName := 'SYSDBA';
IBConnection1.Password := 'masterkey';
// IBConnection1.CharSet := 'UTF8';
IBConnection1.CharSet := 'ISO8859_1';
IBConnection1.Dialect := 3;
IBConnection1.Params.Add('port=3050');
IBConnection1.LoginPrompt := False;
IBConnection1.Connected := True;
if IBConnection1.Connected then
WriteLn('Connected.')
else
WriteLn('Not connected.');
----------------------------
SQLTransaction1 := TSQLTransaction.Create(nil);
// SQLTransaction1.Params.Add('read_committed');;
// SQLTransaction1.Params.Add('rec_version');;
// SQLTransaction1.Params.Add('nowait');;
SQLTransaction1.Database := IBConnection1;
SQLTransaction1.Params.Add('isc_tpb_read_committed');;
SQLTransaction1.Params.Add('isc_tpb_rec_version ');;
SQLTransaction1.Params.Add('isc_tpb_nowait');;
SQLTransaction1.StartTransaction;
if SQLTransaction1.Active then
WriteLn('Transaction started.')
else
WriteLn('Transaction not started.');
------------
SQLQuery1 := TSQLQuery.Create(nil);
SQLQuery1.Database := IBConnection1;
SQLQuery1.Transaction := SQLTransaction1;
SQLQuery1.SQL.Text := 'Select ID, Name From People;';
SQLQuery1.Open;
while not SQLQuery1.Eof do
begin
WriteLn('ID: ', SQLQuery1.FieldByName('ID').AsInteger,
'Name: ' + SQLQuery1.FieldByName('Name').AsString);
SQLQuery1.Next;
end;
SQLQuery1.Close;
SQLQuery1.Free;
------------
SQLTransaction1.Commit;
SQLTransaction1.Free;
----------------------------
IBConnection1.Free;
end.