lxd/db/images.go
func (c *Cluster) ImageAliasAdd(project, name string, imageID int, desc string) error {
	err := c.Transaction(func(tx *ClusterTx) error {
		enabled, err := tx.ProjectHasImages(project)
		if err != nil {
			return errors.Wrap(err, "Check if project has images")
		}
		if !enabled {
			project = "default"
		}
		return nil
	})
	if err != nil {
		return err
	}

	stmt := `
INSERT INTO images_aliases (name, image_id, description, project_id)
     VALUES (?, ?, ?, (SELECT id FROM projects WHERE name = ?))
`
	err = exec(c.db, stmt, name, imageID, desc, project)
	return err
}
func (c *Cluster) ImageAliasAdd(project, name string, imageID int, desc string) error {
	err := c.Transaction(func(tx *ClusterTx) error {
		enabled, err := tx.ProjectHasImages(project)
		if err != nil {
			return errors.Wrap(err, "Check if project has images")
		}
		if !enabled {
			project = "default"
		}
		return nil
	})
	if err != nil {
		return err
	}

	stmt := `
INSERT INTO images_aliases (name, image_id, description, project_id)
     VALUES (?, ?, ?, (SELECT id FROM projects WHERE name = ?))
`
	err = exec(c.db, stmt, name, imageID, desc, project)
	return err
}
func ( c * Cluster ) ImageAliasAdd ( project , name string , imageID int , desc string ) error { err := c . Transaction ( func ( tx * ClusterTx ) error { enabled , err := tx . ProjectHasImages ( project ) if err != nil { return errors . Wrap ( err , " " ) } if ! enabled { project = " " } return nil } ) if err != nil { return err } stmt := `
INSERT INTO images_aliases (name, image_id, description, project_id)
     VALUES (?, ?, ?, (SELECT id FROM projects WHERE name = ?))
` err = exec ( c . db , stmt , name , imageID , desc , project ) return err }
// ImageAliasAdd inserts an alias ento the database.
ImageAliasAdd inserts an alias ento the database .