示例#1
0
        public void SelectAllFromElastic()
        {
            ConnectEngine engine = new ConnectEngine();

            engine.AddConector(this.config);

            var results = engine.Run("SELECT * FROM [elastic].[]");
        }
示例#2
0
        public void FromCsv()
        {
            var csvConnector = new CsvConnector(new CsvConnectorConfig {
                Alias = "csv"
            });
            var connectEngine = new ConnectEngine();

            connectEngine.AddConector(csvConnector);
            var results = connectEngine.Run("select * from csv.fromFile('employees.csv')").Cast <object>().ToList();

            Assert.IsTrue(results.Count == 8);
        }
示例#3
0
        public void Select_From_Sqlite()
        {
            ConnectEngine connectEngine = new ConnectEngine();

            connectEngine.AddConector(new SqliteConnectorConfig {
                Alias = "chinook", Database = "chinook.db"
            });
            var table = connectEngine.Run("SELECT EmployeeId, Email FROM chinook.employees");

            Assert.AreEqual(8, table.Count);
            Assert.AreEqual((Int64)1, table[0][0]);
            Assert.AreEqual("*****@*****.**", table[0][1]);
            Assert.AreEqual((Int64)2, table[1][0]);
            Assert.AreEqual("*****@*****.**", table[1][1]);
        }
示例#4
0
        public void Select_From_Csv()
        {
            ConnectEngine connectEngine = new ConnectEngine();

            connectEngine.AddConector(new CsvConnectorConfig {
                Alias = "csv"
            });
            var table = connectEngine.Run("SELECT id,email FROM csv.fromFile('employees.csv')");

            Assert.AreEqual(8, table.Count);
            Assert.AreEqual("27", table[0][0]);
            Assert.AreEqual("*****@*****.**", table[0][1]);
            Assert.AreEqual("175", table[1][0]);
            Assert.AreEqual("*****@*****.**", table[1][1]);
        }
        public void Select_From_Sqlite()
        {
            ConnectEngine connectEngine = new ConnectEngine();

            connectEngine.AddConector(new SqliteConnectorConfig {
                Alias = "chinook", Database = "chinook.db"
            });
            var result   = connectEngine.Run("SELECT EmployeeId, Email FROM chinook.employees").Cast <object>().ToList();
            var itemType = result[0].GetType();

            Assert.AreEqual(8, result.Count);
            Assert.AreEqual(1, result[0].GetValue <int>("EmployeeId"));
            Assert.AreEqual("*****@*****.**", result[0].GetValue <string>("Email"));
            Assert.AreEqual(2, result[1].GetValue <int>("EmployeeId"));
            Assert.AreEqual("*****@*****.**", result[1].GetValue <string>("Email"));
        }
        public void Select_From_Csv()
        {
            ConnectEngine connectEngine = new ConnectEngine();

            connectEngine.AddConector(new CsvConnectorConfig {
                Alias = "csv"
            });
            var result   = connectEngine.Run("SELECT id,email FROM csv.fromFile('employees.csv')").Cast <object>().ToList();
            var itemType = result[0].GetType();

            Assert.AreEqual(8, result.Count);
            Assert.AreEqual("27", result[0].GetValue <string>("id"));
            Assert.AreEqual("*****@*****.**", result[0].GetValue <string>("email"));
            Assert.AreEqual("175", result[1].GetValue <string>("id"));
            Assert.AreEqual("*****@*****.**", result[1].GetValue <string>("email"));
        }
示例#7
0
        public void Select_From_Csv_Join_Sqlite()
        {
            ConnectEngine connectEngine = new ConnectEngine();

            connectEngine.AddConector(new CsvConnectorConfig {
                Alias = "csv"
            });
            connectEngine.AddConector(new SqliteConnectorConfig {
                Alias = "chinook", Database = "chinook.db"
            });
            var table = connectEngine.Run(@"
                SELECT e2.EmployeeId, e1.last_name FROM csv.fromFile('employees.csv') e1
                INNER JOIN chinook.employees e2 ON e2.Email = e1.email
                ");

            Assert.AreEqual(8, table.Count);
            Assert.AreEqual((Int64)1, table[0][0]);
            Assert.AreEqual("Adams", table[0][1]);
            Assert.AreEqual((Int64)2, table[1][0]);
            Assert.AreEqual("Edwards", table[1][1]);
        }
        public void Select_From_Csv_Join_Sqlite()
        {
            ConnectEngine connectEngine = new ConnectEngine();

            connectEngine.AddConector(new CsvConnectorConfig {
                Alias = "csv"
            });
            connectEngine.AddConector(new SqliteConnectorConfig {
                Alias = "chinook", Database = "chinook.db"
            });
            var result   = connectEngine.Run(@"
                SELECT e2.EmployeeId, e1.last_name FROM csv.fromFile('employees.csv') e1
                INNER JOIN chinook.employees e2 ON e1.Email = e2.email
                ").Cast <object>().ToList();
            var itemType = result[0].GetType();

            Assert.AreEqual(8, result.Count);
            Assert.AreEqual(1, result[0].GetValue <int>("e2.EmployeeId"));
            Assert.AreEqual("Adams", result[0].GetValue <string>("e1.last_name"));
            Assert.AreEqual(2, result[1].GetValue <int>("e2.EmployeeId"));
            Assert.AreEqual("Edwards", result[1].GetValue <string>("e1.last_name"));
        }