User Tools

Site Tools


delphizeoslib

To install:

  1. download latest version and extract.
  2. Load Delphi
  3. add library path \packages\delphixxxx\build
  4. (if necessary) add library path of \src\core \src\parse etc.
  5. open project (find the zeosdbo.bpg and install in following order:
    1. ZCore.bpl
    2. ZParseSql.bpl
    3. ZPlain.bpl
    4. ZDbc.bpl
    5. ZComponent.bpl
  6. lastly, compile and install the zeoscomponent
  7. (if necessary) add library path of dcu (can find this after compiling)

Notes:

  • in zconnection, need to set library path of libmysql.dll
  • after connect:
    • SET time_zone = 'Asia/Manila';
    • SET date_format = '%Y-%m-%d'; default date as 'yyyy-mm-dd', may affect time and datetime

Transaction Sample: This is how AutoCommit property actually works in Zeos:

When AutoCommit is True, then the transactions are commited automatically after each executed SQL statement, but you can use the StartTransaction command explicitly to prevent this auto commiting, until you explicitly call Commit.

When AutoCommit is False, you shouldn't call StartTransaction. Then the transaction is started automatically, but it will not commit automatically after every executed statement.

ZConnection1.AutoCommit := True;
ZConnection1.StartTransaction;
try
  ZTable1.Insert;
  ZTable1.FieldByName('name').AsString := 'John Doe';
  ZTable1.Post;
  ZConnection1.Commit;
except
  ZConnection1.Rollback;
end;
ZConnection1.AutoCommit := False;
with ZQuery1 do begin
   SQL.Text := 'INSERT INTO mytable (name) values ("John Doe")';
   ExecSQL;
   SQL.Text := SQL.Text + 'COMMIT' ;
   try
     ExecSQL;
   except
     SQL.Text := 'ROLLBACK';
     ExecSQL;
   end;
end;
delphizeoslib.txt · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki