Hello, I have a PHP Api which executes various procedures in a Sql Anywhere 17 database. In some of the procedures "messages" are output via the "messsage" function. Is there a way to read these messages in PHP and display them in the frontend? I use the SqlAnywhere PHP extension. I have already tried to solve it via the system procedure "sa_server_messages()" but unfortunately it is not possible to recognize which connection/user triggered the message. P.s. I don't want to change the procedures with the messages because they are also used in a desktop application. asked 08 Jan, 08:47 tbr-baehren |
The procedure sa_server_messages only applies to messages written to the server console. It sounds like you want message ... to client. This is available in embedded SQL and ODBC requiring a message callback to be registered. For more information, see MESSAGE STATEMENT. answered 08 Jan, 11:58 Chris Keating Chris, I wonder whether the PHP API (which presumably is based on the SA C API, which offers the sqlany_register_callback() function) does support/offer those callbacks, too?
(09 Jan, 02:42)
Volker Barth
Based on the PHP driver source in %sqlany17%\SDK\PHP, I am not able to find any invocations of sqlany_register_callback in the PHP driver implementation.
(09 Jan, 09:42)
Chris Keating
Chris, so it is not possible to get these messages via PHP cause its not implemented in the driver right. Any ideas how i can provide those messages for users in a web application? Maybe i should add the message(s) as a result set to the procedure.
(12 Jan, 02:17)
tbr-baehren
Replies hidden
Well, technically the driver's source code is available in the SQL Anywhere installation (see Chris's comment), so in case you are familiar with C and PHP programming, you might be able to enhance the driver to add an according callback facility. My knowledge of PHP is rather limited, so I can't tell whether this is doable and how difficult this would be - AFAIK, PHP itself does support callback functions, and the underlying SQL Anywhere C API does provide that according sqlany_register_callback with type CALLBACK_MESSAGE, so there should be chances it will work. That being said, it is probably way easier to enhance your stored procedures with according result sets...
(12 Jan, 04:15)
Volker Barth
|