how to hide error?

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
NeiSep
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 12.01.2007, 20:27

how to hide error?

Post by NeiSep »

Hello

how do i hide errors i looked in the exampels but nobody did take this up.
i want to show errors in file i do not want a popup in the software and i can't find in out any knows what todo ?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

What kind of errors are you looking for?

As far as I know all errors raise a normal exception. How to catch them is Object Pascal, not Zeoslib, I would think. If you catch exceptions of EZSQLThrowable class you will have most of Zeoslib exceptions.

Mark
NeiSep
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 12.01.2007, 20:27

Post by NeiSep »

mdaems wrote:What kind of errors are you looking for?

As far as I know all errors raise a normal exception. How to catch them is Object Pascal, not Zeoslib, I would think. If you catch exceptions of EZSQLThrowable class you will have most of Zeoslib exceptions.

Mark
i mean like i get popup when i can't connect to MySQL server i do not want this to show as a message.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Use a construction like this:

Code: Select all

  try
     Connect;
  except
    on e:EZSQLThrowable do HandleException(e);
  end;

Not 100 % sure about syntax, but I thinkthis principle will do.

Mark
NeiSep
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 12.01.2007, 20:27

Post by NeiSep »

mdaems wrote:Use a construction like this:

Code: Select all

  try
     Connect;
  except
    on e:EZSQLThrowable do HandleException(e);
  end;

Not 100 % sure about syntax, but I thinkthis principle will do.

Mark
where can i read about this ?
i want to learn how to use this stuff.
and i do not use EZSQLThrowable i use only 3 components:
TZConnection, TZQuery, TZSQLMonitor

And i want to get errors only shown by TZSQLMonitor i do not want any popup message about connection success i want it manualy to the TZSQLMonitor if you understand what i mean.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

EZThrowable is the exception class raised by our components. The ones you mentioned above.
Just look for things like 'Exception handling', 'Exceptions', 'raise', 'Try except' in Delphi Help or a standard work about delphi/object pascal.

It is possible to write to the ZSQLMonitor manually.
You'll need to add ZDbcLogging, ZSQLMonitor to your uses clause.
Then you can create the monitor and log some stars to it using this code :

Code: Select all

      TZMonitor := TZSQLMonitor.Create(Application);
      TZMonitor.FileName := 'MysqlTrace.txt';
      TZMonitor.Active := true;
      TZMonitor.AutoSave := true;
      TZMonitor.MaxTraceCount := 10000;
      TZMonitor.LogEvent(TZLoggingEvent.Create(lcOther,'','***********',0,''));
Mark
NeiSep
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 12.01.2007, 20:27

Post by NeiSep »

mdaems wrote:EZThrowable is the exception class raised by our components. The ones you mentioned above.
Just look for things like 'Exception handling', 'Exceptions', 'raise', 'Try except' in Delphi Help or a standard work about delphi/object pascal.

It is possible to write to the ZSQLMonitor manually.
You'll need to add ZDbcLogging, ZSQLMonitor to your uses clause.
Then you can create the monitor and log some stars to it using this code :

Code: Select all

      TZMonitor := TZSQLMonitor.Create(Application);
      TZMonitor.FileName := 'MysqlTrace.txt';
      TZMonitor.Active := true;
      TZMonitor.AutoSave := true;
      TZMonitor.MaxTraceCount := 10000;
      TZMonitor.LogEvent(TZLoggingEvent.Create(lcOther,'','***********',0,''));
Mark
but see see when i trying to use the code you told me to it complains that is unreconized: EZThrowable
NeiSep
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 12.01.2007, 20:27

Post by NeiSep »

Hey
i think i fixed it thank you very much for your help
NeiSep
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 12.01.2007, 20:27

Post by NeiSep »

How do i make this to not eat memory is it possibul to flush or clear after i done a query?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

After a query you do just 'close' to free the memory taken by a result. Of course, if you create new query objects during runtime,you have to free them as well.

Normally the number of memory leaks must be limited,but if you find one, tell us.

If your procedure keeps leaking, we'll need to know what you have written.

BTW, I hope you do not always call all 6 lines of code above when you want to log? That would declare the leaking. Only the first time the first 5 lines are needed to create a monitor. If you put one on a form, you don't even need those 5 lines.

Mark
NeiSep
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 12.01.2007, 20:27

Post by NeiSep »

well okey close but oki i gone check what am i gone close the query or the connection to MySQL ?
Becuse im doing a server thats get registration from several hubs and adds infomation to MySQL db and for this i need the connection to be alive all the time until i shut it down.
And if i was gone call any close then i think the process will be destroyed and this will not work for me.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Just close the query if you opened it with Query.Open. If you use execSQL this should not be necessary.
Do you know what exactly eats the memory?

Mark
NeiSep
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 12.01.2007, 20:27

Post by NeiSep »

Hmm okidkie weird entire app is so slow and it almost hangs itself four couple minutes then it works again and then it is the same.
Anyway im not sure what the problem with eating entire memory was but i think i did fixed it.
Post Reply