![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I know the connection number, and I'd like to query the database to get the last SQL Statement submitted (whether it be correct or not). I'm trying to just log any errors in my program. Meaning, I have a general error handler in my program. If the SQL Statement fails, I'd like to write it to a log for future client support when they call. Is there a way for me to get the last issues SQL Statement for the current (My Application) connection so I can log it to a file for future review? -Robert |
#3
| |||
| |||
|
|
Hello, I know the connection number, and I'd like to query the database to get the last SQL Statement submitted (whether it be correct or not). I'm trying to just log any errors in my program. Meaning, I have a general error handler in my program. If the SQL Statement fails, I'd like to write it to a log for future client support when they call. Is there a way for me to get the last issues SQL Statement for the current (My Application) connection so I can log it to a file for future review? -Robert |
#4
| |||
| |||
|
|
Look in the help index under "remember_last_statement". Glenn "Robert Paresi" <FirstInitialLastName (AT) innquest (DOT) com> wrote in news:444d2d8b@forums-2-dub: Hello, I know the connection number, and I'd like to query the database to get the last SQL Statement submitted (whether it be correct or not). I'm trying to just log any errors in my program. Meaning, I have a general error handler in my program. If the SQL Statement fails, I'd like to write it to a log for future client support when they call. Is there a way for me to get the last issues SQL Statement for the current (My Application) connection so I can log it to a file for future review? -Robert -- Glenn Paulley Research and Development Manager, Query Processing iAnywhere Solutions Engineering EBF's and Patches: http://downloads.sybase.com choose SQL Anywhere Studio >> change 'time frame' to all To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm SQL Anywhere Studio Supported Platforms and Support Status http://my.sybase.com/detail?id=1002288 |
#5
| |||
| |||
|
|
Glenn, That does not work for me! The current active connection needs to be responsible for recording this! What happens is the last statement ends up being SA_CONNECT_ACTIVITY so you can't get this information for the active/current connection in my program. I am hoping Sybase would change the system so that a reference to itself (SA_CONNECT_ACTIVITY) doesn't record SA_CONNECT_ACTIVITY but the previous statement before that. Otherwise, this is useless to me. :-( -Robert "Glenn Paulley" <paulley (AT) ianywhere (DOT) com> wrote in message news:Xns97AFA6F076FF1paulleyianywherecom (AT) 10 (DOT) 22.241.106... Look in the help index under "remember_last_statement". Glenn "Robert Paresi" <FirstInitialLastName (AT) innquest (DOT) com> wrote in news:444d2d8b@forums-2-dub: Hello, I know the connection number, and I'd like to query the database to get the last SQL Statement submitted (whether it be correct or not). I'm trying to just log any errors in my program. Meaning, I have a general error handler in my program. If the SQL Statement fails, I'd like to write it to a log for future client support when they call. Is there a way for me to get the last issues SQL Statement for the current (My Application) connection so I can log it to a file for future review? -Robert -- Glenn Paulley Research and Development Manager, Query Processing iAnywhere Solutions Engineering EBF's and Patches: http://downloads.sybase.com choose SQL Anywhere Studio >> change 'time frame' to all To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm SQL Anywhere Studio Supported Platforms and Support Status http://my.sybase.com/detail?id=1002288 |
#6
| |||
| |||
|
|
Glenn, That does not work for me! The current active connection needs to be responsible for recording this! What happens is the last statement ends up being SA_CONNECT_ACTIVITY so you can't get this information for the active/current connection in my program. I am hoping Sybase would change the system so that a reference to itself (SA_CONNECT_ACTIVITY) doesn't record SA_CONNECT_ACTIVITY but the previous statement before that. Otherwise, this is useless to me. :-( -Robert "Glenn Paulley" <paulley (AT) ianywhere (DOT) com> wrote in message news:Xns97AFA6F076FF1paulleyianywherecom (AT) 10 (DOT) 22.241.106... Look in the help index under "remember_last_statement". Glenn "Robert Paresi" <FirstInitialLastName (AT) innquest (DOT) com> wrote in news:444d2d8b@forums-2-dub: Hello, I know the connection number, and I'd like to query the database to get the last SQL Statement submitted (whether it be correct or not). I'm trying to just log any errors in my program. Meaning, I have a general error handler in my program. If the SQL Statement fails, I'd like to write it to a log for future client support when they call. Is there a way for me to get the last issues SQL Statement for the current (My Application) connection so I can log it to a file for future review? -Robert -- Glenn Paulley Research and Development Manager, Query Processing iAnywhere Solutions Engineering EBF's and Patches: http://downloads.sybase.com choose SQL Anywhere Studio >> change 'time frame' to all To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm SQL Anywhere Studio Supported Platforms and Support Status http://my.sybase.com/detail?id=1002288 |
#7
| |||
| |||
|
|
Glenn, That does not work for me! The current active connection needs to be responsible for recording this! What happens is the last statement ends up being SA_CONNECT_ACTIVITY so you can't get this information for the active/current connection in my program. I am hoping Sybase would change the system so that a reference to itself (SA_CONNECT_ACTIVITY) doesn't record SA_CONNECT_ACTIVITY but the previous statement before that. Otherwise, this is useless to me. :-( -Robert "Glenn Paulley" <paulley (AT) ianywhere (DOT) com> wrote in message news:Xns97AFA6F076FF1paulleyianywherecom (AT) 10 (DOT) 22.241.106... Look in the help index under "remember_last_statement". Glenn "Robert Paresi" <FirstInitialLastName (AT) innquest (DOT) com> wrote in news:444d2d8b@forums-2-dub: Hello, I know the connection number, and I'd like to query the database to get the last SQL Statement submitted (whether it be correct or not). I'm trying to just log any errors in my program. Meaning, I have a general error handler in my program. If the SQL Statement fails, I'd like to write it to a log for future client support when they call. Is there a way for me to get the last issues SQL Statement for the current (My Application) connection so I can log it to a file for future review? -Robert -- Glenn Paulley Research and Development Manager, Query Processing iAnywhere Solutions Engineering EBF's and Patches: http://downloads.sybase.com choose SQL Anywhere Studio >> change 'time frame' to all To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm SQL Anywhere Studio Supported Platforms and Support Status http://my.sybase.com/detail?id=1002288 |
#8
| |||
| |||
|
|
I see your problem, but we update the last statement before we parse it, and even if we did only conditionally update the last statement based on what the statement was, that may cause other users problems. I have two suggestions: 1) in your application, before each SQL statement, update a variable with the SQL statement text so your error handler will know what statement failed. or 2) when you connect, determine the connection number (select connection_property( 'number' )). Then if your error handler is called, make a new connection, and on this new connection do select connection_property( 'LastStatement', <conn_number> ). Since you are using a different connection, the last statement text will not be replaced when you attempt to retrieve it. -- Ian McHardy (iAnywhere Solutions) Please reply only to the newsgroup. Whitepapers, TechDocs, bug fixes are all available through the iAnywhere Developer Community at http://www.ianywhere.com/developer "Robert Paresi" <FirstInitialLastName (AT) innquest (DOT) com> wrote in message news:444d498d$1 (AT) forums-1-dub (DOT) .. Glenn, That does not work for me! The current active connection needs to be responsible for recording this! What happens is the last statement ends up being SA_CONNECT_ACTIVITY so you can't get this information for the active/current connection in my program. I am hoping Sybase would change the system so that a reference to itself (SA_CONNECT_ACTIVITY) doesn't record SA_CONNECT_ACTIVITY but the previous statement before that. Otherwise, this is useless to me. :-( -Robert "Glenn Paulley" <paulley (AT) ianywhere (DOT) com> wrote in message news:Xns97AFA6F076FF1paulleyianywherecom (AT) 10 (DOT) 22.241.106... Look in the help index under "remember_last_statement". Glenn "Robert Paresi" <FirstInitialLastName (AT) innquest (DOT) com> wrote in news:444d2d8b@forums-2-dub: Hello, I know the connection number, and I'd like to query the database to get the last SQL Statement submitted (whether it be correct or not). I'm trying to just log any errors in my program. Meaning, I have a general error handler in my program. If the SQL Statement fails, I'd like to write it to a log for future client support when they call. Is there a way for me to get the last issues SQL Statement for the current (My Application) connection so I can log it to a file for future review? -Robert -- Glenn Paulley Research and Development Manager, Query Processing iAnywhere Solutions Engineering EBF's and Patches: http://downloads.sybase.com choose SQL Anywhere Studio >> change 'time frame' to all To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm SQL Anywhere Studio Supported Platforms and Support Status http://my.sybase.com/detail?id=1002288 |
#9
| |||
| |||
|
|
I have 17 DLL's and probably 10,000 SQL statements in the application. The application has 100's and 100's of functions. #1 would take me months. |
#10
| |||
| |||
|
|
Robert Paresi wrote: I have 17 DLL's and probably 10,000 SQL statements in the application. The application has 100's and 100's of functions. #1 would take me months. I still don't completely understand why it is you are trying to do what you are. I personally don't know of any database app that does this at the level you are talking about (capture the last statement just before an abnormal disconnect?) greg.fenton -- Greg Fenton Consultant, Solution Services, iAnywhere Solutions -------- Visit the iAnywhere Solutions Developer Community Whitepapers, TechDocs, Downloads http://www.ianywhere.com/developer/ |
![]() |
| Thread Tools | |
| Display Modes | |
| |