oracle: Fix quotes on DropTableSQL function, add IsSequenceExist function. (#2265)
- Fixed quotes on drop table SQL statement. - Implemented IsSequenceExists function for oracle dialect. Reviewed-on: https://gitea.com/xorm/xorm/pulls/2265 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Martin Viggiano <martinvigg@gmail.com> Co-committed-by: Martin Viggiano <martinvigg@gmail.com>
This commit is contained in:
parent
23be940bad
commit
e6907e9a62
|
@ -609,7 +609,7 @@ func (db *oracle) IsReserved(name string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *oracle) DropTableSQL(tableName string) (string, bool) {
|
func (db *oracle) DropTableSQL(tableName string) (string, bool) {
|
||||||
return fmt.Sprintf("DROP TABLE `%s`", tableName), false
|
return fmt.Sprintf("DROP TABLE \"%s\"", tableName), false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *oracle) CreateTableSQL(ctx context.Context, queryer core.Queryer, table *schemas.Table, tableName string) (string, bool, error) {
|
func (db *oracle) CreateTableSQL(ctx context.Context, queryer core.Queryer, table *schemas.Table, tableName string) (string, bool, error) {
|
||||||
|
@ -645,6 +645,10 @@ func (db *oracle) CreateTableSQL(ctx context.Context, queryer core.Queryer, tabl
|
||||||
return sql, false, nil
|
return sql, false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (db *oracle) IsSequenceExist(ctx context.Context, queryer core.Queryer, seqName string) (bool, error) {
|
||||||
|
return db.HasRecords(queryer, ctx, `SELECT sequence_name FROM user_sequences WHERE sequence_name = :1`, seqName)
|
||||||
|
}
|
||||||
|
|
||||||
func (db *oracle) SetQuotePolicy(quotePolicy QuotePolicy) {
|
func (db *oracle) SetQuotePolicy(quotePolicy QuotePolicy) {
|
||||||
switch quotePolicy {
|
switch quotePolicy {
|
||||||
case QuotePolicyNone:
|
case QuotePolicyNone:
|
||||||
|
|
Loading…
Reference in New Issue