// Insert stores the Release in the database.
342267
func (r *Release) Insert(tx *sql.Tx) error {
	if !r.validBundle() {
		return r.errInvalidBundle()
	}

	query := fmt.Sprintf("INSERT INTO %s_releases (version, released_at) VALUES (?, ?)",
		r.table())
	_, err := tx.Exec(query, r.Version, r.ReleasedAt)
	return err
}
1128064
func (ap *AuthPermission) Insert(db XODB) error {
	var err error

	// if already exist, bail
	if ap._exists {
		return errors.New("insert failed: already exists")
	}

	// sql insert query, primary key provided by autoincrement
	const sqlstr = `INSERT INTO auth_permission (` +
		`content_type_id, codename, name` +
		`) VALUES (` +
		`?, ?, ?` +
		`)`

	// run query
	XOLog(sqlstr, ap.ContentTypeID, ap.Codename, ap.Name)
	res, err := db.Exec(sqlstr, ap.ContentTypeID, ap.Codename, ap.Name)
	if err != nil {
		return err
	}

	// retrieve id
	id, err := res.LastInsertId()
	if err != nil {
		return err
	}

	// set primary key and existence
	ap.ID = int(id)
	ap._exists = true

	return nil
}
114384
func (aug *AuthUserGroup) Insert(db XODB) error {
	var err error

	// if already exist, bail
	if aug._exists {
		return errors.New("insert failed: already exists")
	}

	// sql query
	const sqlstr = `INSERT INTO django.auth_user_groups (` +
		`user_id, group_id` +
		`) VALUES (` +
		`:1, :2` +
		`) RETURNING id /*lastInsertId*/ INTO :pk`

	// run query
	XOLog(sqlstr, aug.UserID, aug.GroupID, nil)
	res, err := db.Exec(sqlstr, aug.UserID, aug.GroupID, nil)
	if err != nil {
		return err
	}

	// retrieve id
	id, err := res.LastInsertId()
	if err != nil {
		return err
	}

	// set primary key and existence
	aug.ID = float64(id)
	aug._exists = true

	return nil
}
997849
func (tree *btree) Insert(keys ...Key) {
	for _, key := range keys {
		tree.insert(key)
	}
}
186817
func (b *Bulk) Insert(docs ...interface{}) {
	action := b.action(bulkInsert)
	action.docs = append(action.docs, docs...)
}
163675
func (m *GenericDriver) Insert(e MigrationRecord) error {

	err := transaction(m.DB, func(tx *sql.Tx) error {
		_, err := tx.Exec(m.Dialect.InsertSQL(),
			e.Version,
			e.Description,
			e.Checksum,
			e.AppliedAt.Unix(),
			e.ExecutionTime,
		)
		return err
	})

	return err
}
957180
func (au *AuthUser) Insert(db XODB) error {
	var err error

	// if already exist, bail
	if au._exists {
		return errors.New("insert failed: already exists")
	}

	// sql insert query, primary key provided by sequence
	const sqlstr = `INSERT INTO public.auth_user (` +
		`password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined` +
		`) VALUES (` +
		`$1, $2, $3, $4, $5, $6, $7, $8, $9, $10` +
		`) RETURNING id`

	// run query
	XOLog(sqlstr, au.Password, au.LastLogin, au.IsSuperuser, au.Username, au.FirstName, au.LastName, au.Email, au.IsStaff, au.IsActive, au.DateJoined)
	err = db.QueryRow(sqlstr, au.Password, au.LastLogin, au.IsSuperuser, au.Username, au.FirstName, au.LastName, au.Email, au.IsStaff, au.IsActive, au.DateJoined).Scan(&au.ID)
	if err != nil {
		return err
	}

	// set existence
	au._exists = true

	return nil
}
224264
func Insert(records ...interface{}) error {
	for _, rec := range records {
		if !isPtr(rec) {
			return NoPtr
		}

		if err := addNewFields(rec); err != nil {
			return err
		}

		s, err := GetSession()
		if err != nil {
			return err
		}
		defer s.Close()

		coll := GetColl(s, typeName(rec))
		err = coll.Insert(rec)
		if err != nil {
			return err
		}
	}

	return nil
}
432369
func (r *AppService) Insert(appinsertreq *AppInsertReq) *AppInsertCall {
	c := &AppInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.appinsertreq = appinsertreq
	return c
}
111787
func (adapter *Adapter) Insert(query grimoire.Query, changes map[string]interface{}, loggers ...grimoire.Logger) (interface{}, error) {
	statement, args := sql.NewBuilder(adapter.Config).Returning("id").Insert(query.Collection, changes)

	var result struct {
		ID int64
	}

	_, err := adapter.Query(&result, statement, args, loggers...)
	return result.ID, err
}
811948
func (l *ByteIntervalList) insert(e, at *ByteIntervalElement) *ByteIntervalElement {
	n := at.next
	at.next = e
	e.prev = at
	e.next = n
	n.prev = e
	e.list = l
	l.len++
	return e
}
996537
func (t *Table) Insert() (stmt string, names []string) {
	return t.insert.stmt, t.insert.names
}
1128801
func (ts *TripleStore) Insert(triples []*protocol.Triple) int {
	count := 0
	tx := ts.db.Begin()
	for _, triple := range triples {
		if err := tx.Create(triple).Error; err != nil {
			continue
		}
		count++
	}
	if err := tx.Commit().Error; err != nil {
		return 0
	}
	return count
}
385478
func Insert(table string) *InsertBuilder {
	return &InsertBuilder{
		tableName: table,
		query:     fmt.Sprintln(`INSERT INTO`, table),
		lock:      new(sync.Mutex),
	}
}
123333
func (auup *AuthUserUserPermission) Insert(db XODB) error {
	var err error

	// if already exist, bail
	if auup._exists {
		return errors.New("insert failed: already exists")
	}

	// sql insert query, primary key provided by sequence
	const sqlstr = `INSERT INTO public.auth_user_user_permissions (` +
		`user_id, permission_id` +
		`) VALUES (` +
		`$1, $2` +
		`) RETURNING id`

	// run query
	XOLog(sqlstr, auup.UserID, auup.PermissionID)
	err = db.QueryRow(sqlstr, auup.UserID, auup.PermissionID).Scan(&auup.ID)
	if err != nil {
		return err
	}

	// set existence
	auup._exists = true

	return nil
}
1128593
func (s *ChocolateStorage) Insert(c model.Chocolate) string {
	id := fmt.Sprintf("%d", s.idCount)
	c.ID = id
	s.chocolates[id] = &c
	s.idCount++
	return id
}
1180263
func (b *Builder) Insert(key []byte, val uint64) error {
	// ensure items are added in lexicographic order
	if bytes.Compare(key, b.last) < 0 {
		return ErrOutOfOrder
	}
	if len(key) == 0 {
		b.len = 1
		b.unfinished.setRootOutput(val)
		return nil
	}

	prefixLen, out := b.unfinished.findCommonPrefixAndSetOutput(key, val)
	b.len++
	err := b.compileFrom(prefixLen)
	if err != nil {
		return err
	}
	b.copyLastKey(key)
	b.unfinished.addSuffix(key[prefixLen:], out)

	return nil
}