CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 $object->DataSource->SQL for update, insert and delete

Print topic Send  topic

Author Message
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.
View profile  Send private message
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!!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.