Recent

Author Topic: Zquery (how to know the status after execsql)  (Read 4059 times)

vcorp

  • Newbie
  • Posts: 4
  • Delphi and VC++ Coder
    • vcorp
Zquery (how to know the status after execsql)
« on: August 26, 2015, 06:10:44 pm »
Hello i'm a delphi developer and i'm using your components on my RealRally manager project.
I'm writing a recovery routine to execute the logged query into a file.

What i don't understand is this thing:

I first do an update before an insert to know the status of that operation

Using sqlyog i see if an update return 0 (no rows updated) or 1 (one row updated).
based on that result is really easy know if i need to skip the insert query.

There is a way to know what appen after executing a query from tzquery?

i will try to be more clear with this example:

Code: [Select]
ZQuery1.SQL.Clear;
ZQuery1.SQL.Add(Encrypt(Data[y], '1'));   // the string can be something like: UPDATE startlist Set Damage = 1 WHERE IdPilota = "vcorp" AND IdRally = "00000000000446";
ZQuery1.ExecSQL;

I need to know after ExecSQL what happened
if there are some row updated or 0 row are updated.

Thanks for your Help, the version is 7.2

ezlage

  • Guest
Re: Zquery (how to know the status after execsql)
« Reply #1 on: August 26, 2015, 07:51:40 pm »
Did you try this way?

Code: [Select]
ZQuery1.RowsAffected
« Last Edit: August 26, 2015, 07:54:22 pm by ezlage »

vcorp

  • Newbie
  • Posts: 4
  • Delphi and VC++ Coder
    • vcorp
Re: Zquery (how to know the status after execsql)
« Reply #2 on: August 26, 2015, 08:49:10 pm »
Oh looks what i'm looking for. Dunno why i have missed it before.
Will try to finish the code and i let you know if can be good enougth.

Really appreciate your help.

vcorp

  • Newbie
  • Posts: 4
  • Delphi and VC++ Coder
    • vcorp
Re: Zquery (how to know the status after execsql)
« Reply #3 on: August 27, 2015, 10:03:41 pm »
Yes with a little trick that value is what i'm looking for.
Thank you very much.

exdatis

  • Hero Member
  • *****
  • Posts: 668
    • exdatis

vcorp

  • Newbie
  • Posts: 4
  • Delphi and VC++ Coder
    • vcorp
Re: Zquery (how to know the status after execsql)
« Reply #5 on: August 28, 2015, 09:28:15 am »
My way is better just bcz in my update query i have NOW() element
this can return a 1 if a record exists and get updated (then i don't need to make the next query (insert of that update)
and return zero if no update is done (this is good bcz in this case i can do the INSERT query of that record).

A player can do the recovery job of a rally from my manage rmore than one time. Then using RowsAffected i'm sure to not create duplicate record.


 

TinyPortal © 2005-2018