ShowCreateTable constructs the create table SQL for a specified table returns (createTableSQL, error)
(tctx *tcontext.Context, db *BaseConn, database, table string)
| 87 | // ShowCreateTable constructs the create table SQL for a specified table |
| 88 | // returns (createTableSQL, error) |
| 89 | func ShowCreateTable(tctx *tcontext.Context, db *BaseConn, database, table string) (string, error) { |
| 90 | var oneRow [2]string |
| 91 | handleOneRow := func(rows *sql.Rows) error { |
| 92 | return rows.Scan(&oneRow[0], &oneRow[1]) |
| 93 | } |
| 94 | query := fmt.Sprintf("SHOW CREATE TABLE `%s`.`%s`", escapeString(database), escapeString(table)) |
| 95 | err := db.QuerySQL(tctx, handleOneRow, func() { |
| 96 | oneRow[0], oneRow[1] = "", "" |
| 97 | }, query) |
| 98 | if err != nil { |
| 99 | return "", err |
| 100 | } |
| 101 | return oneRow[1], nil |
| 102 | } |
| 103 | |
| 104 | // ShowCreatePlacementPolicy constructs the create policy SQL for a specified table |
| 105 | // returns (createPolicySQL, error) |
no test coverage detected