mamboBROWN
Posts: 1713
|
Posted: 07/17/2006, 11:21 AM |
|
Is it possible to get the CCS generated code for any of these events(UPDATE, INSERT and DELETE)?? I would like to be able to store it in a table?? I have searched the forums and I already know that it is possible with the Before Execute Select.
|
|
|
mamboBROWN
Posts: 1713
|
Posted: 07/18/2006, 8:35 AM |
|
I was given the answer from support. A big thanks goes out to Helen D. from support.
Here is the solution that was given to me:
Quote :
Edwin,
CCS 3 utilizes special function CCBuildSQL() which builds sql query. So to print queries passed to database please use the following code
Before Execute Select event
echo $Container->DataSource->OptimizeSQL(CCBuildSQL($Container->DataSource->SQL, $Container->DataSource->Where, $Container->DataSource->Order));
But to print insert, update, delete queries use simpler way.
Before Execute Insert/Update/Delete events
echo $Container->DataSource->SQL;
Regards,
Helen
NOTE: the generated CCS SQL uses single quotes (for text fields) so if you want to put the generated SQL in a text field be careful how uou create your statement. Here is the code that I used:
$db = new clsDBConnection1();
$qry = $Container->DataSource->;
$SQL = 'INSERT INTO tracking(user_id,user_action_id,trk_after_change)'.
'VALUES ('.CCGetSession('UserID').',2,"'.$qry.'")';
$db->query($SQL);
$db->close;
THE DOUBLE QUOTES ARE BOLD!!
|
|
|
|
|
|
|
|