-
Notifications
You must be signed in to change notification settings - Fork 16
/
store_all_qvd.txt
63 lines (54 loc) · 2.03 KB
/
store_all_qvd.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Script by Christof Schwarz ([email protected])
// Version: 13-Jan-2015
//
// Description:
// This include-script will store all tables of the data model
// which exist at the point of execution into a given Lib-Folder-
// connection.
// It also stores a checksum into a separate text file, so that
// the block of files can be loaded together using the other
// include script. This is a subsititute to "BINARY" load.
//
// Parameters needed:
// provide two variables with respective content:
// "vTableQVD_LibConnect" and "vTableQVD_Prefix"
//
// Examples:
/*
LET vTableQVD_LibConnect = 'lib://QVDs (qtsel_csw)/BINARY';
LET vTableQVD_Prefix = DocumentTitle();
*/
TRACE [*** SAVE ALL TABLES ***];
// Check if 2 parameters are provided correctly
IF NOT '$(vTableQVD_LibConnect)' LIKE 'lib://*' THEN
Error: Invalid variable vTableQVD_LibConnect content.;
END IF
IF Len('$(vTableQVD_Prefix)') < 2 THEN
Error: Invalid variable vTableQVD_Prefix content.;
END IF
TRACE [*** PARAMETERS: ***];
TRACE [vTableQVD_LibConnect = $(vTableQVD_LibConnect)];
TRACE [vTableQVD_Prefix = $(vTableQVD_Prefix)];
IF NOT WildMatch(vTableQVD_LibConnect, '*/', '*\') THEN
// Add missing trailling slash to the lib path
LET vTableQVD_LibConnect = vTableQVD_LibConnect & '/';
END IF;
LET vTableQVD_CheckSum = TimeStamp(Now(),'YYYYMMDDhhmmss');
// Create Checksum Table
$QVDMETADATA: LOAD '$(vTableQVD_CheckSum)' AS $QVDCHECKSUM AUTOGENERATE(1);
FOR vTableIndex = 1 TO NoOfTables();
LET vTableName = TableName(vTableIndex - 1);
IF vTableName <> '$QVDMETADATA' THEN
LET vTableQVD = vTableQVD_LibConnect & vTableQVD_Prefix & '^' & vTableName ;
TRACE [$(vTableIndex): $(vTableName) >> $(vTableQVD)];
STORE [$(vTableName)] INTO [$(vTableQVD).qvd] (qvd);
STORE $QVDMETADATA INTO [$(vTableQVD).meta.txt] (txt, delimiter is '\t');
END IF
NEXT vTableIndex;
TRACE [*** DONE WITH ALL TABLES ***];
DROP TABLE $QVDMETADATA;
// delete temporary variables
LET vTableIndex = Null();
LET vvTableName = Null();
LET vTableQVD = Null();
LET vTableQVD_CheckSum = Null();