Create a default extspace

The onconfig file does not provide a parameter that specifies default extspace name.

If the CREATE INDEX statement does not specify an extspace, the access method might raise an error or specify an external storage space.

The example in the following figure specifies a directory path as the default extspace on a UNIX™ system.

Figure 1: Creating a default extspace
mi_integer external_create(td)
MI_AM_TABLE_DESC *td;
{
...
/* Did the CREATE statement specify a named extspace? **/
dirname = mi_tab_spaceloc(td);
if (!dirname || !*dirname)
{
   /* No. Put the table in /tmp */
   dirname = (mi_string *)mi_alloc(5);
   strcpy(dirname, "/tmp");
}
sprintf(name,"%s/%s-%d", dirname, mi_tab_name(td),
      mi_tab_partnum(td));

out = mi_file_open(name,O_WRONLY|O_TRUNC|O_CREAT,0600);