// Rows return sql.Rows compatible Rows obj, as a forward Iterator object for iterating record by record, bean's non-empty fields
// are conditions.
162304
func (engine *Engine) Rows(bean interface{}) (*Rows, error) {
	session := engine.NewSession()
	return session.Rows(bean)
}
204177
func (m *Matrix) Row(row int) Vector {
	_, cols := m.Size()
	values := make([]float64, cols)
	for col := 0; col < cols; col++ {
		values[col] = m.Get(row, col)
	}
	return Vector(values)
}
568234
func (session *Session) SQL(query interface{}, args ...interface{}) *Session {
	session.Statement.SQL(query, args...)
	return session
}
848638
func (nuageTable *NuageTable) ReadRows(ovs *libovsdb.OvsdbClient, readRowArgs ReadRowArgs) ([]map[string]interface{}, error) {

	condition := readRowArgs.Condition
	columns := readRowArgs.Columns

	glog.V(2).Infof("Reading rows from table %s with condition (%+v)", nuageTable.TableName, condition)

	var selectOp libovsdb.Operation

	if len(condition) == 3 {

		ovsdbCondition := libovsdb.NewCondition(condition[0], condition[1], condition[2])

		if columns == nil {
			selectOp = libovsdb.Operation{
				Op:    "select",
				Table: nuageTable.TableName,
				Where: []interface{}{ovsdbCondition},
			}
		} else {
			selectOp = libovsdb.Operation{
				Op:      "select",
				Table:   nuageTable.TableName,
				Where:   []interface{}{ovsdbCondition},
				Columns: columns,
			}
		}
	} else {
		if columns == nil {
			selectOp = libovsdb.Operation{
				Op:    "select",
				Table: nuageTable.TableName,
				Where: []interface{}{},
			}
		} else {
			selectOp = libovsdb.Operation{
				Op:      "select",
				Table:   nuageTable.TableName,
				Columns: columns,
				Where:   []interface{}{},
			}
		}
	}

	operations := []libovsdb.Operation{selectOp}
	reply, err := ovs.Transact(OvsDBName, operations...)

	glog.V(2).Infof("reply : (%+v) err : (%+v)", reply, err)

	if err != nil || len(reply) != 1 || reply[0].Error != "" {
		glog.Errorf("Problem reading row from the Nuage table %s %v %+v", nuageTable.TableName, err, reply)
		return nil, fmt.Errorf("Problem reading row from the Nuage table %s %v",
			nuageTable.TableName, err)
	}

	return reply[0].Rows, nil
}
813009
func (q *Query) Rows() (rows *Rows, err error) {
	err = q.LastError
	q.LastError = nil
	if err != nil {
		return
	}

	var params []interface{}
	params, err = replacePlaceholders(q.placeholders, q.params)
	if err != nil {
		return
	}

	defer q.log(time.Now(), false)

	var rr *sql.Rows
	if q.ctx == nil {
		if q.stmt == nil {
			rr, err = q.executor.Query(q.rawSQL, params...)
		} else {
			rr, err = q.stmt.Query(params...)
		}
	} else {
		if q.stmt == nil {
			rr, err = q.executor.QueryContext(q.ctx, q.rawSQL, params...)
		} else {
			rr, err = q.stmt.QueryContext(q.ctx, params...)
		}
	}
	rows = &Rows{rr, q.FieldMapper}
	return
}
679816
func (m Mat2x3) Rows() (row0, row1 Vec3) {
	return m.Row(0), m.Row(1)
}
776578
func (rows *Rows) Values() ([]interface{}, error) {
	if rows.closed {
		return nil, errors.New("rows is closed")
	}

	values := make([]interface{}, 0, len(rows.fields))

	for range rows.fields {
		buf, fd, _ := rows.nextColumn()

		if buf == nil {
			values = append(values, nil)
			continue
		}

		if dt, ok := rows.conn.ConnInfo.DataTypeForOID(fd.DataType); ok {
			value := reflect.New(reflect.ValueOf(dt.Value).Elem().Type()).Interface().(pgtype.Value)

			switch fd.FormatCode {
			case TextFormatCode:
				decoder := value.(pgtype.TextDecoder)
				if decoder == nil {
					decoder = &pgtype.GenericText{}
				}
				err := decoder.DecodeText(rows.conn.ConnInfo, buf)
				if err != nil {
					rows.fatal(err)
				}
				values = append(values, decoder.(pgtype.Value).Get())
			case BinaryFormatCode:
				decoder := value.(pgtype.BinaryDecoder)
				if decoder == nil {
					decoder = &pgtype.GenericBinary{}
				}
				err := decoder.DecodeBinary(rows.conn.ConnInfo, buf)
				if err != nil {
					rows.fatal(err)
				}
				values = append(values, value.Get())
			default:
				rows.fatal(errors.New("Unknown format code"))
			}
		} else {
			rows.fatal(errors.New("Unknown type"))
		}

		if rows.Err() != nil {
			return nil, rows.Err()
		}
	}

	return values, rows.Err()
}
249703
func (it *infoschemaTable) Row(ctx sessionctx.Context, h int64) ([]types.Datum, error) {
	return nil, table.ErrUnsupportedOp
}
1254825
func Rows(v interface{}, r RowsScanner) (outerr error) {
	return rows(v, r, false)
}
1028441
func (p *humanReadable) Row(args ...interface{}) {
	for i, arg := range args {
		if i > 0 {
			fmt.Fprint(p, "\t")
		}
		switch a := arg.(type) {
		case common.State:
			fmt.Fprint(p, a.Name())
		default:
			fmt.Fprint(p, arg)
		}
	}
	fmt.Fprint(p, "\n")
}
962758
func (t *tableCommon) Row(ctx sessionctx.Context, h int64) ([]types.Datum, error) {
	r, err := t.RowWithCols(ctx, h, t.Cols())
	if err != nil {
		return nil, err
	}
	return r, nil
}
1261841
func (c *Conn) Query(sql string, args ...interface{}) (*Rows, error) {
	return c.QueryEx(context.Background(), sql, nil, args...)
}
997051
func (rows *Rows) Close() error {
	if rows.session.IsAutoClose {
		defer rows.session.Close()
	}

	if rows.lastError == nil {
		if rows.rows != nil {
			rows.lastError = rows.rows.Close()
			if rows.lastError != nil {
				defer rows.stmt.Close()
				return rows.lastError
			}
		}
		if rows.stmt != nil {
			rows.lastError = rows.stmt.Close()
		}
	} else {
		if rows.stmt != nil {
			defer rows.stmt.Close()
		}
		if rows.rows != nil {
			defer rows.rows.Close()
		}
	}
	return rows.lastError
}
751590
func (sc *StatementContext) RecordRows() uint64 {
	sc.mu.Lock()
	rows := sc.mu.records
	sc.mu.Unlock()
	return rows
}
205214
func (qzs *queryzRow) RowsPQ() string {
	val := float64(qzs.Rows) / float64(qzs.Count)
	return fmt.Sprintf("%.6f", val)
}
1104938
func (s *DB) Row() *sql.Row {
	return s.NewScope(s.Value).row()
}
1021288
func (rows *Rows) Next() bool {
	if rows.closed {
		return false
	}

	rows.rowCount++
	rows.columnIdx = 0

	for {
		msg, err := rows.conn.rxMsg()
		if err != nil {
			rows.fatal(err)
			return false
		}

		switch msg := msg.(type) {
		case *pgproto3.RowDescription:
			rows.fields = rows.conn.rxRowDescription(msg)
			for i := range rows.fields {
				if dt, ok := rows.conn.ConnInfo.DataTypeForOID(rows.fields[i].DataType); ok {
					rows.fields[i].DataTypeName = dt.Name
					rows.fields[i].FormatCode = TextFormatCode
				} else {
					fd := rows.fields[i]
					rows.fatal(errors.Errorf("unknown oid: %d, name: %s", fd.DataType, fd.Name))
					return false
				}
			}
		case *pgproto3.DataRow:
			if len(msg.Values) != len(rows.fields) {
				rows.fatal(ProtocolError(fmt.Sprintf("Row description field count (%v) and data row field count (%v) do not match", len(rows.fields), len(msg.Values))))
				return false
			}

			rows.values = msg.Values
			return true
		case *pgproto3.CommandComplete:
			if rows.batch != nil {
				rows.batch.pendingCommandComplete = false
			}
			rows.Close()
			return false

		default:
			err = rows.conn.processContextFreeMsg(msg)
			if err != nil {
				rows.fatal(err)
				return false
			}
		}
	}
}