Skip to content

Commit

Permalink
add table_schema filter to metadata loader sql (arana-db#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mulavar authored May 9, 2022
1 parent 37b71ec commit 19f8375
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/proto/schema_manager/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ import (
)

const (
orderByOrdinalPosition = " ORDER BY ORDINAL_POSITION"
// TODO add table schema filter
tableMetadataNoOrder = "SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, COLUMN_KEY, EXTRA, COLLATION_NAME, ORDINAL_POSITION FROM information_schema.columns WHERE"
orderByOrdinalPosition = " ORDER BY ORDINAL_POSITION"
tableMetadataNoOrder = "SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, COLUMN_KEY, EXTRA, COLLATION_NAME, ORDINAL_POSITION FROM information_schema.columns WHERE TABLE_SCHEMA=database()"
tableMetadataSQL = tableMetadataNoOrder + orderByOrdinalPosition
tableMetadataSQLInTables = tableMetadataNoOrder + " TABLE_NAME IN (%s)" + orderByOrdinalPosition
indexMetadataSQL = "SELECT TABLE_NAME, INDEX_NAME FROM information_schema.statistics WHERE TABLE_NAME IN (%s)"
tableMetadataSQLInTables = tableMetadataNoOrder + " AND TABLE_NAME IN (%s)" + orderByOrdinalPosition
indexMetadataSQL = "SELECT TABLE_NAME, INDEX_NAME FROM information_schema.statistics WHERE TABLE_SCHEMA=database() AND TABLE_NAME IN (%s)"
)

type SimpleSchemaLoader struct{}
Expand Down

0 comments on commit 19f8375

Please sign in to comment.