xref: /trunk/main/testgraphical/source/dbhelper.pm (revision cdf0e10c)
1#
2# # ------------------------------------------------------------------------------
3#
4# sub DB_INSERT_INTO_TABLE_STATUS()
5# {
6#     # my $sDocID = shift;
7#     # my $sDBDistinct = shift;
8#
9#     my $sHostname = hostname;
10#
11#     my $sSQL = "INSERT INTO status (docid, dbdistinct2, hostname)";
12#     $sSQL .= "  VALUES ($docid, '$dbdistinct', '$sHostname')";
13#     ExecSQL($sSQL);
14# }
15# sub DB_UPDATE_TABLE_STATUS_SET_INFO($)
16# {
17#     # my $sDocID = shift;
18#     # my $sDBDistinct = shift;
19#     my $sInfo = shift;
20#
21#     # my $sHostname = hostname;
22#
23#     my $sInsertSQL = "UPDATE status SET info='$sInfo' WHERE docid=$docid AND dbdistinct2='$dbdistinct'";
24#     ExecSQL($sInsertSQL);
25# }
26#
27# sub DB_UPDATE_TABLE_DOCUMENTS_SET_STATE_INFO($$)
28# {
29#     # my $sDocID = shift;
30#     my $sStatus = shift;
31#     my $sError = shift;
32#
33#     my $sSQL = "UPDATE documents";
34#     $sSQL .= " SET state='" . $sStatus . "'";
35#     $sSQL .= ",info='" . $sError . "'";
36#     $sSQL .= " WHERE docid=$docid";
37#     ExecSQL($sSQL);
38# }
39# sub DB_UPDATE_TABLE_STATUS_SET_STATE($)
40# {
41#     # my $sDocID = shift;
42#     my $sStatus = shift;
43#
44#     my $sSQL = "UPDATE status";
45#     $sSQL .= " SET state='" . $sStatus . "'";
46#     $sSQL .= " WHERE docid=$docid";
47#     ExecSQL($sSQL);
48# }
49#
50# # sub DB_UPDATE_TABLE_STATUS_SET_STATE_FAILED()
51# # {
52# #     DB_UPDATE_TABLE_STATUS_SET_STATE("FAILED-FAILED");
53# # }
54# # ------------------------------------------------------------------------------
55# # sub getDBConnectionString()
56# # {
57# #     # return "server:jakobus,db:jobs_convwatch,user:admin,passwd:admin";
58# #     return "server:unoapi,db:jobs_convwatch,user:convwatch,passwd:convwatch";
59# # }
60# # ------------------------------------------------------------------------------
61# sub getSourceInfo($)
62# {
63#     my $sDBStr = shift;
64#
65#     my $sSourceVersion;
66#     if ( $sDBStr =~ / sourceversion='(.*?)',/ )
67#     {
68#         $sSourceVersion = $1;
69#         log_print( "sSourceVersion: $sSourceVersion\n");
70#     }
71#     if (! $sSourceVersion)
72#     {
73#         log_print( "Error: no value for sourceversion found.\n");
74#         return;
75#     }
76#     my $sSourceName;
77#     if ( $sDBStr =~ / sourcename='(.*?)',/ )
78#     {
79#         $sSourceName = $1;
80#         log_print( "sSourceName: $sSourceName\n");
81#     }
82#     my $sSourceCreatorType;
83#     if ( $sDBStr =~ / sourcecreatortype='(.*?)',/ )
84#     {
85#         $sSourceCreatorType = $1;
86#         log_print( "sSourceCreatorType: $sSourceCreatorType\n");
87#     }
88#     return $sSourceVersion, $sSourceName, $sSourceCreatorType;
89# }
90# # ------------------------------------------------------------------------------
91# sub getDestinationInfo($)
92# {
93#     my $sDBStr = shift;
94#
95#     my $sDestinationVersion;
96#     if ( $sDBStr =~ / destinationversion='(.*?)',/ )
97#     {
98#         $sDestinationVersion = $1;
99#         log_print( "sDestinationVersion: $sDestinationVersion\n");
100#     }
101#     if (! $sDestinationVersion)
102#     {
103#         log_print( "Error: no value for destinationversion found.\n");
104#         return;
105#     }
106#     my $sDestinationName;
107#     if ( $sDBStr =~ / destinationname='(.*?)',/ )
108#     {
109#         $sDestinationName = $1;
110#         log_print( "sDestinationName: $sDestinationName\n");
111#     }
112#     my $sDestinationCreatorType;
113#     if ( $sDBStr =~ / destinationcreatortype='(.*?)',/ )
114#     {
115#         $sDestinationCreatorType = $1;
116#         log_print( "sDestinationCreatorType: $sDestinationCreatorType\n");
117#     }
118#     return $sDestinationVersion, $sDestinationName, $sDestinationCreatorType;
119# }
120# # ------------------------------------------------------------------------------
121# # sub getMailAddress($)
122# # {
123# #     my $sDBStr = shift;
124# #     my $sMailAddress = "";
125# #     if ( $sDBStr =~ / mailfeedback='(.*?)',/ )
126# #     {
127# #         $sMailAddress = $1;
128# #         log_print( "sMailAddress: $sMailAddress\n");
129# #     }
130# #     return $sMailAddress;
131# # }
132#
133# # sub getDocumentInfo($)
134# # {
135# #     my $sDBStr = shift;
136# #
137# #     my $sDocumentPoolPath;
138# #     if ( $sDBStr =~ / documentpoolpath='(.*?)',/ )
139# #     {
140# #         $sDocumentPoolPath = $1;
141# #         log_print( "sDocumentPoolPath: $sDocumentPoolPath\n");
142# #     }
143# #     if (! $sDocumentPoolPath)
144# #     {
145# #         log_print( "Error: no value for documentpoolpath found.\n");
146# #         return;
147# #     }
148# #     my $sDocumentPool;
149# #     if ( $sDBStr =~ / documentpool='(.*?)',/ )
150# #     {
151# #         $sDocumentPool = $1;
152# #         log_print( "sDocumentPool: $sDocumentPool\n");
153# #     }
154# #     if (! $sDocumentPool)
155# #     {
156# #         log_print( "Error: no value for documentpool found.\n");
157# #         return;
158# #     }
159# #     my $sDocumentName;
160# #     if ( $sDBStr =~ / name='(.*?)',/ )
161# #     {
162# #         $sDocumentName = $1;
163# #         log_print( "sDocumentName: $sDocumentName\n");
164# #     }
165# #     return $sDocumentPoolPath, $sDocumentPool, $sDocumentName;
166# # }
167#
168# sub getDistinct($)
169# {
170#     my $sDBStr = shift;
171#     my $sDBDistinct;
172#     if ( $sDBStr =~ / dbdistinct2='(\S*?)',/ )
173#     {
174#         $sDBDistinct = $1;
175#         log_print( "dbdistinct2: $sDBDistinct\n");
176#     }
177#     return $sDBDistinct;
178# }
179#
180# sub getIDInfo($)
181# {
182#     my $sDBStr = shift;
183#     # my $dbdistinct;
184#
185#     my $sDBDistinct = getDistinct($sDBStr);
186#     # if ( $sDBStr =~ / dbdistinct2='(\S*?)',/ )
187#     # {
188#     #     $sDBDistinct = $1;
189#     #     log_print( "dbdistinct2: $sDBDistinct\n");
190#     # }
191#     if (! $sDBDistinct)
192#     {
193#         log_print( "Error: no dbdistinct given.\n");
194#         return;
195#     }
196#     my $sDocID;
197#     if ( $sDBStr =~ / docid=(\S*?),/ )
198#     {
199#         $sDocID = $1;
200#         log_print( "docid: $sDocID\n");
201#     }
202#     if (! $sDocID)
203#     {
204#         log_print( "Error: no docid given.\n");
205#         return;
206#     }
207#     return $sDBDistinct, $sDocID;
208# }
209#
210