private void Prepare()
        {
            Session.EnsureNotDisposed();
            driver.EnsureConnectionIsOpen(Session, connection);
            foreach (var script in initializationSqlScripts)
            {
                using (var command = connection.CreateCommand(script)) {
                    driver.ExecuteNonQuery(Session, command);
                }
            }

            initializationSqlScripts.Clear();
            if (pendingTransaction == null)
            {
                return;
            }

            var transaction = pendingTransaction;

            pendingTransaction = null;
            if (connection.ActiveTransaction == null)
            {
                // Handle external transactions
                driver.BeginTransaction(Session, connection, IsolationLevelConverter.Convert(transaction.IsolationLevel));
            }
        }
Beispiel #2
0
 public int ExecuteNonQuery(ISqlCompileUnit statement)
 {
     EnsureConnectionIsOpen();
     using (var command = connection.CreateCommand(Compile(statement)))
         return(driver.ExecuteNonQuery(session, command));
 }