1

I need to get time of script execution in my PHP code. On a database client I can use:

set statistics time on

And I would see messages like:

   W (1): Parse and Compile Time 0.
   W (2): Adaptive Server cpu time: 0 ms.
   W (3):  
   W (4): Execution Time 0.
   W (5): Adaptive Server cpu time: 0 ms.  Adaptive Server elapsed time: 0 ms.

I'm using odbc-driver to connect to Sybase and odbc_connect/odbc_exec to execute query. Can I get these messages in my PHP code? Or I should set time manually using declare @time_start etc.. or setting time in php code before and after query execution?

Daria
  • 861
  • 11
  • 29

1 Answers1

0

I don't know any way of getting the ASE execution timings back to PHP via the ODBC driver. I assume you are using PDO_ODBC driver in PHP. Have you tried using a different driver? Others may have such a feature implemented. Maybe the official Sybase PHP Extension Module can help you out here.

My recommendation is using some PHP snipped to keep track of the execution time as you already suggested. You can find a nice example in this Question here: How to get the execution time of a MySQL query from PHP?

Community
  • 1
  • 1
dom
  • 652
  • 1
  • 16
  • 35