Ejemplo n.º 1
0
        private void ReadData(GFXDDataReader reader)
        {
            while (reader.Read())
            {
                StringBuilder row = new StringBuilder();
                try
                {
                    object[] data = new object[DbRandom.GetRandomTableColumnCount()];
                    int      ret  = DataReader.GetValues(data);

                    foreach (object o in data)
                    {
                        if (o == null)
                        {
                            Fail("GetValues() failed to retrieve the column values");
                        }
                        row.Append(o.ToString());
                        row.Append(", ");
                    }

                    Log(row.ToString());
                }
                catch (Exception e)
                {
                    Fail(e);
                }
            }
        }
Ejemplo n.º 2
0
        public override void Run(object context)
        {
            String tableName = null;

            object[] newVals;

            try
            {
                int colCount = DbRandom.GetRandomTableColumnCount();

                tableName = DbRandom.BuildRandomTable(10);
                //Connection.ReadOnly = false;

                // CHANGED Command.ReaderUpdatable = true;
                Command.ReaderLockForUpdate = true;

                Command.CommandText = String.Format(
                    "SELECT * FROM {0} ORDER BY COL_ID DESC FETCH FIRST 1 ROWS ONLY",
                    tableName);


                DataReader = Command.ExecuteReader();

                ReadData(DataReader);

                newVals    = DbRandom.GetRandomRowData().ToArray <object>();
                newVals[0] = 111111111;

                // CHANGED Command.ReaderUpdatable = true;

                while (DataReader.Read())
                {
                    // CHANGED DataReader.UpdateValues(newVals);
                    // CHANGED DataReader.UpdateRow();


                    //    for (int i = 0; i < colCount; i++)
                    //        DataReader.UpdateValue(i, newVals[i]);
                }

                //for (int i = 0; i < colCount; i++)
                //{
                //    //DataReader.UpdateValue(i, newVals[i]);

                //}



                DataReader = Command.ExecuteReader();
                ReadData(DataReader);



                //while (DataReader.Read())
                //{
                //    for (int i = 0; i < colCount; i++)
                //    {
                //        object data = DataReader.GetValue(i);
                //        if (DataReader.GetValue(i) != newVals[i])
                //        {
                //            Fail(String.Format("UpdateValues() failed to update column {0} value "
                //                + "Expected [{1}]; Actual [{2}]",
                //                i, newVals[i].ToString(), data.ToString()));
                //        }
                //    }
                //}
            }
            catch (Exception e)
            {
                Fail(e);
            }
            finally
            {
                try
                {
                    DbHelper.DropTable(tableName);
                }
                catch (Exception e)
                {
                    Fail(e);
                }

                base.Run(context);
            }
        }