github.com/team-ide/go-dialect@v1.9.20/test/shentong_test.go (about)

     1  package test
     2  
     3  import (
     4  	"database/sql"
     5  	"github.com/team-ide/go-dialect/dialect"
     6  	"github.com/team-ide/go-driver/db_shentong"
     7  	"testing"
     8  )
     9  
    10  var (
    11  	ShenTongDb      *sql.DB
    12  	ShenTongDialect dialect.Dialect
    13  )
    14  
    15  func initShenTong() {
    16  	if ShenTongDb != nil {
    17  		return
    18  	}
    19  	dsn := db_shentong.GetDSN("SYSDBA", "szoscar55", "127.0.0.1", 2003, "OSRDB")
    20  	var err error
    21  	ShenTongDb, err = db_shentong.Open(dsn)
    22  	if err != nil {
    23  		panic(err)
    24  	}
    25  	ShenTongDialect, err = dialect.NewDialect(dialect.TypeShenTong.Name)
    26  	if err != nil {
    27  		panic(err)
    28  	}
    29  	return
    30  }
    31  
    32  func TestShenTongLoad(t *testing.T) {
    33  	initShenTong()
    34  	owners(ShenTongDb, ShenTongDialect)
    35  }
    36  
    37  func TestShenTongDDL(t *testing.T) {
    38  	initShenTong()
    39  	testDLL(ShenTongDb, ShenTongDialect, "")
    40  }
    41  
    42  func TestShenTongSql(t *testing.T) {
    43  	initShenTong()
    44  	sqlInfo := loadSql("temp/sql_shentong.sql")
    45  	testSql(ShenTongDb, ShenTongDialect, "SYSDBA", sqlInfo)
    46  }