Example #1
0
        protected DbConnection OpenNewConnection(string param, bool noServerString,
                                                 Dictionary <string, string> props)
        {
            DbConnection conn = CreateConnection(m_defaultDriverType, param,
                                                 noServerString);
            GFXDConnection gfxdConn = conn as GFXDConnection;

            if (gfxdConn != null)
            {
                gfxdConn.Open(props);
            }
            else
            {
                conn.Open();
            }
            return(conn);
        }
        public override void Run(Object context)
        {
            String tableName = null;
            int    numRows   = 10;

            try
            {
                tableName = DbRandom.BuildRandomTable(numRows);

                GFXDConnection conn = Connection.Clone();

                conn.Open();

                GFXDCommand cmd = conn.CreateCommand();
                cmd.CommandText = "SELECT * FROM " + tableName;

                DataTable       dt   = new DataTable();
                GFXDDataAdapter adpt = cmd.CreateDataAdapter();
                adpt.Fill(dt);

                if (dt.Rows.Count != numRows)
                {
                    Fail("Failed to create table new table on cloned connection");
                }

                DbHelper.ExecuteNonQueryStatement((GFXDClientConnection)conn, "DELETE FROM " + tableName);

                dt.Clear();
                adpt.Fill(dt);
                if (dt.Rows.Count != 0)
                {
                    Fail("Failed to delete all table record on a cloned connection");
                }
            }
            catch (Exception e)
            {
            }
            finally
            {
                DbHelper.DropTable(tableName);
                base.Run(context);
            }
        }