Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
Initial work to support MemSQL/SingleStore
Browse files Browse the repository at this point in the history
Issue: #309

- `WITH CONSISTENT SNAPSHOT` is not supported by MemSQL (same for
  Vitess).
- `SHOW CREATE DATABASE` is not supported by MemSQL.
  • Loading branch information
dveeden committed Jul 19, 2021
1 parent dc97ee9 commit ac633d4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions v4/export/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ func ShowCreateDatabase(db *sql.Conn, database string) (string, error) {
query := fmt.Sprintf("SHOW CREATE DATABASE `%s`", escapeString(database))
err := simpleQuery(db, query, handleOneRow)
if err != nil {
return "", errors.Annotatef(err, "sql: %s", query)
// return "", errors.Annotatef(err, "sql: %s", query)
return fmt.Sprintf("CREATE DATABASE `%s`", escapeString(database)), nil
}
return oneRow[1], nil
}
Expand Down Expand Up @@ -642,7 +643,11 @@ func createConnWithConsistency(ctx context.Context, db *sql.DB) (*sql.Conn, erro
query = "START TRANSACTION /*!40108 WITH CONSISTENT SNAPSHOT */"
_, err = conn.ExecContext(ctx, query)
if err != nil {
return nil, errors.Annotatef(err, "sql: %s", query)
query = "START TRANSACTION"
_, err = conn.ExecContext(ctx, query)
if err != nil {
return nil, errors.Annotatef(err, "sql: %s", query)
}
}
return conn, nil
}
Expand Down

0 comments on commit ac633d4

Please sign in to comment.