• Antelope Release 5.10 Linux CentOS release 7.6.1810 (Core) 3.10.0 2020-05-12

 

NAME

dbadd2db - add records from one database to another

SYNOPSIS

void dbadd2db ( Dbptr dbin, Arr *records, int flags, Dbptr dbout, Dbptr dbconflict );

DESCRIPTION

dbadd2db is a kind of general purpose method of merging records from one database into another database. The records to be copied are specified as Tbl lists of record numbers for each table. These lists are referenced by an Arr of table names (this is the standard output of dbuntangle(3)).

If conflicts arise, the conflicting records from the input database are copied to the dbconflict database; these must be resolved manually. (Duplicate records are not conflicts and are not copied).

EXAMPLE

void
merge_stations ( Dbptr station_view, Dbptr dbout, Dbptr dbconflict)
{
    Arr *arr = 0 ;
    long nstations ;
    dbquery ( station_view, dbRECORD_COUNT, &nstations ) ;
    if ( nstations > 0 ) {
        dbuntangle ( station_view, &arr ) ;
        dbadd2db ( station_view, arr, 0, dbout, dbconflict ) ;
        dbfree_untangle(arr) ;
    } else {
	complain ( 0, "no records in station_view" ) ;
    }
}

LIBRARY

$(DBLIBS)

ATTRIBUTES

MT-Safe : no

SEE ALSO

dbuntangle(3)

AUTHOR

Daniel Quinlan
Printer icon