Re: ProblemS with LOAD statement in 4gl
Posted in 2005
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Cartlon Shew wrote: <SNIP> Ahh, here's the meat of the problem: > Just in case anyone has a better idea on how to do this, I'm trying to > copy certain records in our database and change 1 of the key values at > the same time. > > To oversimplify the scenario, let's say store_id is part of the > primary key for a whole bunch of tables. > > I want to add a whole set of records that matches store_id = 1, except > it will have store_id = 2. Get my utility dbcopy.ec (it will compile with C4GL v7.20+ or any CSDK release and an ANSI C compiler). It was written for just such situations. You can even generate the dbcopy commandlines and RUN them out of your 4GL driver without losing your cursor. Dbcopy copies data from one table to another. It was designed to copy between databases with incompatible logging modes so it uses independent connections for reading and writing. Therefore, no records are locked in the read session and there is no interference with the write session. The commandline would look something like: dbcopy -d mydatabase -t table_name -s \\ 'SELECT 2 store_id, fld2, fld3, fld4, ... FROM %s WHERE store_id = 1' For fastest processing add the -F & -f 10000 options to use bulk insertion and maximum sized communications buffers. Dbcopy.ec is included in the package utils2_ak available for download from the IIUG Software Repository. Art S. Kagel
On Tue, 22 Feb 2005 13:20:28 -0500, "Art S. Kagel" <kagel@bloomberg.net> wrote: >Cartlon Shew wrote: ><SNIP> >Ahh, here's the meat of the problem: >> Just in case anyone has a better idea on how to do this, I'm trying to >> copy certain records in our database and change 1 of the key values at >> the same time. >> >> To oversimplify the scenario, let's say store_id is part of the >> primary key for a whole bunch of tables. >> >> I want to add a whole set of records that matches store_id = 1, except >> it will have store_id = 2. > >Get my utility dbcopy.ec (it will compile with C4GL v7.20+ or any CSDK >release and an ANSI C compiler). It was written for just such situations. >You can even generate the dbcopy commandlines and RUN them out of your 4GL >driver without losing your cursor. Dbcopy copies data from one table to >another. It was designed to copy between databases with incompatible >logging modes so it uses independent connections for reading and writing. >Therefore, no records are locked in the read session and there is no >interference with the write session. The commandline would look something like: > >dbcopy -d mydatabase -t table_name -s \\ >'SELECT 2 store_id, fld2, fld3, fld4, ... FROM %s WHERE store_id = 1' > >For fastest processing add the -F & -f 10000 options to use bulk insertion >and maximum sized communications buffers. Dbcopy.ec is included in the >package utils2_ak available for download from the IIUG Software Repository. > Thanks - I was hoping you were going to tell me it handled parent-child relationships between tables ;) >Art S. Kagel