on 2024 Jan 08 8:47 AM
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.
Request clarification before answering.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
so it is not possible to get these messages via PHP cause its not implemented in the driver right.
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...
User | Count |
---|---|
45 | |
9 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.