On Wed, Jan 2, 2013 at 7:48 PM, Mark Miesfeld <miesf...@gmail.com> wrote:

>
>
> On Wed, Jan 2, 2013 at 7:01 PM, Art Heimsoth <artst...@artheimsoth.com>wrote:
>
>> Perhaps, but I think autoCommit is the default with ooSQLite and
>> so far I have not found the syntax for Rollback or Commit to
>> try that - are they implemented in ooSQLite?
>
>
> Art,
>
> Yes COMMIT and ROLLBACK are implemented in ooSQLite.  (Actually there is
> nothing specific to implement.)
>

I guess I should have included this method from the same utility:

::method beginTransaction private
  expose dbConn

    sql = 'BEGIN;'
    ret = dbConn~exec(sql, .false)
    if ret \== dbConn~OK then do
      self~reportExecError(sql, .false)
      return .false
    end

    return .true


Then, here is some generic pseudo code that shows how I used it:

::method insertOriginalRecords private
  expose dbConn

  records = self~parseTabFile
  if records == .nil then do
    say "Failed to read and parse the" self~TAB_FILE 'file.'
    return .false
  end

  if \ *self~beginTransaction* then return .false

  do r over records
    sql = "INSERT ... ;"

    stmt = .ooSQLiteStmt~new(dbConn, sql)
    if stmt~initCode <> 0 then do
      self~reportStmtError( ...)
      *self~rollBackTransaction*
      return .false
    end

    ret = stmt~step
    if ret <> stmt~DONE then do
      self~reportStmtError(stmt, 'Insert failed.', sql)
      *self~rollBackTransaction*
    end

    stmt~finalize
  end

  *self~commitTransaction*
  return .true


--
Mark Miesfeld
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to