fix(unified): in-proc SQLite data migration (#114537)
* feat: unified storage migrations integration tests * chore: add comment and adjust db path name * chore: refactor test cases into interface * fix: unified SQLite migration with SQLStore migrator * revert changes to newResourceDBProvider
This commit is contained in:
@@ -7,6 +7,7 @@ package xorm
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
"reflect"
|
||||
@@ -43,7 +44,7 @@ type Session struct {
|
||||
afterProcessors []executedProcessor
|
||||
|
||||
prepareStmt bool
|
||||
stmtCache map[uint32]*core.Stmt //key: hash.Hash32 of (queryStr, len(queryStr))
|
||||
stmtCache map[uint32]*core.Stmt // key: hash.Hash32 of (queryStr, len(queryStr))
|
||||
|
||||
// !evalphobia! stored the last executed query on this session
|
||||
lastSQL string
|
||||
@@ -236,6 +237,14 @@ func (session *Session) DB() *core.DB {
|
||||
return session.db
|
||||
}
|
||||
|
||||
// Tx returns the underlying transaction
|
||||
func (session *Session) Tx() (*core.Tx, error) {
|
||||
if session.tx == nil {
|
||||
return nil, errors.New("no open transaction")
|
||||
}
|
||||
return session.tx, nil
|
||||
}
|
||||
|
||||
func cleanupProcessorsClosures(slices *[]func(any)) {
|
||||
if len(*slices) > 0 {
|
||||
*slices = make([]func(any), 0)
|
||||
|
||||
Reference in New Issue
Block a user