public void TestFuncNullOutParams()
        {
            using (IDbConnection conn = new OraConnection())
            {
                conn.OpenConnection("chipanddale", "chipanddale", "xe");
                IDbMgr dbManager = new OraDBMgr(conn, _LogMgr);

                // function FuncNullOutParams (p_int32 out number, p_double out number, p_date out date, p_string out varchar2, p_clob out clob, p_blob out blob) return blob;
                IDbCommand command = new OraCommand("test_pkg.FuncNullOutParams");
                command.CommandType = System.Data.CommandType.StoredProcedure;

                OraParamString returnParam = new OraParamString("return", System.Data.ParameterDirection.ReturnValue, null);
                command.AddDBParam(returnParam);
                command.AddDBParam(new OraParamInt32("p_int32", System.Data.ParameterDirection.Output, null));
                command.AddDBParam(new OraParamDouble("p_double", System.Data.ParameterDirection.Output, null));
                command.AddDBParam(new OraParamDateTime("p_date", System.Data.ParameterDirection.Output, null));
                command.AddDBParam(new OraParamString("p_string", System.Data.ParameterDirection.Output, null, 2000));
                command.AddDBParam(new OraParamCLOB("p_clob", System.Data.ParameterDirection.Output, null));
                command.AddDBParam(new OraParamBLOB("p_blob", System.Data.ParameterDirection.Output, (byte[])null));

                using (DbTransaction transaction = new DbTransaction(dbManager))
                {
                    dbManager.Execute(command);
                    transaction.Success = true;
                }

                Debug.Assert(returnParam.ParamValue == null, "returnParam");
                Debug.Assert(command.Params["p_int32"].GetValue() == null, "p_int32");
                Debug.Assert(command.Params["p_double"].GetValue() == null, "p_double");
                Debug.Assert(command.Params["p_date"].GetValue() == null, "p_date");
                Debug.Assert(command.Params["p_string"].GetValue() == null, "p_string");
                Debug.Assert(command.Params["p_clob"].GetValue() == null, "p_clob");
                Debug.Assert(command.Params["p_blob"].GetValue() == null, "p_blob");
            }
        }
        public void TestFuncAll()
        {
            using (IDbConnection conn = new OraConnection())
            {
                conn.OpenConnection("chipanddale", "chipanddale", "xe");
                IDbMgr dbManager = new OraDBMgr(conn, _LogMgr);

                // function FuncAll(p_int32 in out number, p_double in out number, p_date in out date, p_string in out varchar2, p_clob in out clob, p_blob in out blob, p_cur out sys_refcursor, p_cur2 in out sys_refcursor) return varchar2;
                IDbCommand command = new OraCommand("test_pkg.FuncAll");
                command.CommandType = System.Data.CommandType.StoredProcedure;

                OraParamString returnParam = new OraParamString("return", System.Data.ParameterDirection.ReturnValue, null, 2000);
                command.AddDBParam(returnParam);
                command.AddDBParam(new OraParamInt32("p_int32", System.Data.ParameterDirection.InputOutput, null));
                command.AddDBParam(new OraParamDouble("p_double", System.Data.ParameterDirection.InputOutput, -1.234));
                command.AddDBParam(new OraParamDateTime("p_date", System.Data.ParameterDirection.InputOutput, DateTime.Now));
                command.AddDBParam(new OraParamString("p_string", System.Data.ParameterDirection.InputOutput, "INPUT ", 2000));
                command.AddDBParam(new OraParamCLOB("p_clob", System.Data.ParameterDirection.InputOutput, null));
                command.AddDBParam(new OraParamBLOB("p_blob", System.Data.ParameterDirection.InputOutput, (byte[])null));
                OraParamRefCursor refCur = new OraParamRefCursor("p_cur", System.Data.ParameterDirection.Output);
                command.AddDBParam(refCur);
                OraParamRefCursor refCur2 = new OraParamRefCursor("p_cur2", System.Data.ParameterDirection.InputOutput);
                command.AddDBParam(refCur2);

                using (DbTransaction transaction = new DbTransaction(dbManager))
                {
                    dbManager.Execute(command);
                    transaction.Success = true;
                }

                Debug.Assert(returnParam.ParamValue != null, "returnParam");
                Debug.Assert(command.Params["p_int32"].GetValue() != null, "p_int32");
                Debug.Assert(command.Params["p_double"].GetValue() != null, "p_double");
                Debug.Assert(command.Params["p_date"].GetValue() != null, "p_date");
                Debug.Assert(command.Params["p_string"].GetValue() != null, "p_string");
                Debug.Assert(command.Params["p_clob"].GetValue() != null, "p_clob");
                Debug.Assert(command.Params["p_blob"].GetValue() != null, "p_blob");

                Debug.Assert(refCur.ParamValue.Rows.Count != 0, "p_cur");
                Debug.Assert(refCur.ParamValue.Rows[0].ItemArray[0] != null, "p_cur[0][0]");
                Debug.Assert(refCur.ParamValue.Rows[0].ItemArray[1] != null, "p_cur[0][1]");
                Debug.Assert(refCur.ParamValue.Rows[0].ItemArray[2] != null, "p_cur[0][2]");
                Debug.Assert(refCur.ParamValue.Rows[0].ItemArray[3] != null, "p_cur[0][3]");

                Debug.Assert(refCur2.ParamValue.Rows.Count != 0, "p_cur2");
                Debug.Assert(refCur2.ParamValue.Rows[0].ItemArray[0] != null, "p_cur2[0][0]");
                Debug.Assert(refCur2.ParamValue.Rows[0].ItemArray[1] != null, "p_cur2[0][1]");
                Debug.Assert(refCur2.ParamValue.Rows[0].ItemArray[2] != null, "p_cur2[0][2]");
            }
        }
        public void TestMultiTread2()
        {
            Thread thread1 = new Thread(() =>
            {
                using (IDbConnection conn = new OraConnection())
                {
                    conn.OpenConnection("chipanddale", "chipanddale", "xe");
                    IDbMgr dbManager    = new OraDBMgr(conn, _LogMgr);
                    IDbCommand command  = new OraCommand("select * from all_objects");
                    command.CommandType = System.Data.CommandType.Text;

                    System.Data.DataTable tab = null;
                    for (int i = 0; i < 50; i++)
                    {
                        tab = dbManager.ExecuteSelect(command);
                    }
                }
            });

            Thread thread2 = new Thread(() =>
            {
                using (IDbConnection conn = new OraConnection())
                {
                    conn.OpenConnection("chipanddale", "chipanddale", "xe");
                    IDbMgr dbManager    = new OraDBMgr(conn, _LogMgr);
                    IDbCommand command  = new OraCommand("insert into  test_tab (int32, double, string, datetime) values (1, 1.2, '123', sysdate)");
                    command.CommandType = System.Data.CommandType.Text;

                    using (DbTransaction transaction = new DbTransaction(dbManager))
                    {
                        for (int i = 0; i < 1000; i++)
                        {
                            dbManager.Execute(command);
                        }
                        transaction.Success = true;
                    }
                }
            });

            Thread thread3 = new Thread(() =>
            {
                using (IDbConnection conn = new OraConnection())
                {
                    conn.OpenConnection("chipanddale", "chipanddale", "xe");
                    IDbMgr dbManager    = new OraDBMgr(conn, _LogMgr);
                    IDbCommand command  = new OraCommand("begin execute immediate 'create or replace view test_view as select 1 col_name from dual'; end;");
                    command.CommandType = System.Data.CommandType.Text;

                    for (int i = 0; i < 100; i++)
                    {
                        dbManager.Execute(command);
                    }
                }
            });

            Thread thread4 = new Thread(() =>
            {
                using (IDbConnection conn = new OraConnection())
                {
                    conn.OpenConnection("chipanddale", "chipanddale", "xe");
                    IDbMgr dbManager    = new OraDBMgr(conn, _LogMgr);
                    IDbCommand command  = new OraCommand("test_pkg.FuncAll");
                    command.CommandType = System.Data.CommandType.StoredProcedure;

                    for (int i = 0; i < 100; i++)
                    {
                        command.Params.Clear();
                        OraParamString returnParam = new OraParamString("return", System.Data.ParameterDirection.ReturnValue, null, 2000);
                        command.AddDBParam(returnParam);
                        command.AddDBParam(new OraParamInt32("p_int32", System.Data.ParameterDirection.InputOutput, null));
                        command.AddDBParam(new OraParamDouble("p_double", System.Data.ParameterDirection.InputOutput, -1.234));
                        command.AddDBParam(new OraParamDateTime("p_date", System.Data.ParameterDirection.InputOutput, DateTime.Now));
                        command.AddDBParam(new OraParamString("p_string", System.Data.ParameterDirection.InputOutput, "INPUT ", 2000));
                        command.AddDBParam(new OraParamCLOB("p_clob", System.Data.ParameterDirection.InputOutput, null));
                        command.AddDBParam(new OraParamBLOB("p_blob", System.Data.ParameterDirection.InputOutput, (byte[])null));
                        OraParamRefCursor refCur = new OraParamRefCursor("p_cur", System.Data.ParameterDirection.Output);
                        command.AddDBParam(refCur);
                        OraParamRefCursor refCur2 = new OraParamRefCursor("p_cur2", System.Data.ParameterDirection.InputOutput);
                        command.AddDBParam(refCur2);
                        using (DbTransaction transaction = new DbTransaction(dbManager))
                        {
                            dbManager.Execute(command);
                            dbManager.Execute(command);
                            transaction.Success = true;
                        }
                    }
                }
            });

            Thread thread5 = new Thread(() =>
            {
                using (IDbConnection conn = new OraConnection())
                {
                    conn.OpenConnection("chipanddale", "chipanddale", "xe");
                    IDbMgr dbManager    = new OraDBMgr(conn, _LogMgr);
                    IDbCommand command  = new OraCommand("insert into  test_tab (int32, double, string, datetime) values (1, 1.2, '123', sysdate)");
                    command.CommandType = System.Data.CommandType.Text;

                    using (DbTransaction transaction = new DbTransaction(dbManager))
                    {
                        for (int i = 0; i < 1000; i++)
                        {
                            dbManager.Execute(command);
                        }
                        transaction.Success = true;
                    }
                }
            });

            Thread thread6 = new Thread(() =>
            {
                using (IDbConnection conn = new OraConnection())
                {
                    conn.OpenConnection("chipanddale", "chipanddale", "xe");
                    IDbMgr dbManager    = new OraDBMgr(conn, _LogMgr);
                    IDbCommand command  = new OraCommand("insert into  test_tab (int32, double, string, datetime) values (1, 1.2, '123', sysdate)");
                    command.CommandType = System.Data.CommandType.Text;

                    for (int i = 0; i < 1000; i++)
                    {
                        using (DbTransaction transaction = new DbTransaction(dbManager))
                        {
                            dbManager.Execute(command);
                            transaction.Success = true;
                        }
                    }
                }
            });

            thread1.Start();
            thread2.Start();
            thread3.Start();
            thread4.Start();
            thread5.Start();
            thread6.Start();

            thread1.Join();
            thread2.Join();
            thread3.Join();
            thread4.Join();
            thread5.Join();
            thread6.Join();
        }