github.com/team-ide/go-dialect@v1.9.20/test/kinbase_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_kingbase_v8r3"
     7  	"testing"
     8  )
     9  
    10  var (
    11  	KinBaseDb      *sql.DB
    12  	KinBaseDialect dialect.Dialect
    13  )
    14  
    15  func initKinBase() {
    16  	if KinBaseDb != nil {
    17  		return
    18  	}
    19  	dsn := db_kingbase_v8r3.GetDSN("SYSTEM", "123456", "127.0.0.1", 54321, "TEST")
    20  	var err error
    21  	KinBaseDb, err = db_kingbase_v8r3.Open(dsn)
    22  	if err != nil {
    23  		panic(err)
    24  	}
    25  	KinBaseDialect, err = dialect.NewDialect(dialect.TypeKinBase.Name)
    26  	if err != nil {
    27  		panic(err)
    28  	}
    29  	return
    30  }
    31  
    32  func TestKinBaseLoad(t *testing.T) {
    33  	initKinBase()
    34  	owners(KinBaseDb, KinBaseDialect)
    35  }
    36  
    37  func TestKinBaseDDL(t *testing.T) {
    38  	initKinBase()
    39  	testDLL(KinBaseDb, KinBaseDialect, "")
    40  }
    41  
    42  func TestKinBaseSql(t *testing.T) {
    43  	initKinBase()
    44  	sqlInfo := loadSql("temp/sql_kinbase.sql")
    45  	testSql(KinBaseDb, KinBaseDialect, "SYSDBA", sqlInfo)
    46  }