src/dird/ua_cmds.c
int create_pool(JCR *jcr, BDB *db, POOL *pool, e_pool_op op)
{
   POOL_DBR  pr;
   memset(&pr, 0, sizeof(POOL_DBR));
   bstrncpy(pr.Name, pool->name(), sizeof(pr.Name));

   if (db_get_pool_record(jcr, db, &pr)) {
      /* Pool Exists */
      if (op == POOL_OP_UPDATE) {  /* update request */
         set_pooldbr_from_poolres(&pr, pool, op);
         set_pooldbr_references(jcr, db, &pr, pool);
         db_update_pool_record(jcr, db, &pr);
      }
      return 0;                       /* exists */
   }

   set_pooldbr_from_poolres(&pr, pool, op);
   set_pooldbr_references(jcr, db, &pr, pool);

   if (!db_create_pool_record(jcr, db, &pr)) {
      return -1;                      /* error */
   }
   return 1;
}
/*
 * Create a pool record from a given Pool resource
 *   Also called from backup.c
 * Returns: -1  on error
 *           0  record already exists
 *           1  record created
 */
Create a pool record from a given Pool resource
Also called from backup.c
Returns: -1  on error
0  record already exists
1  record created
Create a pool record from a given Pool resource Also called from backup . c Returns : - 1 on error 0 record already exists 1 record created
int create_pool(JCR *jcr, BDB *db, POOL *pool, e_pool_op op)
{
   POOL_DBR  pr;
   memset(&pr, 0, sizeof(POOL_DBR));
   bstrncpy(pr.Name, pool->name(), sizeof(pr.Name));
   if (db_get_pool_record(jcr, db, &pr)) {
      if (op == POOL_OP_UPDATE) {  
         set_pooldbr_from_poolres(&pr, pool, op);
         set_pooldbr_references(jcr, db, &pr, pool);
         db_update_pool_record(jcr, db, &pr);
      }
      return 0;                       
   }
   set_pooldbr_from_poolres(&pr, pool, op);
   set_pooldbr_references(jcr, db, &pr, pool);
   if (!db_create_pool_record(jcr, db, &pr)) {
      return -1;                      
   }
   return 1;
}
int create_pool ( JCR * jcr , BDB * db , POOL * pool , e_pool_op op ) { POOL_DBR pr ; memset ( & pr , 0 , sizeof ( POOL_DBR ) ) ; bstrncpy ( pr . Name , pool -> name ( ) , sizeof ( pr . Name ) ) ; if ( db_get_pool_record ( jcr , db , & pr ) ) { if ( op == POOL_OP_UPDATE ) { set_pooldbr_from_poolres ( & pr , pool , op ) ; set_pooldbr_references ( jcr , db , & pr , pool ) ; db_update_pool_record ( jcr , db , & pr ) ; } return 0 ; } set_pooldbr_from_poolres ( & pr , pool , op ) ; set_pooldbr_references ( jcr , db , & pr , pool ) ; if ( ! db_create_pool_record ( jcr , db , & pr ) ) { return -1 ; } return 1 ; }
Create a pool record from a given Pool resource
   Also called from backup.c
 Returns: -1  on error
           0  record already exists
           1  record created
Create a pool record from a given Pool resource Also called from backup . c Returns : - 1 on error 0 record already exists 1 record created
/* Pool Exists */ /* update request */ /* exists */ /* error */