Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 58 for DB (0.01 sec)

  1. tests/tests_test.go

    		if dbDSN == "" {
    			dbDSN = sqlserverDSN
    		}
    		db, err = gorm.Open(sqlserver.Open(dbDSN), cfg)
    	case "tidb":
    		log.Println("testing tidb...")
    		if dbDSN == "" {
    			dbDSN = tidbDSN
    		}
    		db, err = gorm.Open(mysql.Open(dbDSN), cfg)
    	default:
    		log.Println("testing sqlite3...")
    		db, err = gorm.Open(sqlite.Open(filepath.Join(os.TempDir(), "gorm.db")), cfg)
    		if err == nil {
    			db.Exec("PRAGMA foreign_keys = ON")
    		}
    	}
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Sep 30 03:21:19 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  2. gorm.go

    			if errTranslator, ok := db.Dialector.(ErrorTranslator); ok {
    				err = errTranslator.Translate(err)
    			}
    		}
    
    		if db.Error == nil {
    			db.Error = err
    		} else {
    			db.Error = fmt.Errorf("%v; %w", db.Error, err)
    		}
    	}
    	return db.Error
    }
    
    // DB returns `*sql.DB`
    func (db *DB) DB() (*sql.DB, error) {
    	connPool := db.ConnPool
    	if db.Statement != nil && db.Statement.ConnPool != nil {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Oct 09 11:29:48 UTC 2024
    - 12.1K bytes
    - Viewed (0)
  3. callbacks/query.go

    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    func Query(db *gorm.DB) {
    	if db.Error == nil {
    		BuildQuerySQL(db)
    
    		if !db.DryRun && db.Error == nil {
    			rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
    			if err != nil {
    				db.AddError(err)
    				return
    			}
    			defer func() {
    				db.AddError(rows.Close())
    			}()
    			gorm.Scan(rows, db, 0)
    		}
    	}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 10.1K bytes
    - Viewed (1)
  4. finisher_api.go

    func (db *DB) Create(value interface{}) (tx *DB) {
    	if db.CreateBatchSize > 0 {
    		return db.CreateInBatches(value, db.CreateBatchSize)
    	}
    
    	tx = db.getInstance()
    	tx.Statement.Dest = value
    	return tx.callbacks.Create().Execute(tx)
    }
    
    // CreateInBatches inserts value in batches of batchSize
    func (db *DB) CreateInBatches(value interface{}, batchSize int) (tx *DB) {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Sep 14 12:58:29 UTC 2024
    - 22.8K bytes
    - Viewed (0)
  5. internal/event/target/postgresql.go

    func (target *PostgreSQLTarget) initPostgreSQL() error {
    	args := target.args
    
    	db, err := sql.Open("postgres", target.connString)
    	if err != nil {
    		return err
    	}
    	target.db = db
    
    	if args.MaxOpenConnections > 0 {
    		// Set the maximum connections limit
    		target.db.SetMaxOpenConns(args.MaxOpenConnections)
    	}
    
    	err = target.db.Ping()
    	if err != nil {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Fri Sep 06 23:06:30 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  6. prepare_stmt.go

    		Mux:      &sync.RWMutex{},
    	}
    }
    
    func (db *PreparedStmtDB) GetDBConn() (*sql.DB, error) {
    	if sqldb, ok := db.ConnPool.(*sql.DB); ok {
    		return sqldb, nil
    	}
    
    	if dbConnector, ok := db.ConnPool.(GetDBConnector); ok && dbConnector != nil {
    		return dbConnector.GetDBConn()
    	}
    
    	return nil, ErrInvalidDB
    }
    
    func (db *PreparedStmtDB) Close() {
    	db.Mux.Lock()
    	defer db.Mux.Unlock()
    
    	for _, stmt := range db.Stmts {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:02:05 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  7. tests/transaction_test.go

    	}
    }
    
    func TestDeeplyNestedTransactionWithBlockAndWrappedCallback(t *testing.T) {
    	transaction := func(ctx context.Context, db *gorm.DB, callback func(ctx context.Context, db *gorm.DB) error) error {
    		return db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
    			return callback(ctx, tx)
    		})
    	}
    	var (
    		user  = *GetUser("transaction-nested", Config{})
    		user1 = *GetUser("transaction-nested-1", Config{})
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Sep 14 12:58:29 UTC 2024
    - 12.9K bytes
    - Viewed (0)
  8. internal/event/target/mysql.go

    	args := target.args
    
    	db, err := sql.Open("mysql", args.DSN)
    	if err != nil {
    		target.loggerOnce(context.Background(), err, target.ID().String())
    		return err
    	}
    	target.db = db
    
    	if args.MaxOpenConnections > 0 {
    		// Set the maximum connections limit
    		target.db.SetMaxOpenConns(args.MaxOpenConnections)
    	}
    
    	err = target.db.Ping()
    	if err != nil {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Fri Sep 06 23:06:30 UTC 2024
    - 11.6K bytes
    - Viewed (0)
  9. tests/prepared_stmt_test.go

    	if err := tx.Find(&result3, user2.ID).Error; err != nil {
    		t.Fatalf("no error should happen but got %v", err)
    	}
    }
    
    func TestPreparedStmtFromTransaction(t *testing.T) {
    	db := DB.Session(&gorm.Session{PrepareStmt: true, SkipDefaultTransaction: true})
    
    	tx := db.Begin()
    	defer func() {
    		if r := recover(); r != nil {
    			tx.Rollback()
    		}
    	}()
    	if err := tx.Error; err != nil {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:02:05 UTC 2024
    - 8.5K bytes
    - Viewed (0)
  10. .teamcity/src/main/kotlin/configurations/PerformanceTestsPass.kt

                    extraParameters = listOf(
                        "-Porg.gradle.performance.branchName" to "%teamcity.build.branch%",
                        "-Porg.gradle.performance.db.url" to "%performance.db.url%",
                        "-Porg.gradle.performance.db.username" to "%performance.db.username%",
                        "-Porg.gradle.performance.dependencyBuildIds" to dependencyBuildIds,
                        "-PperformanceBaselines" to dependencyBaselines
    Registered: Wed Nov 06 11:36:14 UTC 2024
    - Last Modified: Tue Sep 10 13:15:00 UTC 2024
    - 5.1K bytes
    - Viewed (0)
Back to top