I notice that ISQL is able to get the results of running a PRINT command. With other databases you would use a combination of SQLGetDiagRec and SQLGetDiagField to retrieve this information from the database. This doesn't seem to be the case for SQL Anywhere. How do other tools like ISQL get the results of PRINT commands? Thanks |
I do not know how ISQL does handle this, but can use MESSAGE TO CLIENT statements in your SQL code and use a particular callback to receive those messages. I guess (though I'm not sure) it will display the contents of PRINT statements, too. Cf. my answer on your previous question on the similar topic. You may have a look at SA_REGISTER_MESSAGE_CALLBACK for that usage. Additionally, you can list the messages displayed on the server console with the sa_server_messages system procedure or the properties Message, MessageTime and MessageText combined with the according line number. AFAIK, this will however list ALL messages for all connections. As stated, I have used both techniques with MESSAGE statements but are not sure whether they work with PRINT, too. |
PRINT is the Transact-SQL variant of the MESSAGE statement. Both statements cause a message to be send over the wire to the client outside of the application-level protocol (ie ODBC). If the transport layer doesn't support handling the message, the message is instead displayed on the console window. |