aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/xorm.io/xorm/dialects/oracle.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/xorm.io/xorm/dialects/oracle.go')
-rw-r--r--vendor/xorm.io/xorm/dialects/oracle.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/vendor/xorm.io/xorm/dialects/oracle.go b/vendor/xorm.io/xorm/dialects/oracle.go
index c48d32b973..db823e95c0 100644
--- a/vendor/xorm.io/xorm/dialects/oracle.go
+++ b/vendor/xorm.io/xorm/dialects/oracle.go
@@ -506,9 +506,9 @@ type oracle struct {
Base
}
-func (db *oracle) Init(d *core.DB, uri *URI) error {
+func (db *oracle) Init(uri *URI) error {
db.quoter = oracleQuoter
- return db.Base.Init(d, db, uri)
+ return db.Base.Init(db, uri)
}
func (db *oracle) SQLType(c *schemas.Column) string {
@@ -611,23 +611,23 @@ func (db *oracle) IndexCheckSQL(tableName, idxName string) (string, []interface{
`WHERE TABLE_NAME = :1 AND INDEX_NAME = :2`, args
}
-func (db *oracle) IsTableExist(ctx context.Context, tableName string) (bool, error) {
- return db.HasRecords(ctx, `SELECT table_name FROM user_tables WHERE table_name = :1`, tableName)
+func (db *oracle) IsTableExist(queryer core.Queryer, ctx context.Context, tableName string) (bool, error) {
+ return db.HasRecords(queryer, ctx, `SELECT table_name FROM user_tables WHERE table_name = :1`, tableName)
}
-func (db *oracle) IsColumnExist(ctx context.Context, tableName, colName string) (bool, error) {
+func (db *oracle) IsColumnExist(queryer core.Queryer, ctx context.Context, tableName, colName string) (bool, error) {
args := []interface{}{tableName, colName}
query := "SELECT column_name FROM USER_TAB_COLUMNS WHERE table_name = :1" +
" AND column_name = :2"
- return db.HasRecords(ctx, query, args...)
+ return db.HasRecords(queryer, ctx, query, args...)
}
-func (db *oracle) GetColumns(ctx context.Context, tableName string) ([]string, map[string]*schemas.Column, error) {
+func (db *oracle) GetColumns(queryer core.Queryer, ctx context.Context, tableName string) ([]string, map[string]*schemas.Column, error) {
args := []interface{}{tableName}
s := "SELECT column_name,data_default,data_type,data_length,data_precision,data_scale," +
"nullable FROM USER_TAB_COLUMNS WHERE table_name = :1"
- rows, err := db.DB().QueryContext(ctx, s, args...)
+ rows, err := queryer.QueryContext(ctx, s, args...)
if err != nil {
return nil, nil, err
}
@@ -719,11 +719,11 @@ func (db *oracle) GetColumns(ctx context.Context, tableName string) ([]string, m
return colSeq, cols, nil
}
-func (db *oracle) GetTables(ctx context.Context) ([]*schemas.Table, error) {
+func (db *oracle) GetTables(queryer core.Queryer, ctx context.Context) ([]*schemas.Table, error) {
args := []interface{}{}
s := "SELECT table_name FROM user_tables"
- rows, err := db.DB().QueryContext(ctx, s, args...)
+ rows, err := queryer.QueryContext(ctx, s, args...)
if err != nil {
return nil, err
}
@@ -742,12 +742,12 @@ func (db *oracle) GetTables(ctx context.Context) ([]*schemas.Table, error) {
return tables, nil
}
-func (db *oracle) GetIndexes(ctx context.Context, tableName string) (map[string]*schemas.Index, error) {
+func (db *oracle) GetIndexes(queryer core.Queryer, ctx context.Context, tableName string) (map[string]*schemas.Index, error) {
args := []interface{}{tableName}
s := "SELECT t.column_name,i.uniqueness,i.index_name FROM user_ind_columns t,user_indexes i " +
"WHERE t.index_name = i.index_name and t.table_name = i.table_name and t.table_name =:1"
- rows, err := db.DB().QueryContext(ctx, s, args...)
+ rows, err := queryer.QueryContext(ctx, s, args...)
if err != nil {
return nil, err
}
@@ -842,7 +842,7 @@ func (p *oci8Driver) Parse(driverName, dataSourceName string) (*URI, error) {
db.DBName = match
}
}
- if db.DBName == "" {
+ if db.DBName == "" && len(matches) != 0 {
return nil, errors.New("dbname is empty")
}
return db, nil