Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for rows (0.12 sec)

  1. scan.go

    	ScanInitialized         ScanMode = 1 << 0 // 1
    	ScanUpdate              ScanMode = 1 << 1 // 2
    	ScanOnConflictDoNothing ScanMode = 1 << 2 // 4
    )
    
    // Scan scan rows into db statement
    func Scan(rows Rows, db *DB, mode ScanMode) {
    	var (
    		columns, _          = rows.Columns()
    		values              = make([]interface{}, len(columns))
    		initialized         = mode&ScanInitialized != 0
    		update              = mode&ScanUpdate != 0
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  2. tests/prepared_stmt_test.go

    		t.Fatalf("Failed, got error: %v, rows affected: %v", result.Error, result.RowsAffected)
    	}
    
    	tx2 := db.Begin()
    	if result := tx2.Where("name=?", "zzjin").Delete(&User{}); result.Error != nil || result.RowsAffected != 0 {
    		t.Fatalf("Failed, got error: %v, rows affected: %v", result.Error, result.RowsAffected)
    	}
    	tx2.Commit()
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  3. tests/create_test.go

    	if res.Error != nil || res.RowsAffected != 1 {
    		t.Fatalf("first or create rows affect err:%v rows:%d", res.Error, res.RowsAffected)
    	}
    
    	res = DB.FirstOrCreate(&user, "name = ?", user.Name)
    	if res.Error != nil || res.RowsAffected != 0 {
    		t.Fatalf("first or create rows affect err:%v rows:%d", res.Error, res.RowsAffected)
    	}
    }
    
    func TestCreateWithAutoIncrementCompositeKey(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  4. tests/connpool_test.go

    }
    
    func (c *wrapperTx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) {
    	c.conn.got = append(c.conn.got, query)
    	return c.Tx.QueryContext(ctx, query, args...)
    }
    
    func (c *wrapperTx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row {
    	c.conn.got = append(c.conn.got, query)
    	return c.Tx.QueryRowContext(ctx, query, args...)
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  5. logger/logger.go

    		sql, rows := fc()
    		if rows == -1 {
    			l.Printf(l.traceErrStr, utils.FileWithLineNum(), err, float64(elapsed.Nanoseconds())/1e6, "-", sql)
    		} else {
    			l.Printf(l.traceErrStr, utils.FileWithLineNum(), err, float64(elapsed.Nanoseconds())/1e6, rows, sql)
    		}
    	case elapsed > l.SlowThreshold && l.SlowThreshold != 0 && l.LogLevel >= Warn:
    		sql, rows := fc()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Nov 07 02:19:41 GMT 2023
    - 5.8K bytes
    - Viewed (0)
  6. callbacks/query.go

    	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)
    		}
    	}
    }
    
    func BuildQuerySQL(db *gorm.DB) {
    	if db.Statement.Schema != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  7. finisher_api.go

    	}
    
    	return
    }
    
    func (db *DB) Row() *sql.Row {
    	tx := db.getInstance().Set("rows", false)
    	tx = tx.callbacks.Row().Execute(tx)
    	row, ok := tx.Statement.Dest.(*sql.Row)
    	if !ok && tx.DryRun {
    		db.Logger.Error(tx.Statement.Context, ErrDryRunModeUnsupported.Error())
    	}
    	return row
    }
    
    func (db *DB) Rows() (*sql.Rows, error) {
    	tx := db.getInstance().Set("rows", true)
    	tx = tx.callbacks.Row().Execute(tx)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  8. tests/gorm_test.go

    			t.Fatalf("rows affected expects: %v, got %v", 1, results.RowsAffected)
    		} else if u1.ID == 0 {
    			t.Fatalf("ID expects : not equal 0, got %v", u1.ID)
    		}
    
    		got := user{}
    		results := DB.First(&got, "id = ?", u1.ID)
    		if results.Error != nil {
    			t.Fatalf("errors happened on first: %v", results.Error)
    		} else if results.RowsAffected != 1 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jun 01 07:22:21 GMT 2023
    - 3.3K bytes
    - Viewed (0)
  9. migrator/migrator.go

    	execErr := m.RunWithValue(value, func(stmt *gorm.Statement) (err error) {
    		rows, err := m.DB.Session(&gorm.Session{}).Table(stmt.Table).Limit(1).Rows()
    		if err != nil {
    			return err
    		}
    
    		defer func() {
    			err = rows.Close()
    		}()
    
    		var rawColumnTypes []*sql.ColumnType
    		rawColumnTypes, err = rows.ColumnTypes()
    		if err != nil {
    			return err
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  10. prepare_stmt.go

    	stmt, err := db.prepare(ctx, db.ConnPool, false, query)
    	if err == nil {
    		rows, err = stmt.QueryContext(ctx, args...)
    		if errors.Is(err, driver.ErrBadConn) {
    			db.Mux.Lock()
    			defer db.Mux.Unlock()
    
    			go stmt.Close()
    			delete(db.Stmts, query)
    		}
    	}
    	return rows, err
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
Back to top