本文整理汇总了Golang中github.com/pingcap/tidb/rset/rsets.Recordset.Rows方法的典型用法代码示例。如果您正苦于以下问题:Golang Recordset.Rows方法的具体用法?Golang Recordset.Rows怎么用?Golang Recordset.Rows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pingcap/tidb/rset/rsets.Recordset
的用法示例。
在下文中一共展示了Recordset.Rows方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestShowCollation
func (p *testShowSuit) TestShowCollation(c *C) {
pln := &plans.ShowPlan{}
pln.Target = stmt.ShowCollation
fls := pln.GetFields()
c.Assert(fls, HasLen, 6)
c.Assert(fls[2].Col.Tp, Equals, mysql.TypeLonglong)
pln.Pattern = &expression.PatternLike{
Pattern: &expression.Value{
Val: "utf8%",
},
}
rset := rsets.Recordset{
Ctx: p.ctx,
Plan: pln,
}
rows, err := rset.Rows(-1, 0)
c.Assert(err, IsNil)
c.Assert(len(rows), Greater, 0)
pln.Close()
pln.Pattern = nil
tblWhere := []struct {
Key string
Value interface{}
}{
{"Collation", "utf8_bin"},
{"Charset", "utf8"},
{"Id", 83},
{"Default", "Yes"},
{"Compiled", "Yes"},
{"Sortlen", 1},
}
for _, w := range tblWhere {
pln.Where = &expression.BinaryOperation{
L: &expression.Ident{CIStr: model.NewCIStr(w.Key)},
R: expression.Value{Val: w.Value},
Op: opcode.EQ,
}
row, err := rset.FirstRow()
c.Assert(err, IsNil)
c.Assert(row, HasLen, 6)
pln.Close()
}
}
示例2: TestRowStackFromPlan
func (s *testOuterQuerySuite) TestRowStackFromPlan(c *C) {
var data = []*testRowData{
{1, []interface{}{10, "hello"}},
}
pln := &testTablePlan{data, []string{"id", "name"}, 0}
p := &plans.RowStackFromPlan{
Src: pln,
}
fields := p.GetFields()
c.Assert(fields, HasLen, 2)
rset := rsets.Recordset{
Plan: p,
Ctx: mock.NewContext()}
_, err := rset.Rows(-1, 0)
c.Assert(err, IsNil)
}