vetIdentifiers checks all identifiers respect some rule so that we can use them safely in queries.
()
| 215 | // vetIdentifiers checks all identifiers respect some rule so that we can use |
| 216 | // them safely in queries. |
| 217 | func (c *SQLite) vetIdentifiers() error { |
| 218 | ids := map[string]string{ |
| 219 | "TableName": c.cfg.TableName, |
| 220 | "RecordBlobName": c.cfg.RecordBlobName, |
| 221 | } |
| 222 | |
| 223 | for _, f := range c.fieldNames { |
| 224 | ids["field "+f] = f |
| 225 | } |
| 226 | |
| 227 | for name, id := range ids { |
| 228 | if !isPrintable(id) { |
| 229 | return fmt.Errorf("%s contains non-printable characters", name) |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | return nil |
| 234 | } |
| 235 | |
| 236 | func (c *SQLite) Run(input <-chan baker.OutputRecord, upch chan<- string) error { |
| 237 | err := c.doRun(input) |