(style PlaceholderStyle)
| 15 | ) |
| 16 | |
| 17 | func tableColumnsQuery(style PlaceholderStyle) (string, error) { |
| 18 | switch style { |
| 19 | case PlaceholderQuestion: |
| 20 | return ` |
| 21 | SELECT COLUMN_NAME |
| 22 | FROM information_schema.COLUMNS |
| 23 | WHERE TABLE_SCHEMA = ? |
| 24 | AND TABLE_NAME = ?`, nil |
| 25 | case PlaceholderDollar: |
| 26 | return ` |
| 27 | SELECT COLUMN_NAME |
| 28 | FROM information_schema.COLUMNS |
| 29 | WHERE TABLE_SCHEMA = $1 |
| 30 | AND TABLE_NAME = $2`, nil |
| 31 | default: |
| 32 | return "", fmt.Errorf("unsupported placeholder style: %d", style) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | // FetchTableColumns returns the set of column names for schema.table. |
| 37 | // If transform is non-nil, it is applied to each column name before insertion. |
searching dependent graphs…