/// <exception cref="Java.Sql.SQLException"/>
 public OracleDataDrivenDBRecordReader(DBInputFormat.DBInputSplit split, Type inputClass
                                       , Configuration conf, Connection conn, DBConfiguration dbConfig, string cond, string
                                       [] fields, string table)
     : base(split, inputClass, conf, conn, dbConfig, cond, fields, table, "ORACLE")
 {
     // Must initialize the tz used by the connection for Oracle.
     OracleDBRecordReader.SetSessionTimeZone(conf, conn);
 }
Beispiel #2
0
        /// <summary>test generate sql script for OracleDBRecordReader.</summary>
        /// <exception cref="System.Exception"/>
        public virtual void TestOracleDBRecordReader()
        {
            DBInputFormat.DBInputSplit splitter = new DBInputFormat.DBInputSplit(1, 10);
            Configuration   configuration       = new Configuration();
            Connection      connect             = DriverForTest.GetConnection();
            DBConfiguration dbConfiguration     = new DBConfiguration(configuration);

            dbConfiguration.SetInputOrderBy("Order");
            string[] fields = new string[] { "f1", "f2" };
            OracleDBRecordReader <DBInputFormat.NullDBWritable> recorder = new OracleDBRecordReader
                                                                           <DBInputFormat.NullDBWritable>(splitter, typeof(DBInputFormat.NullDBWritable), configuration
                                                                                                          , connect, dbConfiguration, "condition", fields, "table");

            NUnit.Framework.Assert.AreEqual("SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( SELECT f1, f2 FROM table WHERE condition ORDER BY Order ) a WHERE rownum <= 10 ) WHERE dbif_rno > 1"
                                            , recorder.GetSelectQuery());
        }