Skip to content

Commit

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

- `WITH CONSISTENT SNAPSHOT` is not supported by MemSQL.
- `SHOW CREATE DATABASE` is not supported by MemSQL.
  • Loading branch information
dveeden committed Jul 14, 2021
1 parent ef07f40 commit 3eab559
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 "CREATE DATABASE `%s`", nil
}
return oneRow[1], nil
}
Expand Down Expand Up @@ -625,7 +626,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 3eab559

Please sign in to comment.