lxd/db/containers.go
func (c *Cluster) ContainerGetBackup(project, name string) (ContainerBackupArgs, error) {
	args := ContainerBackupArgs{}
	args.Name = name

	containerOnlyInt := -1
	optimizedStorageInt := -1
	q := `
SELECT containers_backups.id, containers_backups.container_id,
       containers_backups.creation_date, containers_backups.expiry_date,
       containers_backups.container_only, containers_backups.optimized_storage
    FROM containers_backups
    JOIN containers ON containers.id=containers_backups.container_id
    JOIN projects ON projects.id=containers.project_id
    WHERE projects.name=? AND containers_backups.name=?
`
	arg1 := []interface{}{project, name}
	arg2 := []interface{}{&args.ID, &args.ContainerID, &args.CreationDate,
		&args.ExpiryDate, &containerOnlyInt, &optimizedStorageInt}
	err := dbQueryRowScan(c.db, q, arg1, arg2)
	if err != nil {
		if err == sql.ErrNoRows {
			return args, ErrNoSuchObject
		}

		return args, err
	}

	if containerOnlyInt == 1 {
		args.ContainerOnly = true
	}

	if optimizedStorageInt == 1 {
		args.OptimizedStorage = true
	}

	return args, nil
}
func (c *Cluster) ContainerGetBackup(project, name string) (ContainerBackupArgs, error) {
	args := ContainerBackupArgs{}
	args.Name = name

	containerOnlyInt := -1
	optimizedStorageInt := -1
	q := `
SELECT containers_backups.id, containers_backups.container_id,
       containers_backups.creation_date, containers_backups.expiry_date,
       containers_backups.container_only, containers_backups.optimized_storage
    FROM containers_backups
    JOIN containers ON containers.id=containers_backups.container_id
    JOIN projects ON projects.id=containers.project_id
    WHERE projects.name=? AND containers_backups.name=?
`
	arg1 := []interface{}{project, name}
	arg2 := []interface{}{&args.ID, &args.ContainerID, &args.CreationDate,
		&args.ExpiryDate, &containerOnlyInt, &optimizedStorageInt}
	err := dbQueryRowScan(c.db, q, arg1, arg2)
	if err != nil {
		if err == sql.ErrNoRows {
			return args, ErrNoSuchObject
		}

		return args, err
	}

	if containerOnlyInt == 1 {
		args.ContainerOnly = true
	}

	if optimizedStorageInt == 1 {
		args.OptimizedStorage = true
	}

	return args, nil
}
func ( c * Cluster ) ContainerGetBackup ( project , name string ) ( ContainerBackupArgs , error ) { args := ContainerBackupArgs { } args . Name = name containerOnlyInt := - 1 optimizedStorageInt := - 1 q := `
SELECT containers_backups.id, containers_backups.container_id,
       containers_backups.creation_date, containers_backups.expiry_date,
       containers_backups.container_only, containers_backups.optimized_storage
    FROM containers_backups
    JOIN containers ON containers.id=containers_backups.container_id
    JOIN projects ON projects.id=containers.project_id
    WHERE projects.name=? AND containers_backups.name=?
` arg1 := [ ] interface { } { project , name } arg2 := [ ] interface { } { & args . ID , & args . ContainerID , & args . CreationDate , & args . ExpiryDate , & containerOnlyInt , & optimizedStorageInt } err := dbQueryRowScan ( c . db , q , arg1 , arg2 ) if err != nil { if err == sql . ErrNoRows { return args , ErrNoSuchObject } return args , err } if containerOnlyInt == 1 { args . ContainerOnly = true } if optimizedStorageInt == 1 { args . OptimizedStorage = true } return args , nil }
// ContainerGetBackup returns the backup with the given name.
ContainerGetBackup returns the backup with the given name .