Obtaining the SQL Statement Generated From the Query

Set enableTrace in the client code to trace the SQL statement.

The SUPConnectionProfile (iOS) and ConnectionProfile (Android, BlackBerry, Windows Mobile) class includes APIs used to set tracing with or without payload:

To obtain the parameter bindings for the SQL statement, trace with payload set to true.

  1. Set the appropriate trace level in the application code by inserting small fragments of code to bracket the execution of the Query or SUPQuery.
    Note: SAP recommends that you do not enable tracing from SAP Control Center, as doing so negatively impacts performance, and creates a large trace file that makes it difficult to locate the SQL statement corresponding to the Query/SUPQuery.
  2. Use this code to turn on or off tracing of the SQL statement with payload in the trace file.
    • iOS:
         (void) enableTrace:(BOOL)enable
         (void) enableTrace:(BOOL)enable withPayLoad:(BOOL)withPayLoad
      
      SUPConnectionProfile *cp = [SMP101DB getConnectionProfile];
         // Enable SQL trace with payload of the query
            [cp enableTrace:YES withPayload:YES];
            QueryResultSet cursor = SMP101DB.executeQuery(query);
         // Disable SQL trace
            [cp enableTrace:NO];
    • Android, BlackBerry and Windows Mobile:
      ConnectionProfile cp = SMP101DB.getConnectionProfile();
      // Enable SQL trace with payload of the query
         cp.enableTrace(true, true);
         QueryResultSet cursor = SMP101DB.executeQuery(query);
      // Disable SQL trace
         cp.enableTrace(false, false);