Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 6 of 6 total |
Alter table feedback |
Tue, Dec 18 2012 2:56 AM | Permanent Link |
Petter Topp | Hi
I'm implementing functionality to upgrade tables using SQL, unattended - To do this I would like to log the status. How can I obtain status on a given SQL, IOW I would like to know how things went (Ok, Failed), how many records were affected, Errormessages, ... ? Br Petter |
Tue, Dec 18 2012 7:30 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Petter
>I'm implementing functionality to upgrade tables using SQL, unattended - To >do this I would like to log the status. >How can I obtain status on a given SQL, IOW I would like to know how things >went (Ok, Failed), how many records were affected, Errormessages, ... ? Disclaimer: I'm not uo to date with DBISAM - my version is only 4.25 so what I post may well be total gibberish. Wether you can achieve what you want will depend on how you choose to do it. If you want everything in SQL then I believe you're out of luck I'm assuming you're using a TDBISAMQuery and running it from within some Delphi code. If I'm correct then the best way to do it is to use try..except blocks. Psuedo code follows try try MakeChanges; Table.Open; AddToLog('Table altered ' + IntToStr(table.RecordCount)+ ' rows altered'); Table.Close; except Rollback; on E: EDataBaseError do begin AddToLog('Error: '+error message' + E.Message +' encountered'); end; end; except AddToLog('unable to lock table'); end; Roy Lambert [Team Elevate] |
Tue, Dec 18 2012 8:45 AM | Permanent Link |
Petter Topp | Hi Roy.
Yes, I was hoping to achieve this with only using SQL... (I'm extending my web-update to add an xml file with necessary info like tablename, messages and sql scripts, wich are handled on startup of the application) I have registered, that when using dbsys you get some feedback in the status bar when running SQL statements, this would also be available to me... Thanks for you code example - not sure how much more info I would need in order to handle/validate all variations ... Would this be different if I were to use ElevatedDB (One more reason to migrate)? Br Petter "Roy Lambert" skrev i nyhetsmeldingen: B0DA878A-CA64-453E-951C-C0FAE70E857A@news.elevatesoft.com ... Petter >I'm implementing functionality to upgrade tables using SQL, unattended - To >do this I would like to log the status. >How can I obtain status on a given SQL, IOW I would like to know how things >went (Ok, Failed), how many records were affected, Errormessages, ... ? Disclaimer: I'm not uo to date with DBISAM - my version is only 4.25 so what I post may well be total gibberish. Wether you can achieve what you want will depend on how you choose to do it. If you want everything in SQL then I believe you're out of luck I'm assuming you're using a TDBISAMQuery and running it from within some Delphi code. If I'm correct then the best way to do it is to use try..except blocks. Psuedo code follows try try MakeChanges; Table.Open; AddToLog('Table altered ' + IntToStr(table.RecordCount)+ ' rows altered'); Table.Close; except Rollback; on E: EDataBaseError do begin AddToLog('Error: '+error message' + E.Message +' encountered'); end; end; except AddToLog('unable to lock table'); end; Roy Lambert [Team Elevate] |
Tue, Dec 18 2012 10:19 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Petter
>Yes, I was hoping to achieve this with only using SQL... >(I'm extending my web-update to add an xml file with necessary info like >tablename, messages and sql scripts, wich are handled on startup of the >application) >I have registered, that when using dbsys you get some feedback in the status >bar when running SQL statements, this would also be available to me... >Thanks for you code example - not sure how much more info I would need in >order to handle/validate all variations ... That feedback is due to DBSys being a Delphi app <vbg> >Would this be different if I were to use ElevatedDB (One more reason to >migrate)? At least to some degree. ElevateDB SQL has its own programming language and does have an exception handling construct so that as a minimum you could log OK/FAIL. If OK you could get the recordcount (I think - without trying) but I'm not sure about the exception reasons. ElevateDB also has its own logging facility - I'm not sure just how much information is captured but it will certainly give you Fail with at leasat some of the fail reasons. Roy Lambert [Team Elevate] |
Tue, Dec 18 2012 12:26 PM | Permanent Link |
Petter Topp | Thanks Roy.
I will work some more on the concept and see what "I can live with".... Petter "Roy Lambert" skrev i nyhetsmeldingen: 866B1861-6A98-4C26-A284-0643077A4E81@news.elevatesoft.com ... Petter >Yes, I was hoping to achieve this with only using SQL... >(I'm extending my web-update to add an xml file with necessary info like >tablename, messages and sql scripts, wich are handled on startup of the >application) >I have registered, that when using dbsys you get some feedback in the >status >bar when running SQL statements, this would also be available to me... >Thanks for you code example - not sure how much more info I would need in >order to handle/validate all variations ... That feedback is due to DBSys being a Delphi app <vbg> >Would this be different if I were to use ElevatedDB (One more reason to >migrate)? At least to some degree. ElevateDB SQL has its own programming language and does have an exception handling construct so that as a minimum you could log OK/FAIL. If OK you could get the recordcount (I think - without trying) but I'm not sure about the exception reasons. ElevateDB also has its own logging facility - I'm not sure just how much information is captured but it will certainly give you Fail with at leasat some of the fail reasons. Roy Lambert [Team Elevate] |
Thu, Jan 10 2013 6:44 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Petter,
<< I'm implementing functionality to upgrade tables using SQL, unattended - To do this I would like to log the status.How can I obtain status on a given SQL, IOW I would like to know how things went (Ok, Failed), how many records were affected, Errormessages, ... ? >> You can trap progress/issues with individual statements in a script in DBISAM by using these events: http://www.elevatesoft.com/manual?action=viewevent&id=dbisam4&product=delphi&version=7&comp=TDBISAMQuery&event=BeforeExecute http://www.elevatesoft.com/manual?action=viewevent&id=dbisam4&product=delphi&version=7&comp=TDBISAMQuery&event=AfterExecute http://www.elevatesoft.com/manual?action=viewevent&id=dbisam4&product=delphi&version=7&comp=TDBISAMQuery&event=OnQueryError For table alterations, use these events to track progress and data loss events: http://www.elevatesoft.com/manual?action=viewevent&id=dbisam4&product=delphi&version=7&comp=TDBISAMQuery&event=OnAlterProgress http://www.elevatesoft.com/manual?action=viewevent&id=dbisam4&product=delphi&version=7&comp=TDBISAMQuery&event=OnDataLost If you have any other questions, please let me know. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |