// SingularTable use singular table by default
17001
func (s *DB) SingularTable(enable bool) {
	s.parent.Lock()
	defer s.parent.Unlock()
	s.parent.singularTable = enable
}
856729
func (db *SQLDB) findTable(tableName string) (bool, error) {

	found := 0
	safeTable := safe(tableName)
	query := db.DBAdapter.FindTableQuery()

	db.Log.Info("msg", "FIND TABLE", "query", query, "value", safeTable)
	if err := db.DB.QueryRow(query, tableName).Scan(&found); err != nil {
		db.Log.Info("msg", "Error finding table", "err", err)
		return false, err
	}

	if found == 0 {
		db.Log.Warn("msg", "Table not found", "value", safeTable)
		return false, nil
	}

	return true, nil
}
877213
func (s *DB) Table(name string) *DB {
	clone := s.clone()
	clone.search.Table(name)
	clone.Value = nil
	return clone
}
996287
func (builder *TsDeleteRowCommandBuilder) WithTable(table string) *TsDeleteRowCommandBuilder {
	builder.protobuf.Table = []byte(table)
	return builder
}
549723
func newPrettyTable(separator string, cols ...Field) PrettyTable {
	return PrettyTable{
		cols:      cols,
		separator: separator,
	}
}
1234697
func UnmarshalTable(t *ast.Table, v interface{}) error {
	return DefaultConfig.UnmarshalTable(t, v)
}
202091
func (s *DB) HasTable(value interface{}) bool {
	var (
		scope     = s.NewScope(value)
		tableName string
	)

	if name, ok := value.(string); ok {
		tableName = name
	} else {
		tableName = scope.TableName()
	}

	has := scope.Dialect().HasTable(tableName)
	s.AddError(scope.db.Error)
	return has
}
8431
func (s *ProcessingStats) Table(w io.Writer) {
	titleVals := s.toVals()
	data := make([][]string, len(titleVals))
	for i, tv := range titleVals {
		data[i] = []string{tv.name, strconv.Itoa(int(tv.val))}
	}

	table := tablewriter.NewWriter(w)

	table.AppendBulk(data)
	table.SetHeader([]string{"", s.Name})
	table.SetBorder(false)
	table.Render()

}
545830
func Table(table string) *RegommendTable {
	mutex.RLock()
	t, ok := tables[table]
	mutex.RUnlock()

	if !ok {
		t = &RegommendTable{
			name:  table,
			items: make(map[interface{}]*RegommendItem),
		}

		mutex.Lock()
		tables[table] = t
		mutex.Unlock()
	}

	return t
}
1017755
func ColorTable(target uint32, internalformat uint32, width int32, format uint32, xtype uint32, table unsafe.Pointer) {
	C.glowColorTable(gpColorTable, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLsizei)(width), (C.GLenum)(format), (C.GLenum)(xtype), table)
}
1342295
func simpleMakeTable(poly uint32) *Table {
	t := new(Table)
	simplePopulateTable(poly, t)
	return t
}
922705
func RegisterTable(tableName, sql string,
	tableFromMeta func(autoid.Allocator, *model.TableInfo) (table.Table, error)) {
	perfSchemaTables = append(perfSchemaTables, sql)
	pluginTable[tableName] = tableFromMeta
}
379006
func (vc *vcursorImpl) FindTable(name sqlparser.TableName) (*vindexes.Table, string, topodatapb.TabletType, key.Destination, error) {
	destKeyspace, destTabletType, dest, err := vc.executor.ParseDestinationTarget(name.Qualifier.String())
	if err != nil {
		return nil, "", destTabletType, nil, err
	}
	if destKeyspace == "" {
		destKeyspace = vc.keyspace
	}
	table, err := vc.executor.VSchema().FindTable(destKeyspace, name.Name.String())
	if err != nil {
		return nil, "", destTabletType, nil, err
	}
	return table, destKeyspace, destTabletType, dest, err
}
649526
func TableFromInstance(object DomainObject) (*Table, error) {
	elem := reflect.TypeOf(object).Elem()

	t := &Table{
		StructName: elem.Name(),
		ColToField: map[string]string{},
		FieldToCol: map[string]string{},
		EntityDefinition: EntityDefinition{
			Columns: []*ColumnDefinition{},
			Indexes: map[string]*IndexDefinition{},
		},
	}
	for i := 0; i < elem.NumField(); i++ {
		structField := elem.Field(i)
		if len(structField.PkgPath) > 0 { // skip unexported fields
			continue
		}
		tag := strings.TrimSpace(structField.Tag.Get(dosaTagKey))
		if tag == "-" { // skip explicitly ignored fields
			continue
		}
		name := structField.Name
		if name == entityName {
			var err error
			if t.EntityDefinition.Name, t.TTL, t.ETL, t.Key, err = parseEntityTag(t.StructName, tag); err != nil {
				return nil, err
			}
		} else {
			// parse index fields
			if structField.Type == indexType {
				indexName, indexKey, err := parseIndexTag(structField.Name, tag)
				if err != nil {
					return nil, err
				}
				if _, exist := t.Indexes[indexName]; exist {
					return nil, errors.Errorf("index name is duplicated: %s", indexName)
				}
				t.Indexes[indexName] = &IndexDefinition{Key: indexKey}
			} else {
				cd, err := parseFieldTag(structField, tag)
				if err != nil {
					return nil, errors.Wrapf(err, "column %q had invalid type", name)
				}
				t.Columns = append(t.Columns, cd)
				t.ColToField[cd.Name] = name
				t.FieldToCol[name] = cd.Name
			}
		}
	}

	if t.Key == nil {
		return nil, errors.Errorf("cannot find dosa.Entity in object %s", t.StructName)
	}

	translateKeyName(t)

	if err := t.EnsureValid(); err != nil {
		return nil, errors.Wrap(err, "failed to parse dosa object")
	}

	return t, nil
}
389909
func (c *Cluster) SplitTable(mvccStore MVCCStore, tableID int64, count int) {
	tableStart := tablecodec.GenTableRecordPrefix(tableID)
	tableEnd := tableStart.PrefixNext()
	c.splitRange(mvccStore, NewMvccKey(tableStart), NewMvccKey(tableEnd), count)
}
490707
func TailTables(g Grouping, n int) Grouping {
	return headTailTables(g, n, true)
}
651447
func (session *Session) Table(tableNameOrBean interface{}) *Session {
	session.statement.Table(tableNameOrBean)
	return session
}