Progress version 10.1C
Hi All,
I'm trying to dump a number of tables(100+) to a .d file. I know I can do this as follows and cant complain it works fine..
However what I really want to do is create a procedure to do this dynamically I really don't want to have to type out the above over 100 times!!
The closest I have got is below..
This works but is upto 4 or 5 times slower than the hardcoded method and with some of the tables being rather large this is quite an overhead.
Does anyone have an alternative to the line below for a dynamic query?
thanks in advance!
Hi All,
I'm trying to dump a number of tables(100+) to a .d file. I know I can do this as follows and cant complain it works fine..
Code:
define variable chrDumpFile as character no-undo.
define stream dumpStream.
assign chrDumpFile = "c:\temp\deckleTest\pricelist.d":u.
output stream dumpStream to value(chrDumpFile).
for each abbey.pricelist no-lock:
export stream dumpStream abbey.pricelist.
end.
output stream dumpStream close.
However what I really want to do is create a procedure to do this dynamically I really don't want to have to type out the above over 100 times!!
The closest I have got is below..
Code:
define input parameter ipHanTable as handle no-undo.
define input parameter ipHanStream as handle no-undo.
output /*stream-handle ipHanStream*/ to value(substitute("c:\temp\deckleTest\&1.d",ipHanTable:name)).
define variable hanQuery as handle no-undo.
define variable intCount as integer no-undo.
define variable chrStreamData as character no-undo.
define variable intExtentCount as integer no-undo.
create query hanQuery.
hanQuery:set-buffers(ipHanTable).
hanQuery:query-prepare(substitute("for each &1.&2":u,ipHanTable:dbname,ipHanTable:name)).
hanQuery:query-open().
do while hanQuery:get-next():
assign chrStreamData = "":u.
do intCount = 1 to ipHanTable:num-fields:
if ipHanTable:buffer-field(intCount):extent > 0 then
do:
do intExtentCount = 1 to ipHanTable:buffer-field(intCount):extent:
if chrStreamData <> "":u then assign chrStreamData = chrStreamData + " ":u.
if ipHanTable:buffer-field(intCount):data-type = "character":u then
assign chrStreamData = chrStreamData + quoter(ipHanTable:buffer-field(intCount):buffer-value[intExtentCount]).
else
assign chrStreamData = chrStreamData + ipHanTable:buffer-field(intCount):buffer-value[intExtentCount].
/*export stream-handle ipHanStream ipHanTable:buffer-field(intCount):buffer-value[intExtentCount].*/
end.
end.
else
do:
if chrStreamData <> "":u then assign chrStreamData = chrStreamData + " ":u.
if ipHanTable:buffer-field(intCount):data-type = "character":u then
assign chrStreamData = chrStreamData + quoter(ipHanTable:buffer-field(intCount):buffer-value).
else
assign chrStreamData = chrStreamData + ipHanTable:buffer-field(intCount):buffer-value.
/*export stream-handle ipHanStream ipHanTable:buffer-field(intCount):buffer-value.*/
end.
end.
put unformatted chrStreamData skip.
/* export stream-handle ipHanStream chrStreamData. */
end.
output /*stream-handle ipHanStream*/ close.
This works but is upto 4 or 5 times slower than the hardcoded method and with some of the tables being rather large this is quite an overhead.
Does anyone have an alternative to the line below for a dynamic query?
Code:
export stream dumpStream abbey.pricelist.
thanks in advance!