Hi,

I'm trying to incorporate transfer into some legacy code, mainly with
a view to getting it to work on a variety of different db's (at this
stage Oracle and MySQL).

I was hoping to "mix" some transfer and plain SQL code - using the
transfer to insert a row and get the generated key back in a db
independent way, and then use plain SQL to update another table.

However I am getting some errors about nesting transactions.

Firstly is what I am trying to achieve possible, and secondly how can
I wrap both the Transfer and plain sql's in a single transaction?

The code in question is shown below.

Many thanks,
Andrew.

        <cffunction name="saveNewPageRevision" access="public"
returntype="void">
                <cfargument name="pageText" type="string" required="true">
                <cfargument name="pageTitle" type="string" required="true">
                <cfargument name="pageHeader" type="string" required="true">
                <cfargument name="pageKey" type="numeric" required="true">
                <cfargument name="editorId" type="numeric" required="true">
                <cfargument name="editorState" type="string" required="true">

                <!---
                        NB: Editor state is passed in as a security check 
because editors
are only allowed
                        to edit pages from their own state, unless they are the 
super-user
                --->

                <cfset var theInsertedId = "">

                <cftransaction>

                <cfscript>
                        newPage = 
variables.instance.transfer.new("Admin.CmsPageContent");
                        newPage.setPage_content_text(arguments.pageText);
                        newPage.setPage_title(arguments.pageTitle);
                        newPage.setPage_header(arguments.pageHeader);
                        newPage.setCms_page_key(arguments.pageKey);
                        newPage.setEditor_id(arguments.editorId);
                        variables.instance.transfer.save(newPage);
                </cfscript>

                <cfset theInsertedId = newPage.getPage_content_id>

                <!--- Now update cms_page to set the new value --->
                <cfquery name="qUpdateCmsPage" datasource="ds_web_content">
                        update cms_page
                        set     key_num_draft = <cfqueryparam 
cfsqltype="cf_sql_integer"
value="#theInsertedId#">
                        where key_num = <cfqueryparam cfsqltype="cf_sql_integer"
value="#arguments.pageKey#">
                        </cfif>
                </cfquery>

                </cftransaction>
        </cffunction>
--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to