// isSingleColIdxNullRange checks if a range is [NULL, NULL] on a single-column index.
761866
func isSingleColIdxNullRange(idx *Index, ran *ranger.Range) bool {
	if len(idx.Info.Columns) > 1 {
		return false
	}
	l, h := ran.LowVal[0], ran.HighVal[0]
	if l.IsNull() && h.IsNull() {
		return true
	}
	return false
}
178726
func NewNullFieldDescriptor(nullable NullableColumn) FieldDescriptor {
	// A null field can be nullable ...
	return newFixedLengthFieldDescriptor(
		mysql_proto.FieldType_NULL,
		nullable,
		0,
		func(b []byte) interface{} { return nil })
}
509525
func withLexRange(members []string, min string, minIncl bool, max string, maxIncl bool) []string {
	if max == "-" || min == "+" {
		return nil
	}
	if min != "-" {
		if minIncl {
			for i, m := range members {
				if m >= min {
					members = members[i:]
					break
				}
			}
		} else {
			// Excluding min
			for i, m := range members {
				if m > min {
					members = members[i:]
					break
				}
			}
		}
	}
	if max != "+" {
		if maxIncl {
			for i, m := range members {
				if m > max {
					members = members[:i]
					break
				}
			}
		} else {
			// Excluding max
			for i, m := range members {
				if m >= max {
					members = members[:i]
					break
				}
			}
		}
	}
	return members
}
1035681
func FullIntRange(isUnsigned bool) []*Range {
	if isUnsigned {
		return []*Range{{LowVal: []types.Datum{types.NewUintDatum(0)}, HighVal: []types.Datum{types.NewUintDatum(math.MaxUint64)}}}
	}
	return []*Range{{LowVal: []types.Datum{types.NewIntDatum(math.MinInt64)}, HighVal: []types.Datum{types.NewIntDatum(math.MaxInt64)}}}
}
29533
func (t *Transaction) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error) {
	if t.dbmap.ExpandSliceArgs {
		expandSliceArgs(&query, args...)
	}

	return SelectNullFloat(t, query, args...)
}
482359
func (dec *Decoder) AddSQLNullBool(v *sql.NullBool) error {
	return dec.SQLNullBool(v)
}
634224
func IsNull(s Shape) bool {
	_, ok := s.(Null)
	return s == nil || ok
}
942189
func (v *Value) IsNull() bool {
	_, ret := v.Value.(*Value_Null)
	return ret
}
1306078
func (enc *Encoder) SQLNullInt64(v *sql.NullInt64) {
	enc.Int64(v.Int64)
}
61692
func (dec *Decoder) AddSQLNullString(v *sql.NullString) error {
	return dec.SQLNullString(v)
}
498441
func EnumRange(db XODB, v0 pgtypes.Anyenum, v1 pgtypes.Anyenum, v2 pgtypes.Anyenum) (pgtypes.Anyarray, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.enum_range($1, $2, $3)`

	// run query
	var ret pgtypes.Anyarray
	XOLog(sqlstr, v0, v1, v2)
	err = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)
	if err != nil {
		return pgtypes.Anyarray{}, err
	}

	return ret, nil
}
262389
func (enc *Encoder) SQLNullFloat64Key(key string, v *sql.NullFloat64) {
	enc.Float64Key(key, v.Float64)
}
35725
func (t *Transaction) SelectNullStr(query string, args ...interface{}) (sql.NullString, error) {
	if t.dbmap.ExpandSliceArgs {
		expandSliceArgs(&query, args...)
	}

	return SelectNullStr(t, query, args...)
}
873180
func (c *Column) CheckNotNull(data types.Datum) error {
	if mysql.HasNotNullFlag(c.Flag) && data.IsNull() {
		return errColumnCantNull.Gen("Column %s can't be null.", c.Name)
	}
	return nil
}
383715
func (enc *Encoder) SQLNullFloat64OmitEmpty(v *sql.NullFloat64) {
	if v != nil && v.Valid && v.Float64 != 0 {
		enc.Float64(v.Float64)
	}
}
206427
func FullNotNullRange() []*Range {
	return []*Range{{LowVal: []types.Datum{types.MinNotNullDatum()}, HighVal: []types.Datum{types.MaxValueDatum()}}}
}
196578
func (m *DbMap) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error) {
	if m.ExpandSliceArgs {
		expandSliceArgs(&query, args...)
	}

	return SelectNullFloat(m, query, args...)
}