Ejemplo n.º 1
0
        public void TestGetSqlConnectionStrings()
        {
            string connstr = loadxml.GetSqlConnectionStrings();

            Assert.AreEqual(
                "Initial Catalog=DW_iSecureCloud_Empty;Data Source=192.168.1.128;User Id=sa;Password=861004", connstr);
        }
Ejemplo n.º 2
0
        public void TestGetSqlConnectionStrings()
        {
            string connstr = loadxml.GetSqlConnectionStrings();

            Assert.AreEqual(
                @"FSUSDB\FSUSDataValueDB.db3", connstr);
        }
        public void TestHasMoreData()
        {
            DbDacDataProvider           p    = new DbDacDataProvider();
            Dictionary <string, string> args = new Dictionary <string, string>();

            args.Add("sqlitedbcongxml", this.path);
            p.Init_Sqlite(args);
            // 5.
            // var cs = connstr.Split(',');
            LoadDbConfigXml lc = new LoadDbConfigXml(this.path);

            string[] sonstr = lc.GetSqlConnectionStrings("/config/databases");

            ISqlHelper sqlHelper = SqlHelperFactory.Create(DbType.SQLite, sonstr[0]);

            sqlHelper.Query("update D_OriginalWindData set lastSyncTime = null");

            Assert.IsTrue(p.HasMoreData());
            Console.WriteLine("TotalReminder: {0} records.", p.Remainder);
            Assert.IsTrue(p.Remainder > 0);

            int len = 0;

            TranMsg[] msgs = p.NextPackages(out len);
            Assert.IsNotNull(msgs);
            byte[] buff = msgs[0].Data;
            Console.WriteLine(ValueHelper.BytesToHexStr(buff, 0, len, ""));
            // Record 4.
            Assert.IsTrue(len > 0);

            // Data Sent
            p.OnPackageSent();

            var ds =
                sqlHelper.Query("select count(ID) from D_OriginalWindData where lastSyncTime is null");

            Assert.AreEqual(0, Convert.ToInt32(ds.Tables[0].Rows[0][0]));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 统一采集软件
        /// </summary>
        /// <param name="args"></param>
        public void Init_Sqlite(Dictionary <string, string> args)
        {
            if (_initialized)
            {
                return;
            }
            _initialized = true;
            string dbMapFile = args["sqlitedbcongxml"];

            Log.DebugFormat("Loading mapping from {0}", dbMapFile);
            var ldcx = new LoadDbConfigXml(dbMapFile);

            string[] connStrs = ldcx.GetSqlConnectionStrings("/config/databases");
            if (connStrs == null || connStrs.Length == 0)
            {
                return;
            }

            sqlHelper = SqlHelperFactory.Create(DbType.SQLite, connStrs[0]);
            //DbAccessorHelper.Init(new SQLiteDbAccessor(connStrs[0]));
            DataSourseTableInfo[] tableInfos = ldcx.GetDataSourseTableInfo("/config/databases");
            this.DoUpdateAsNecessary_Sqlite(tableInfos);
        }