# dbextend

> ## Directory

> > eXtremeDB_rt/samples/dbextend

> ## Description

> > extends database storage by adding conventional memory devices

> ## Used API

> > mco_db_extend_dev()

> ## Code snippet

> >        /* Extend the database until out of memory segments */
> >           while ( MAX_SEGMENTS > n_segments ) {
> >             dev[n_segments].type         = MCO_MEMORY_CONV;               /* Set the device as a conventional memory device */
> >             dev[n_segments].assignment   = MCO_MEMORY_ASSIGN_DATABASE;    /* Assign the device as a main database memory */
> >             dev[n_segments].size         = SEGMENT_SIZE;                  /* Set the device size */
> >             dev[n_segments].dev.conv.ptr = (char*)malloc( SEGMENT_SIZE ); /* Allocate memory and set device pointer */
> >             rc = mco_db_extend_dev(db_name, &dev[n_segments]);
> >             sample_rc_check("\tExtend database", rc );
> >             if ( MCO_S_OK != rc ) break;  /* If extend failed exit loop */
> >             n_segments++;
> >           }

> ## What to expect as an output

> >     	Open database : Successful
> >     	Connect to database : Successful
> >     	Extend database : Successful
> >     	Extend database : Successful
> >     	Extend database : Successful
> >     	Extend database : Successful
> >     	Extend database : Successful
> >     	Extend database : Successful
> >     	Extend database : Successful
> >     	Extend database : Successful
> >     	Disconnect from database : Successful
> >     	Close database : Successful