Add oracle tests #1463
|
@ -45,8 +45,7 @@ const (
|
|||
|
||||
// DialectFeatures represents the features that the dialect supports
|
||||
type DialectFeatures struct {
|
||||
AutoincrMode int // 0 autoincrement column, 1 sequence
|
||||
SupportReturnIDWhenInsert bool
|
||||
AutoincrMode int // 0 autoincrement column, 1 sequence
|
||||
}
|
||||
|
||||
// Dialect represents a kind of database
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
|
@ -542,8 +543,7 @@ func (db *oracle) Version(ctx context.Context, queryer core.Queryer) (*schemas.V
|
|||
|
||||
func (db *oracle) Features() *DialectFeatures {
|
||||
return &DialectFeatures{
|
||||
AutoincrMode: SequenceAutoincrMode,
|
||||
SupportReturnIDWhenInsert: false,
|
||||
AutoincrMode: SequenceAutoincrMode,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -688,10 +688,6 @@ func (db *oracle) IsColumnExist(queryer core.Queryer, ctx context.Context, table
|
|||
return db.HasRecords(queryer, ctx, query, args...)
|
||||
}
|
||||
|
||||
func OracleSeqName(tableName string) string {
|
||||
return "SEQ_" + strings.ToUpper(tableName)
|
||||
}
|
||||
|
||||
func (db *oracle) GetColumns(queryer core.Queryer, ctx context.Context, tableName string) ([]string, map[string]*schemas.Column, error) {
|
||||
//s := "SELECT column_name,data_default,data_type,data_length,data_precision,data_scale," +
|
||||
// "nullable FROM USER_TAB_COLUMNS WHERE table_name = :1"
|
||||
|
@ -755,7 +751,7 @@ func (db *oracle) GetColumns(queryer core.Queryer, ctx context.Context, tableNam
|
|||
if pkName != "" && pkName == col.Name {
|
||||
col.IsPrimaryKey = true
|
||||
|
||||
has, err := db.HasRecords(queryer, ctx, "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = :1", OracleSeqName(tableName))
|
||||
has, err := db.HasRecords(queryer, ctx, "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = :1", utils.SeqName(tableName))
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
|
@ -876,12 +876,6 @@ func (db *postgres) SetQuotePolicy(quotePolicy QuotePolicy) {
|
|||
}
|
||||
}
|
||||
|
||||
func (db *postgres) Features() *DialectFeatures {
|
||||
return &DialectFeatures{
|
||||
AutoincrMode: IncrAutoincrMode,
|
||||
}
|
||||
}
|
||||
|
||||
func (db *postgres) SQLType(c *schemas.Column) string {
|
||||
var res string
|
||||
switch t := c.SQLType.Name; t {
|
||||
|
@ -947,6 +941,12 @@ func (db *postgres) SQLType(c *schemas.Column) string {
|
|||
return res
|
||||
}
|
||||
|
||||
func (db *postgres) Features() *DialectFeatures {
|
||||
return &DialectFeatures{
|
||||
AutoincrMode: IncrAutoincrMode,
|
||||
}
|
||||
}
|
||||
|
||||
func (db *postgres) ColumnTypeKind(t string) int {
|
||||
switch strings.ToUpper(t) {
|
||||
case "DATETIME", "TIMESTAMP":
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright 20190 The Xorm Authors. All rights reserved.
|
||||
// Copyright 2021 The Xorm Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build oracle
|
||||
// +build oralce
|
||||
|
||||
package integrations
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user