// Sequences from selected catalog (or all, if empty), matching schemas and names
Sequences from selected catalog (or all, if empty), matching schemas and names
// Sequences from selected catalog ( or all if empty ) matching schemas and names
func (s InformationSchema) Sequences(f metadata.Filter) (*metadata.SequenceSet, error) {
	if !s.hasSequences {
		return nil, metadata.ErrNotSupported
	}
	columns := []string{
		"sequence_catalog",
		"sequence_schema",
		"sequence_name",
		"data_type",
		"start_value",
		"minimum_value",
		"maximum_value",
		s.clauses[SequenceColumnsIncrement],
		"cycle_option",
	}
	qstr := "SELECT\n  " + strings.Join(columns, ",\n  ") + " FROM information_schema.sequences\n"
	conds, vals := s.conditions(1, f, formats{
		catalog:    "sequence_catalog LIKE %s",
		schema:     "sequence_schema LIKE %s",
		notSchemas: "sequence_schema NOT IN (%s)",
		name:       "sequence_name LIKE %s",
	})
	rows, closeRows, err := s.query(qstr, conds, "sequence_catalog, sequence_schema, sequence_name", vals...)
	if err != nil {
		if err == sql.ErrNoRows {
			return metadata.NewSequenceSet([]metadata.Sequence{}), nil
		}
		return nil, err
	}
	defer closeRows()
	results := []metadata.Sequence{}
	for rows.Next() {
		rec := metadata.Sequence{}
		err = rows.Scan(&rec.Catalog, &rec.Schema, &rec.Name, &rec.DataType, &rec.Start, &rec.Min, &rec.Max, &rec.Increment, &rec.Cycles)
		if err != nil {
			return nil, err
		}
		results = append(results, rec)
	}
	if rows.Err() != nil {
		return nil, rows.Err()
	}
	return metadata.NewSequenceSet(results), nil
}
func ( s InformationSchema ) Sequences ( f metadata . Filter ) ( * metadata . SequenceSet , error ) { if ! s . hasSequences { return nil , metadata . ErrNotSupported } columns := [ ] string { " " , " " , " " , " " , " " , " " , " " , s . clauses [ SequenceColumnsIncrement ] , " " , } qstr := " \n " + strings . Join ( columns , " \n " ) + " \n " conds , vals := s . conditions ( 1 , f , formats { catalog : " " , schema : " " , notSchemas : " " , name : " " , } ) rows , closeRows , err := s . query ( qstr , conds , " " , vals ... ) if err != nil { if err == sql . ErrNoRows { return metadata . NewSequenceSet ( [ ] metadata . Sequence { } ) , nil } return nil , err } defer closeRows ( ) results := [ ] metadata . Sequence { } for rows . Next ( ) { rec := metadata . Sequence { } err = rows . Scan ( & rec . Catalog , & rec . Schema , & rec . Name , & rec . DataType , & rec . Start , & rec . Min , & rec . Max , & rec . Increment , & rec . Cycles ) if err != nil { return nil , err } results = append ( results , rec ) } if rows . Err ( ) != nil { return nil , rows . Err ( ) } return metadata . NewSequenceSet ( results ) , nil }
Sequences from selected catalog (or all, if empty), matching schemas and names
Sequences from selected catalog ( or all if empty ) matching schemas and names