cabrera
Posts: 10
|
| Posted: 04/27/2009, 5:12 PM |
|
I am doing a custom insert for a form post in code charge via a store procedure, the store procedure inserts the code in db if the record doesn't exist, or sends back a message if it does, here's how it works:
CreateCategory( .. my arguments here ..)
BEGIN
SET @status = "";
IF
EXISTS(SELECT * FROM Main_Category WHERE Main_Category.Title = Argument_Title)
THEN
SET @status = "Record already exist";
SELECT @status;
ELSE
INSERT INTO Main_Category ( ... my insert here ... );
SET @status = "Record inserted";
SELECT @status;
END IF;
The code seems to work, I get the insert ok in the DB in the right circumstances, but does anybody know how could I get a hold of the "SELECT @status" return in the CodeCharge environment once the procedure is executed?
I suspect this is done in the After Execute Insert, but I can't find any examples of this posted.
|
 |
 |
cabrera
Posts: 10
|
| Posted: 04/28/2009, 11:01 AM |
|
Ok, thanks for the overwhelming feedback 
Just kidding....
I know this is probably not common to use store procedures instead of sql statements, and expecting codecharge to be able to act differently based on the return of the store procedure. Certainly not the default behavior of this tool.
Hopefully a more common question now: has anybody use the "Stored Procedure Support" feature for the more expensive version of CodeCharge?
I am using the cheapest, Personal Version, and although I can call store procedures from there, not sure if it is worth taking a look at the more expensive version for this. If you have some experience with that, please let me know what you think, thank you!
|
 |
 |
datadoit
|
| Posted: 04/28/2009, 1:10 PM |
|
No solution for your problem, but I feel confident in saying that your
version of CCS has nothing to do with what you're looking for.
Possible solution: Rather than sending back @STATUS, can you update
something like a log table, then in the AfterExecuteInsert/whatever
event query the log file for the result?
|
|
|
 |
cabrera
Posts: 10
|
| Posted: 04/29/2009, 9:19 AM |
|
Thanks datadoit,
You are right, I got the same response from their support service, the only thing the more expensive product does is to add IDE controls to store procedure calls, but doesn't resolve this problem.
My workaround was to set the custom insert to a dummy query that doesn't do anything: "SELECT 1;" and in the Before Insert event I manually call the store procedure that does the insert, get the return value from it, and control the response with PHP. Simmilar to what you propose, but without the extra flag on DB.
|
 |
 |
|