Announcement

Collapse
No announcement yet.

Challenge with Transactions

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Challenge with Transactions

    What could be causing an error like this:

    Error: Undefined property: setup_self_ini::$nm_bases_access
    in_array() expects parameter 2 to be array, null given

    My code is something like this within onValidate of a control app:

    try {
    sc_begin_trans();
    sc_exec_sql("INSERT INTO sec_users .....");

    sc_exec_sql("INSERT INTO staff ....");

    // log an insert
    $y = 'inserting';
    sc_exec_sql("INSERT INTO sc_log .....");
    sc_commit_trans();
    } catch (Exception $e) {
    sc_rollback_trans();
    sc_error_message("Unexpected error: $e");
    sc_error_exit();
    }
    }

    When I remove the transaction statements, it all works ok. Or is it the case onValidate section already works like transaction?

  • #2
    Not sure why this message as it is a php error, not a mysql error. IN control applications scriptcase will not automatically perform a commit as it will not automatically open a transaction. That only happens on form applications. So this looks like a bug to me.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Do the individual SQLs work OK? Check the first two.
      As originally structured - the exception that is caught is from the commit and the commit fails if ANY of the transactioned SQLs failed.
      If there is no transaction and the last SQL succeeds the exception block would not be executed.

      Comment


      • #4
        May be the same error?

        http://www.scriptcase.net/forum/show...ht=transaction

        jsb

        Comment


        • #5
          Originally posted by jsbinca View Post
          Yes jsbinca, thank you: it's the same error. From your response is it correct to say you have been suppressing the error message but the transaction functionality has been working as expected since Dec 16, 2013? That would be good enough for my purposes, pending any fix from Netmake.

          Comment


          • #6
            Yes, in my cases transaction worked as expected.

            jsb

            Comment


            • #7
              Originally posted by jsbinca View Post
              Yes, in my cases transaction worked as expected.

              jsb
              Thanks so much...works exactly as described.

              Comment

              Working...
              X