github.com/team-ide/go-dialect@v1.9.20/test/oracle_test.go (about) 1 package test 2 3 import ( 4 "database/sql" 5 //_ "github.com/mattn/go-oci8" 6 "github.com/team-ide/go-dialect/dialect" 7 "github.com/team-ide/go-driver/db_oracle" 8 "testing" 9 ) 10 11 var ( 12 OracleDb *sql.DB 13 OracleDialect dialect.Dialect 14 ) 15 16 func initOracle() { 17 if OracleDb != nil { 18 return 19 } 20 dsn := db_oracle.GetDSN("root", "123456", "127.0.0.1", 1521, "xe") 21 var err error 22 OracleDb, err = db_oracle.Open(dsn) 23 if err != nil { 24 panic(err) 25 } 26 OracleDialect, err = dialect.NewDialect(dialect.TypeOracle.Name) 27 if err != nil { 28 panic(err) 29 } 30 31 return 32 } 33 34 func TestOracleLoad(t *testing.T) { 35 initOracle() 36 owners(OracleDb, OracleDialect) 37 } 38 39 func TestOracleDDL(t *testing.T) { 40 initOracle() 41 testDLL(OracleDb, OracleDialect, "") 42 } 43 44 func TestOracleSql(t *testing.T) { 45 initOracle() 46 sqlInfo := loadSql("temp/sql_oracle.sql") 47 testSql(OracleDb, OracleDialect, "ROOT", sqlInfo) 48 }