Exemple #1
0
        /// <summary>
        /// Oracle批量插入,ODP特性
        /// </summary>
        private static void BatchInsertTest1()
        {
            var retVal = string.Empty;

            retVal = OracleOpt.BatchInsert(10000);
            Console.WriteLine("====================================");
            retVal = OracleOpt.BatchInsert(100000);
            Console.WriteLine("====================================");
            retVal = OracleOpt.BatchInsert(1000000);
            Console.WriteLine("====================================");
        }
Exemple #2
0
        private static void BatchInsertExec(int len)
        {
            int[]      vdeptno     = new int[len];
            string[]   vdeptname   = new string[len];
            string[]   vloc        = new string[len];
            DateTime[] vcreatetime = new DateTime[len];

            for (int i = 1; i <= len; i++)
            {
                vdeptno[i - 1]     = i;
                vdeptname[i - 1]   = i.ToString();
                vloc[i - 1]        = i.ToString();
                vcreatetime[i - 1] = DateTime.Now;
            }
            var dicData = new Dictionary <string, object>()
            {
                { "deptno", vdeptno },
                { "deptname", vdeptname },
                { "loc", vloc },
                { "createtime", vcreatetime }
            };

            OracleOpt.BatchInsert("dept", dicData, OracleOpt.GetConnectionString(), len);
        }