[dialects/mssql.go] bugfix SQLType / GetColumns / GetTables / GetIndexes
[dialects/postgres.go] bugfix SQLType [engine.go] use github.com/alexbrainman/odbc for odbc - bugfix objectId - add log - bugfix null value - bugfix sql server identity [schemas/index.go] bugfix index name generatin [schemas/table.go] add ObjectId field [schemas/type.go] add DateTime2 type [*] replace module xorm.io/xorm by gitea.com/nikos06/xorm
This commit is contained in:
parent
e660414278
commit
5f3bad1949
4
Makefile
4
Makefile
|
@ -1,4 +1,4 @@
|
|||
IMPORT := xorm.io/xorm
|
||||
IMPORT := gitea.com/nikos06/xorm
|
||||
export GO111MODULE=on
|
||||
|
||||
GO ?= go
|
||||
|
@ -7,7 +7,7 @@ TAGS ?=
|
|||
SED_INPLACE := sed -i
|
||||
|
||||
GOFILES := $(shell find . -name "*.go" -type f)
|
||||
INTEGRATION_PACKAGES := xorm.io/xorm/integrations
|
||||
INTEGRATION_PACKAGES := gitea.com/nikos06/xorm/integrations
|
||||
PACKAGES ?= $(filter-out $(INTEGRATION_PACKAGES),$(shell $(GO) list ./...))
|
||||
|
||||
TEST_COCKROACH_HOST ?= cockroach:26257
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func TestLRUCache(t *testing.T) {
|
||||
|
|
|
@ -13,9 +13,9 @@ import (
|
|||
"regexp"
|
||||
"sync"
|
||||
|
||||
"xorm.io/xorm/contexts"
|
||||
"xorm.io/xorm/log"
|
||||
"xorm.io/xorm/names"
|
||||
"gitea.com/nikos06/xorm/contexts"
|
||||
"gitea.com/nikos06/xorm/log"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/names"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"errors"
|
||||
"reflect"
|
||||
|
||||
"xorm.io/xorm/contexts"
|
||||
"gitea.com/nikos06/xorm/contexts"
|
||||
)
|
||||
|
||||
// Stmt reprents a stmt objects
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"context"
|
||||
"database/sql"
|
||||
|
||||
"xorm.io/xorm/contexts"
|
||||
"gitea.com/nikos06/xorm/contexts"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
// URI represents an uri to visit database
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -319,6 +319,12 @@ func (db *mssql) SQLType(c *schemas.Column) string {
|
|||
if c.Length == -1 {
|
||||
res += "(MAX)"
|
||||
}
|
||||
case schemas.UniqueIdentifier:
|
||||
res = t
|
||||
c.Length = 0
|
||||
case schemas.Money:
|
||||
res = t
|
||||
c.Length = 0
|
||||
default:
|
||||
res = t
|
||||
}
|
||||
|
@ -395,18 +401,18 @@ func (db *mssql) IsTableExist(queryer core.Queryer, ctx context.Context, tableNa
|
|||
func (db *mssql) GetColumns(queryer core.Queryer, ctx context.Context, tableName string) ([]string, map[string]*schemas.Column, error) {
|
||||
args := []interface{}{}
|
||||
s := `select a.name as name, b.name as ctype,a.max_length,a.precision,a.scale,a.is_nullable as nullable,
|
||||
"default_is_null" = (CASE WHEN c.text is null THEN 1 ELSE 0 END),
|
||||
replace(replace(isnull(c.text,''),'(',''),')','') as vdefault,
|
||||
"default_is_null" = (CASE WHEN c.definition is null THEN 1 ELSE 0 END),
|
||||
replace(replace(isnull(c.definition,''),'(',''),')','') as vdefault,
|
||||
ISNULL(p.is_primary_key, 0), a.is_identity as is_identity
|
||||
from sys.columns a
|
||||
left join sys.types b on a.user_type_id=b.user_type_id
|
||||
left join sys.syscomments c on a.default_object_id=c.id
|
||||
left join sys.sql_modules c on a.object_id=c.object_id
|
||||
LEFT OUTER JOIN (SELECT i.object_id, ic.column_id, i.is_primary_key
|
||||
FROM sys.indexes i
|
||||
LEFT JOIN sys.index_columns ic ON ic.object_id = i.object_id AND ic.index_id = i.index_id
|
||||
WHERE i.is_primary_key = 1
|
||||
) as p on p.object_id = a.object_id AND p.column_id = a.column_id
|
||||
where a.object_id=object_id('` + tableName + `')`
|
||||
where a.object_id='` + tableName + `')`
|
||||
|
||||
rows, err := queryer.QueryContext(ctx, s, args...)
|
||||
if err != nil {
|
||||
|
@ -475,7 +481,7 @@ func (db *mssql) GetColumns(queryer core.Queryer, ctx context.Context, tableName
|
|||
|
||||
func (db *mssql) GetTables(queryer core.Queryer, ctx context.Context) ([]*schemas.Table, error) {
|
||||
args := []interface{}{}
|
||||
s := `select name from sysobjects where xtype ='U'`
|
||||
s := `select name,object_id from sys.objects where type ='U'`
|
||||
|
||||
rows, err := queryer.QueryContext(ctx, s, args...)
|
||||
if err != nil {
|
||||
|
@ -487,11 +493,13 @@ func (db *mssql) GetTables(queryer core.Queryer, ctx context.Context) ([]*schema
|
|||
for rows.Next() {
|
||||
table := schemas.NewEmptyTable()
|
||||
var name string
|
||||
err = rows.Scan(&name)
|
||||
var objectId string
|
||||
err = rows.Scan(&name, &objectId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
table.Name = strings.Trim(name, "` ")
|
||||
table.ObjectId = objectId
|
||||
tables = append(tables, table)
|
||||
}
|
||||
return tables, nil
|
||||
|
@ -508,7 +516,7 @@ INNER JOIN SYS.INDEX_COLUMNS IXCS
|
|||
ON IXS.OBJECT_ID=IXCS.OBJECT_ID AND IXS.INDEX_ID = IXCS.INDEX_ID
|
||||
INNER JOIN SYS.COLUMNS C ON IXS.OBJECT_ID=C.OBJECT_ID
|
||||
AND IXCS.COLUMN_ID=C.COLUMN_ID
|
||||
WHERE IXS.TYPE_DESC='NONCLUSTERED' and OBJECT_NAME(IXS.OBJECT_ID) =?
|
||||
WHERE IXS.TYPE_DESC='NONCLUSTERED' and IXS.OBJECT_ID =?
|
||||
`
|
||||
|
||||
rows, err := queryer.QueryContext(ctx, s, args...)
|
||||
|
|
|
@ -14,8 +14,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
// from http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html
|
||||
|
@ -833,6 +833,9 @@ func (db *postgres) SQLType(c *schemas.Column) string {
|
|||
case schemas.Bit:
|
||||
res = schemas.Boolean
|
||||
return res
|
||||
case schemas.SmallInt:
|
||||
res = schemas.SmallInt
|
||||
c.Length = 0
|
||||
case schemas.MediumInt, schemas.Int, schemas.Integer:
|
||||
if c.IsAutoIncrement {
|
||||
return schemas.Serial
|
||||
|
@ -851,10 +854,14 @@ func (db *postgres) SQLType(c *schemas.Column) string {
|
|||
return schemas.Bytea
|
||||
case schemas.DateTime:
|
||||
res = schemas.TimeStamp
|
||||
c.Length = 0
|
||||
case schemas.DateTime2:
|
||||
res = schemas.TimeStamp
|
||||
case schemas.TimeStampz:
|
||||
return "timestamp with time zone"
|
||||
case schemas.Float:
|
||||
res = schemas.Real
|
||||
res = schemas.Float
|
||||
c.Length = 0
|
||||
case schemas.TinyText, schemas.MediumText, schemas.LongText:
|
||||
res = schemas.Text
|
||||
case schemas.NChar:
|
||||
|
@ -867,6 +874,11 @@ func (db *postgres) SQLType(c *schemas.Column) string {
|
|||
return schemas.Bytea
|
||||
case schemas.Double:
|
||||
return "DOUBLE PRECISION"
|
||||
case schemas.UniqueIdentifier:
|
||||
return schemas.Uuid
|
||||
case schemas.Money:
|
||||
res = t
|
||||
c.Length = 0
|
||||
default:
|
||||
if c.IsAutoIncrement {
|
||||
return schemas.Serial
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -9,8 +9,8 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/names"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
)
|
||||
|
||||
// TableNameWithSchema will add schema prefix on table name if possible
|
||||
|
|
|
@ -7,7 +7,7 @@ package dialects
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"xorm.io/xorm/names"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ package dialects
|
|||
import (
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
// FormatTime format time as column type
|
||||
|
|
2
doc.go
2
doc.go
|
@ -10,7 +10,7 @@ Installation
|
|||
|
||||
Make sure you have installed Go 1.11+ and then:
|
||||
|
||||
go get xorm.io/xorm
|
||||
go get gitea.com/nikos06/xorm
|
||||
|
||||
Create Engine
|
||||
|
||||
|
|
89
engine.go
89
engine.go
|
@ -17,15 +17,17 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/contexts"
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/log"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/tags"
|
||||
"github.com/alexbrainman/odbc"
|
||||
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/contexts"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
"gitea.com/nikos06/xorm/dialects"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/log"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/tags"
|
||||
)
|
||||
|
||||
// Engine is the major struct of xorm, it means a database manager.
|
||||
|
@ -359,7 +361,7 @@ func (engine *Engine) NoAutoCondition(no ...bool) *Session {
|
|||
}
|
||||
|
||||
func (engine *Engine) loadTableInfo(table *schemas.Table) error {
|
||||
colSeq, cols, err := engine.dialect.GetColumns(engine.db, engine.defaultContext, table.Name)
|
||||
colSeq, cols, err := engine.dialect.GetColumns(engine.db, engine.defaultContext, table.ObjectId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -405,6 +407,7 @@ func (engine *Engine) DBMetas() ([]*schemas.Table, error) {
|
|||
if err = engine.loadTableInfo(table); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
engine.logger.Debugf("Loaded schema for table %s", table.Name)
|
||||
}
|
||||
return tables, nil
|
||||
}
|
||||
|
@ -445,6 +448,15 @@ func (engine *Engine) DumpTables(tables []*schemas.Table, w io.Writer, tp ...sch
|
|||
|
||||
func formatColumnValue(dstDialect dialects.Dialect, d interface{}, col *schemas.Column) string {
|
||||
if d == nil {
|
||||
if !col.Nullable {
|
||||
if col.SQLType.IsText() {
|
||||
return "''"
|
||||
} else if col.SQLType.IsTime() {
|
||||
return "0000-00-00 00:00:00"
|
||||
} else if col.SQLType.IsNumeric() {
|
||||
return "0"
|
||||
}
|
||||
}
|
||||
return "NULL"
|
||||
}
|
||||
|
||||
|
@ -519,6 +531,41 @@ func formatColumnValue(dstDialect dialects.Dialect, d interface{}, col *schemas.
|
|||
return s
|
||||
}
|
||||
|
||||
func isPrimaryKeyIdentity(table *schemas.Table) bool {
|
||||
pkColumns := table.PKColumns()
|
||||
if len(pkColumns) > 1 || len(pkColumns) <= 0 {
|
||||
return false
|
||||
}
|
||||
switch t := pkColumns[0].SQLType.Name; t {
|
||||
case schemas.Serial:
|
||||
return false
|
||||
case schemas.BigSerial:
|
||||
return false
|
||||
case schemas.TinyInt:
|
||||
return true
|
||||
case schemas.SmallInt:
|
||||
return true
|
||||
case schemas.MediumInt:
|
||||
return true
|
||||
case schemas.Int:
|
||||
return true
|
||||
case schemas.Integer:
|
||||
return true
|
||||
case schemas.BigInt:
|
||||
return true
|
||||
case schemas.Decimal:
|
||||
return true
|
||||
case schemas.Numeric:
|
||||
return true
|
||||
case schemas.SmallMoney:
|
||||
return true
|
||||
case schemas.Money:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// dumpTables dump database all table structs and data to w with specify db type
|
||||
func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...schemas.DBType) error {
|
||||
var dstDialect dialects.Dialect
|
||||
|
@ -566,7 +613,7 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch
|
|||
return err
|
||||
}
|
||||
}
|
||||
if len(table.PKColumns()) > 0 && dstDialect.URI().DBType == schemas.MSSQL {
|
||||
if dstDialect.URI().DBType == schemas.MSSQL && isPrimaryKeyIdentity(table) {
|
||||
fmt.Fprintf(w, "SET IDENTITY_INSERT [%s] ON;\n", table.Name)
|
||||
}
|
||||
|
||||
|
@ -583,6 +630,12 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch
|
|||
|
||||
rows, err := engine.DB().QueryContext(engine.defaultContext, "SELECT "+colNames+" FROM "+engine.Quote(originalTableName))
|
||||
if err != nil {
|
||||
if odbcErr, ok := err.(*odbc.Error); ok {
|
||||
if odbcErr.Diag[0].NativeError==40000 {
|
||||
engine.logger.Errorf("Unable to dump records from table %s: %s", tableName, odbcErr)
|
||||
continue
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
@ -613,13 +666,17 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: Hack for postgres
|
||||
if dstDialect.URI().DBType == schemas.POSTGRES && table.AutoIncrColumn() != nil {
|
||||
_, err = io.WriteString(w, "SELECT setval('"+tableName+"_id_seq', COALESCE((SELECT MAX("+table.AutoIncrColumn().Name+") + 1 FROM "+dstDialect.Quoter().Quote(tableName)+"), 1), false);\n")
|
||||
if err != nil {
|
||||
if err := rows.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Hack for postgres
|
||||
//if dstDialect.URI().DBType == schemas.POSTGRES && table.AutoIncrColumn() != nil {
|
||||
// _, err = io.WriteString(w, "SELECT setval('"+tableName+"_id_seq', COALESCE((SELECT MAX("+table.AutoIncrColumn().Name+") + 1 FROM "+dstDialect.Quoter().Quote(tableName)+"), 1), false);\n")
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
//}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -8,11 +8,11 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/contexts"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/log"
|
||||
"xorm.io/xorm/names"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/contexts"
|
||||
"gitea.com/nikos06/xorm/dialects"
|
||||
"gitea.com/nikos06/xorm/log"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
)
|
||||
|
||||
// EngineGroup defines an engine group
|
||||
|
|
5
go.mod
5
go.mod
|
@ -1,9 +1,11 @@
|
|||
module xorm.io/xorm
|
||||
module gitea.com/nikos06/xorm
|
||||
|
||||
go 1.11
|
||||
|
||||
require (
|
||||
github.com/alexbrainman/odbc v0.0.0-20200426075526-f0492dfa1575
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc
|
||||
github.com/go-ole/go-ole v1.2.5 // indirect
|
||||
github.com/go-sql-driver/mysql v1.5.0
|
||||
github.com/lib/pq v1.7.0
|
||||
github.com/mattn/go-sqlite3 v1.14.6
|
||||
|
@ -12,4 +14,5 @@ require (
|
|||
github.com/ziutek/mymysql v1.5.4
|
||||
modernc.org/sqlite v1.10.1-0.20210314190707-798bbeb9bb84
|
||||
xorm.io/builder v0.3.8
|
||||
gitea.com/nikos06/xorm v1.0.7
|
||||
)
|
||||
|
|
16
go.sum
16
go.sum
|
@ -1,5 +1,9 @@
|
|||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
|
||||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
|
||||
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
||||
github.com/alexbrainman/odbc v0.0.0-20200426075526-f0492dfa1575 h1:amPgE3QaxNogld1zImkopnrJQkJN51DE7ngVykqVVYE=
|
||||
github.com/alexbrainman/odbc v0.0.0-20200426075526-f0492dfa1575/go.mod h1:WEQLoRNIjBhywJqaxe0olilzzBDABc5EVeETiprzR00=
|
||||
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg=
|
||||
|
@ -8,6 +12,8 @@ github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4
|
|||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY=
|
||||
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
|
||||
|
@ -26,6 +32,7 @@ github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY=
|
|||
github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
|
||||
github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg=
|
||||
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
|
@ -53,9 +60,12 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnk
|
|||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
@ -63,9 +73,12 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
|
||||
|
@ -118,5 +131,8 @@ modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
|||
modernc.org/z v1.0.1-0.20210308123920-1f282aa71362/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
|
||||
modernc.org/z v1.0.1 h1:WyIDpEpAIx4Hel6q/Pcgj/VhaQV5XPJ2I6ryIYbjnpc=
|
||||
modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
|
||||
xorm.io/builder v0.3.7/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
|
||||
xorm.io/builder v0.3.8 h1:P/wPgRqa9kX5uE0aA1/ukJ23u9KH0aSRpHLwDKXigSE=
|
||||
xorm.io/builder v0.3.8/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
|
||||
gitea.com/nikos06/xorm v1.0.7 h1:26yBTDVI+CfQpVz2Y88fISh+aiJXIPP4eNoTJlwzsC4=
|
||||
gitea.com/nikos06/xorm v1.0.7/go.mod h1:uF9EtbhODq5kNWxMbnBEj8hRRZnlcNSz2t2N7HW/+A4=
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -7,9 +7,9 @@ package integrations
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/log"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm"
|
||||
"gitea.com/nikos06/xorm/log"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
|
||||
_ "github.com/denisenkom/go-mssqldb"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.com/nikos06/xorm"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func TestSetExpr(t *testing.T) {
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/names"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/contexts"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/contexts"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.com/nikos06/xorm"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
type IntId struct {
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"time"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func TestStoreEngine(t *testing.T) {
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/names"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
)
|
||||
|
||||
func TestTransaction(t *testing.T) {
|
||||
|
|
|
@ -11,11 +11,11 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/internal/statements"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm"
|
||||
"gitea.com/nikos06/xorm/internal/statements"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func TestUpdateMap(t *testing.T) {
|
||||
|
|
|
@ -12,9 +12,9 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
type tempUser struct {
|
||||
|
|
|
@ -12,12 +12,12 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/log"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/dialects"
|
||||
"gitea.com/nikos06/xorm/log"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/internal/json"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm"
|
||||
"gitea.com/nikos06/xorm/convert"
|
||||
"gitea.com/nikos06/xorm/internal/json"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
12
interface.go
12
interface.go
|
@ -10,12 +10,12 @@ import (
|
|||
"reflect"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/contexts"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/log"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/contexts"
|
||||
"gitea.com/nikos06/xorm/dialects"
|
||||
"gitea.com/nikos06/xorm/log"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
// Interface defines the interface which Engine, EngineGroup and Session will implementate.
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func (statement *Statement) ConvertIDSQL(sqlStr string) string {
|
||||
|
|
|
@ -7,7 +7,7 @@ package statements
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/schemas"
|
||||
)
|
||||
|
||||
type columnMap []string
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
type ErrUnsupportedExprType struct {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/schemas"
|
||||
)
|
||||
|
||||
func (statement *Statement) writeInsertOutput(buf *strings.Builder, table *schemas.Table) error {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"reflect"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func (statement *Statement) GenQuerySQL(sqlOrArgs ...interface{}) (string, []interface{}, error) {
|
||||
|
|
|
@ -13,13 +13,13 @@ import (
|
|||
"time"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/contexts"
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/internal/json"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/tags"
|
||||
"gitea.com/nikos06/xorm/contexts"
|
||||
"gitea.com/nikos06/xorm/convert"
|
||||
"gitea.com/nikos06/xorm/dialects"
|
||||
"gitea.com/nikos06/xorm/internal/json"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/tags"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"time"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func quoteNeeded(a interface{}) bool {
|
||||
|
|
|
@ -11,11 +11,11 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/tags"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/dialects"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/tags"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
|
|
@ -11,11 +11,11 @@ import (
|
|||
"reflect"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/internal/json"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/convert"
|
||||
"gitea.com/nikos06/xorm/dialects"
|
||||
"gitea.com/nikos06/xorm/internal/json"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func (statement *Statement) ifAddColUpdate(col *schemas.Column, includeVersion, includeUpdated, includeNil,
|
||||
|
|
|
@ -11,10 +11,10 @@ import (
|
|||
"reflect"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/internal/json"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/convert"
|
||||
"gitea.com/nikos06/xorm/dialects"
|
||||
"gitea.com/nikos06/xorm/internal/json"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -7,7 +7,7 @@ package log
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"xorm.io/xorm/contexts"
|
||||
"gitea.com/nikos06/xorm/contexts"
|
||||
)
|
||||
|
||||
// LogContext represents a log context
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.com/nikos06/xorm"
|
||||
)
|
||||
|
||||
// MigrateFunc is the func signature for migrating.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm"
|
||||
"gitea.com/nikos06/xorm"
|
||||
)
|
||||
|
||||
type Person struct {
|
||||
|
|
4
rows.go
4
rows.go
|
@ -11,8 +11,8 @@ import (
|
|||
"reflect"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
)
|
||||
|
||||
// Rows rows wrapper a rows to
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package schemas
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
@ -31,14 +32,12 @@ func NewIndex(name string, indexType int) *Index {
|
|||
func (index *Index) XName(tableName string) string {
|
||||
if !strings.HasPrefix(index.Name, "UQE_") &&
|
||||
!strings.HasPrefix(index.Name, "IDX_") {
|
||||
tableParts := strings.Split(strings.Replace(tableName, `"`, "", -1), ".")
|
||||
tableName = tableParts[len(tableParts)-1]
|
||||
if index.Type == UniqueType {
|
||||
return fmt.Sprintf("UQE_%v_%v", tableName, index.Name)
|
||||
return fmt.Sprintf("UQE_%x", sha1.Sum([]byte(tableName+index.Name)))
|
||||
}
|
||||
return fmt.Sprintf("IDX_%v_%v", tableName, index.Name)
|
||||
return fmt.Sprintf("IDX_%x", sha1.Sum([]byte(tableName+index.Name)))
|
||||
}
|
||||
return index.Name
|
||||
return fmt.Sprintf("%x", sha1.Sum([]byte(tableName+index.Name)))
|
||||
}
|
||||
|
||||
// AddColumn add columns which will be composite index
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/gob"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
)
|
||||
|
||||
type PK []interface{}
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
// Table represents a database table
|
||||
type Table struct {
|
||||
Name string
|
||||
ObjectId string
|
||||
Type reflect.Type
|
||||
columnsSeq []string
|
||||
columnsMap map[string][]*Column
|
||||
|
|
|
@ -100,6 +100,7 @@ var (
|
|||
|
||||
Date = "DATE"
|
||||
DateTime = "DATETIME"
|
||||
DateTime2 = "DATETIME2"
|
||||
SmallDateTime = "SMALLDATETIME"
|
||||
Time = "TIME"
|
||||
TimeStamp = "TIMESTAMP"
|
||||
|
@ -166,6 +167,7 @@ var (
|
|||
|
||||
Date: TIME_TYPE,
|
||||
DateTime: TIME_TYPE,
|
||||
DateTime2: TIME_TYPE,
|
||||
Time: TIME_TYPE,
|
||||
TimeStamp: TIME_TYPE,
|
||||
TimeStampz: TIME_TYPE,
|
||||
|
@ -333,7 +335,7 @@ func SQLType2Type(st SQLType) reflect.Type {
|
|||
return reflect.TypeOf([]byte{})
|
||||
case Bool:
|
||||
return reflect.TypeOf(true)
|
||||
case DateTime, Date, Time, TimeStamp, TimeStampz, SmallDateTime, Year:
|
||||
case DateTime, DateTime2, Date, Time, TimeStamp, TimeStampz, SmallDateTime, Year:
|
||||
return reflect.TypeOf(c_TIME_DEFAULT)
|
||||
case Decimal, Numeric, Money, SmallMoney:
|
||||
return reflect.TypeOf("")
|
||||
|
|
14
session.go
14
session.go
|
@ -18,13 +18,13 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/contexts"
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/internal/json"
|
||||
"xorm.io/xorm/internal/statements"
|
||||
"xorm.io/xorm/log"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/contexts"
|
||||
"gitea.com/nikos06/xorm/convert"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
"gitea.com/nikos06/xorm/internal/json"
|
||||
"gitea.com/nikos06/xorm/internal/statements"
|
||||
"gitea.com/nikos06/xorm/log"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
// ErrFieldIsNotExist columns does not exist
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func setColumnInt(bean interface{}, col *schemas.Column, t int64) {
|
||||
|
|
|
@ -13,10 +13,10 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/internal/json"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/convert"
|
||||
"gitea.com/nikos06/xorm/internal/json"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func (session *Session) str2Time(col *schemas.Column, data string) (outTime time.Time, outErr error) {
|
||||
|
|
|
@ -9,8 +9,8 @@ import (
|
|||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -10,10 +10,10 @@ import (
|
|||
"reflect"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/internal/statements"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/internal/statements"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -11,9 +11,9 @@ import (
|
|||
"reflect"
|
||||
"strconv"
|
||||
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
// Get retrieve one record from database, bean's non-empty fields
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
// ErrNoElementsOnSlice represents an error there is no element when insert
|
||||
|
|
|
@ -7,7 +7,7 @@ package xorm
|
|||
import (
|
||||
"reflect"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
)
|
||||
|
||||
// IterFunc only use by Iterate
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/core"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
// Query runs a raw sql and return records as []map[string][]byte
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"database/sql"
|
||||
"reflect"
|
||||
|
||||
"xorm.io/xorm/core"
|
||||
"gitea.com/nikos06/xorm/core"
|
||||
)
|
||||
|
||||
func (session *Session) queryPreprocess(sqlStr *string, paramStr ...interface{}) {
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
// Ping test if database is ok
|
||||
|
|
|
@ -12,9 +12,9 @@ import (
|
|||
"strings"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func (session *Session) cacheUpdate(table *schemas.Table, tableName, sqlStr string, args ...interface{}) error {
|
||||
|
|
|
@ -13,11 +13,11 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/convert"
|
||||
"gitea.com/nikos06/xorm/dialects"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/names"
|
||||
"gitea.com/nikos06/xorm/caches"
|
||||
"gitea.com/nikos06/xorm/dialects"
|
||||
"gitea.com/nikos06/xorm/names"
|
||||
)
|
||||
|
||||
type ParseTableName1 struct{}
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
"gitea.com/nikos06/xorm/schemas"
|
||||
)
|
||||
|
||||
func splitTag(tag string) (tags []string) {
|
||||
|
|
|
@ -7,7 +7,7 @@ package tags
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"gitea.com/nikos06/xorm/internal/utils"
|
||||
)
|
||||
|
||||
func TestSplitTag(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue