|
|
@ -35,12 +35,12 @@ func (e *SQLEngine) executeDescribeStatement(ctx context.Context, tableName stri |
|
|
|
sqlType := e.convertMQTypeToSQL(field.Type) |
|
|
|
|
|
|
|
result.Rows[i] = []sqltypes.Value{ |
|
|
|
sqltypes.NewVarChar(field.Name), // Field
|
|
|
|
sqltypes.NewVarChar(sqlType), // Type
|
|
|
|
sqltypes.NewVarChar("YES"), // Null (assume nullable)
|
|
|
|
sqltypes.NewVarChar(""), // Key (no keys for now)
|
|
|
|
sqltypes.NewVarChar("NULL"), // Default
|
|
|
|
sqltypes.NewVarChar(""), // Extra
|
|
|
|
sqltypes.NewVarChar(field.Name), // Field
|
|
|
|
sqltypes.NewVarChar(sqlType), // Type
|
|
|
|
sqltypes.NewVarChar("YES"), // Null (assume nullable)
|
|
|
|
sqltypes.NewVarChar(""), // Key (no keys for now)
|
|
|
|
sqltypes.NewVarChar("NULL"), // Default
|
|
|
|
sqltypes.NewVarChar(""), // Extra
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -53,8 +53,16 @@ func (e *SQLEngine) executeShowStatementWithDescribe(ctx context.Context, stmt * |
|
|
|
case "DATABASES": |
|
|
|
return e.showDatabases(ctx) |
|
|
|
case "TABLES": |
|
|
|
// TODO: Parse FROM clause properly for database specification
|
|
|
|
return e.showTables(ctx, "") |
|
|
|
// Parse FROM clause for database specification, or use current database context
|
|
|
|
database := "" |
|
|
|
if stmt.OnTable.Name.String() != "" { |
|
|
|
// SHOW TABLES FROM database_name
|
|
|
|
database = stmt.OnTable.Name.String() |
|
|
|
} else { |
|
|
|
// Use current database context
|
|
|
|
database = e.catalog.GetCurrentDatabase() |
|
|
|
} |
|
|
|
return e.showTables(ctx, database) |
|
|
|
case "COLUMNS": |
|
|
|
// SHOW COLUMNS FROM table is equivalent to DESCRIBE
|
|
|
|
if stmt.OnTable.Name.String() != "" { |
|
|
|