Пример #1
0
 public UtlConnection(UtlConnection connection) : this(connection.ConnectionString)
 {
     if (connection.State == ConnectionState.Open)
     {
         this.Open();
     }
 }
Пример #2
0
 public UtlConnectionProxy(UtlConnectionOptions connectionOptions, UtlConnection owner)
 {
     this.ConnectionOptions = connectionOptions;
     this.Owner             = owner;
     this.Created           = DateTime.UtcNow.Ticks;
     this.IsPooled          = false;
 }
Пример #3
0
 public UtlConnectionProxy(ISessionInterface sessionProxy, UtlConnectionOptions connectionOptions, UtlConnection owner)
 {
     this.SessionProxy      = sessionProxy;
     this.ConnectionOptions = connectionOptions;
     this.Owner             = owner;
     this.Created           = DateTime.UtcNow.Ticks;
     this.IsPooled          = false;
 }
Пример #4
0
 public void BeginTransaction(UtlConnection connection, System.Data.IsolationLevel isolationLevel, bool readOnly)
 {
     this.Conn            = connection;
     this._isolationLevel = isolationLevel;
     this._readOnly       = readOnly;
     this.IsValid(true);
     this._oldAutoCommit  = this.Conn.AutoCommit;
     this.Conn.AutoCommit = false;
     this.SetTransactionCharacteristics();
 }
Пример #5
0
        private static string BuildStoredProcedureSql(string spName, UtlConnection connection)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("CALL ").Append(spName).Append("( ");
            string schema = null;

            BreakName2SchemaSP(spName, ref schema, ref spName);
            if (spName.StartsWith("\"") && spName.EndsWith("\""))
            {
                spName = spName.Substring(1, spName.Length - 2);
            }
            if (((schema != null) && schema.StartsWith("\"")) && schema.EndsWith("\""))
            {
                schema = schema.Substring(1, schema.Length - 2);
            }
            string[] restrictionValues = new string[3];
            restrictionValues[1] = schema;
            restrictionValues[2] = spName;
            DataTable table = connection.GetSchema("PROCEDUREPARAMETERS", restrictionValues);

            if (table.Rows.Count == 0)
            {
                string[] textArray2 = new string[3];
                textArray2[1] = schema;
                textArray2[2] = spName;
                if (connection.GetSchema("PROCEDURES", textArray2).Rows.Count == 0)
                {
                    string[] textArray3 = new string[3];
                    textArray3[1] = schema;
                    textArray3[2] = spName.ToUpper();
                    table         = connection.GetSchema("PROCEDUREPARAMETERS", textArray3);
                }
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                string str2 = (string)table.Rows[i]["COLUMN_NAME"];
                if (str2.StartsWith("@"))
                {
                    builder.Append(str2);
                }
                else
                {
                    builder.Append("@").Append(str2);
                }
                if (i != (table.Rows.Count - 1))
                {
                    builder.Append(" , ");
                }
            }
            builder.Append(" );");
            return(builder.ToString());
        }
Пример #6
0
 public override void Close()
 {
     if ((this.State != ConnectionState.Closed) && (this.InnerConnection != null))
     {
         if (this.InnerConnection.IsEnlisted)
         {
             UtlConnection connection = new UtlConnection {
                 InnerConnection = this.InnerConnection
             };
             connection.InnerConnection.Owner = connection;
             connection.ConnectionString      = this.ConnectionString;
             connection._connectionOptions    = this._connectionOptions;
             connection.Version          = this.Version;
             connection._connectionState = this._connectionState;
             connection.InnerConnection.Enlistment.DbTransaction.Conn = connection;
             connection.InnerConnection.Enlistment.DisposeConnection  = true;
             this.InnerConnection = null;
         }
         try
         {
             if (this.InnerConnection != null)
             {
                 lock (this.InnerConnection)
                 {
                     this.InnerConnection.DisposeTransaction();
                     this.InnerConnection.Owner = null;
                     if (this._connectionOptions.Pooling)
                     {
                         UtlConnectionPool.Add(this._connectionString, this.InnerConnection, this._poolVersion);
                     }
                     else
                     {
                         this.InnerConnection.Dispose();
                     }
                 }
             }
             this.InnerConnection = null;
         }
         catch (Exception)
         {
         }
         finally
         {
             this.OnStateChange(ConnectionState.Closed);
         }
     }
 }
Пример #7
0
        public override void Commit()
        {
            this.IsValid(true);
            UtlConnection conn = Interlocked.Exchange <UtlConnection>(ref this.Conn, null);

            try
            {
                conn.InnerConnection.SessionProxy.Commit(true);
            }
            catch (CoreException exception1)
            {
                UtlException.ThrowError(exception1);
            }
            finally
            {
                this.RestoreAutoCommit(conn);
            }
            this.IsCompleted = true;
        }
Пример #8
0
        public void IssueRollback()
        {
            UtlConnection conn = Interlocked.Exchange <UtlConnection>(ref this.Conn, null);

            if (conn != null)
            {
                try
                {
                    conn.InnerConnection.SessionProxy.Rollback(true);
                }
                catch (CoreException exception1)
                {
                    UtlException.ThrowError(exception1);
                }
                finally
                {
                    this.RestoreAutoCommit(conn);
                }
            }
        }
Пример #9
0
 public UtlCommand(string commandText, UtlConnection connection, UtlTransaction transaction)
 {
     this._commandTimeout      = 30;
     this._commandType         = System.Data.CommandType.Text;
     this._parameterCollection = new UtlParameterCollection(this);
     this._designTimeVisible   = true;
     this._updateRowSource     = UpdateRowSource.None;
     if (commandText != null)
     {
         this.CommandText = commandText;
     }
     if (connection != null)
     {
         this.DbConnection = connection;
     }
     if (transaction != null)
     {
         this.Transaction = transaction;
     }
     this.FetchGeneratedResults = false;
 }
Пример #10
0
 public void Close()
 {
     if (!this._isClrSpConnection && (this.SessionProxy != null))
     {
         try
         {
             this.SessionProxy.Close();
         }
         catch (Exception)
         {
         }
         finally
         {
             this.SessionProxy      = null;
             this.Owner             = null;
             this.IsPooled          = false;
             this.Created           = 0L;
             this.ConnectionOptions = null;
         }
     }
 }
Пример #11
0
        public UtlDataAdapter(string commandText, string connectionString)
        {
            UtlConnection connection = new UtlConnection(connectionString);

            this.SelectCommand = new UtlCommand(commandText, connection);
        }
Пример #12
0
 public UtlDataAdapter(string commandText, UtlConnection connection)
 {
     this.SelectCommand = new UtlCommand(commandText, connection);
 }
Пример #13
0
 public UtlTransaction(UtlConnection connection, System.Data.IsolationLevel isolationLevel, bool readOnly)
 {
     this.BeginTransaction(connection, isolationLevel, readOnly);
 }
Пример #14
0
 private void RestoreAutoCommit(UtlConnection conn)
 {
     conn.AutoCommit = this._oldAutoCommit;
 }
Пример #15
0
 public static void ClearPool(UtlConnection connection)
 {
     UtlConnectionPool.ClearPool(connection.ConnectionString);
 }
Пример #16
0
 public UtlMetaData(UtlConnection cnn)
 {
     this._cnn = cnn;
 }
Пример #17
0
 public UtlCommand(string commandText, UtlConnection connection) : this(commandText, connection, null)
 {
 }
Пример #18
0
 public UtlCommand(UtlConnection connection) : this(null, connection, null)
 {
 }