Chore: Add function for detecting if the SQL driver supported CTEs (#64441)

* Add interface method for detecting if the SQL driver supported CTEs

* Update nested folder store to call RecursiveQueriesAreSupported()
This commit is contained in:
Sofia Papagiannaki
2023-03-20 10:27:08 +02:00
committed by GitHub
parent fd6e97d52d
commit 4ee0be6fdf
4 changed files with 72 additions and 26 deletions

View File

@@ -20,6 +20,9 @@ type DB interface {
GetSqlxSession() *session.SessionDB
InTransaction(ctx context.Context, fn func(ctx context.Context) error) error
Quote(value string) string
// RecursiveQueriesAreSupported runs a dummy recursive query and it returns true
// if the query runs successfully or false if it fails with mysqlerr.ER_PARSE_ERROR error or any other error
RecursiveQueriesAreSupported() (bool, error)
}
type Session = sqlstore.DBSession

View File

@@ -51,6 +51,10 @@ func (f *FakeDB) Quote(value string) string {
return ""
}
func (f *FakeDB) RecursiveQueriesAreSupported() (bool, error) {
return false, nil
}
// TODO: service-specific methods not yet split out ; to be removed
func (f *FakeDB) UpdateTempUserWithEmailSent(ctx context.Context, cmd *tempuser.UpdateTempUserWithEmailSentCommand) error {
return f.ExpectedError