on 2010 Oct 14 6:20 PM
For Version 11.0.1.2276 and all subsequent versions, unless a "behavior change" is documented, is it safe to assume that CONNECTION_PROPERTY ( 'Name' ) evaluated inside an event will always return the event name as defined by the CREATE EVENT statement?
I want to write the following...
if another invocation of this event is already running then quit this invocation of the event;
and I plan to query sa_conn_info() to do that.
The value of connection_property('Name',number) for an event will be the name of the event; however, there is nothing preventing a normal connection from using the same name. The value of connection_property('EventName',number) is also the name of the event, but will be NULL for non-event connections. If this is the only property you are going to be using, sa_conn_list() is a more efficient way to get a list of connections. sa_conn_list was added in version 10. To limit the number of instances of an event that are active, checking the value of event_parameter('NumActive') within the event is the simplest approach.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Breck: To make it even more "embarassing", there' s even a sample with NumActive in the docs, cf. http://dcx.sybase.com/index.html#1200en/dbadmin/defining-trigger-events.html. - Double-Yikes!!
It gets worse... not only have I not taken a course, or read the Help since Version 6, but apparently I don't even read this website: http://sqlanywhere-forum.sap.com/questions/958/event-parameternumactive
@Volker: At this point I may not be the right person to suggest the Help get changed, but the statement IF EVENT_PARAMETER( 'NumActive' ) = 1 THEN creeps me out because it is relying on an implicit data conversion... EVENT_PARAMETER returns VARCHAR. Such implicit conversions are not as well documented in SQL Anywhere as they are in, say PL/I (the Father Of All Implicit Type Conversions)... and even with PL/I wizened pros learned to be explicit about all such conversions.
@Breck: I would not expect anyone (well, except the doc team) to have read the help completely for current versions... I remember to have read the v5.5 docs (nearly) from page to page, but nowadays - that's way too much stuff, I guess. - Another question to come: "What is the most important SQL Anywhere feature you wish you had noticed when it was introduced and not n years later?"
User | Count |
---|---|
68 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.