void TestLong() { Select sel = Qb.Select("*") .From("tab") .Where(Cond.Equal("col", DateTime.Now.Ticks)); AnyDbFactory factory = new AnyDbFactory(new AnyDbSetting()); string sql = factory.GetSql(sel); Update upd = Qb.Update("tab") .Values( Value.New("col", DateTime.Now.Ticks) ); sql = factory.GetSql(upd); }
public void TestUpdate() { Update upd = Qb.Update("Customers") .Values( Value.New("LastName", "Pavlov") ) .Where(Cond.Equal("FirstName", "Pavel")); Renderer.SqlServerRenderer renderer = new Renderer.SqlServerRenderer(); string sql = renderer.RenderUpdate(upd); upd = Qb.Update("Customers", "rem") .Values( Value.New("LastName", "Pavlov") ) .Where(Cond.Equal("FirstName", "Pavel")); sql = renderer.RenderUpdate(upd); }
public void ExecuteAsyncTest() { using (AnyDbConnection con = _factory.OpenConnection()) { Insert ins = Qb.Insert("customer") .Values( Value.New("first_name", "123"), Value.New("last_name", "456") ); con.ExecuteAsync(ins).Wait(); Assert.Equal(101, GetAll(con).Count()); ins = Qb.Insert("customer") .Values( Value.New("first_name", "321"), Value.New("last_name", "654") ); con.ExecuteAsync(ins).Wait(); Assert.Equal(102, GetAll(con).Count()); Select sel_0 = Qb.Select("*").From("customer").Page(0, 200); sel_0 = sel_0.OrderBy("first_name"); var page = con.QueryAsync(sel_0).Result; Assert.Equal(102, page.Count()); Update upd = Qb.Update("customer") .Values( Value.New("first_name", "XXX") ); int res = con.ExecuteAsync(upd).Result; Assert.Equal(102, res); Select sel = Qb.Select("*") .From("customer"); IEnumerable <Customer> en = con.QueryAsync <Customer>(sel).Result; Assert.Equal(102, en.Count()); Delete del = Qb.Delete("customer"); res = con.ExecuteAsync(del).Result; Assert.Equal(102, res); } }