1# ************************************************************* 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20# ************************************************************* 21# 22# # ------------------------------------------------------------------------------ 23# 24# sub DB_INSERT_INTO_TABLE_STATUS() 25# { 26# # my $sDocID = shift; 27# # my $sDBDistinct = shift; 28# 29# my $sHostname = hostname; 30# 31# my $sSQL = "INSERT INTO status (docid, dbdistinct2, hostname)"; 32# $sSQL .= " VALUES ($docid, '$dbdistinct', '$sHostname')"; 33# ExecSQL($sSQL); 34# } 35# sub DB_UPDATE_TABLE_STATUS_SET_INFO($) 36# { 37# # my $sDocID = shift; 38# # my $sDBDistinct = shift; 39# my $sInfo = shift; 40# 41# # my $sHostname = hostname; 42# 43# my $sInsertSQL = "UPDATE status SET info='$sInfo' WHERE docid=$docid AND dbdistinct2='$dbdistinct'"; 44# ExecSQL($sInsertSQL); 45# } 46# 47# sub DB_UPDATE_TABLE_DOCUMENTS_SET_STATE_INFO($$) 48# { 49# # my $sDocID = shift; 50# my $sStatus = shift; 51# my $sError = shift; 52# 53# my $sSQL = "UPDATE documents"; 54# $sSQL .= " SET state='" . $sStatus . "'"; 55# $sSQL .= ",info='" . $sError . "'"; 56# $sSQL .= " WHERE docid=$docid"; 57# ExecSQL($sSQL); 58# } 59# sub DB_UPDATE_TABLE_STATUS_SET_STATE($) 60# { 61# # my $sDocID = shift; 62# my $sStatus = shift; 63# 64# my $sSQL = "UPDATE status"; 65# $sSQL .= " SET state='" . $sStatus . "'"; 66# $sSQL .= " WHERE docid=$docid"; 67# ExecSQL($sSQL); 68# } 69# 70# # sub DB_UPDATE_TABLE_STATUS_SET_STATE_FAILED() 71# # { 72# # DB_UPDATE_TABLE_STATUS_SET_STATE("FAILED-FAILED"); 73# # } 74# # ------------------------------------------------------------------------------ 75# # sub getDBConnectionString() 76# # { 77# # # return "server:jakobus,db:jobs_convwatch,user:admin,passwd:admin"; 78# # return "server:unoapi,db:jobs_convwatch,user:convwatch,passwd:convwatch"; 79# # } 80# # ------------------------------------------------------------------------------ 81# sub getSourceInfo($) 82# { 83# my $sDBStr = shift; 84# 85# my $sSourceVersion; 86# if ( $sDBStr =~ / sourceversion='(.*?)',/ ) 87# { 88# $sSourceVersion = $1; 89# log_print( "sSourceVersion: $sSourceVersion\n"); 90# } 91# if (! $sSourceVersion) 92# { 93# log_print( "Error: no value for sourceversion found.\n"); 94# return; 95# } 96# my $sSourceName; 97# if ( $sDBStr =~ / sourcename='(.*?)',/ ) 98# { 99# $sSourceName = $1; 100# log_print( "sSourceName: $sSourceName\n"); 101# } 102# my $sSourceCreatorType; 103# if ( $sDBStr =~ / sourcecreatortype='(.*?)',/ ) 104# { 105# $sSourceCreatorType = $1; 106# log_print( "sSourceCreatorType: $sSourceCreatorType\n"); 107# } 108# return $sSourceVersion, $sSourceName, $sSourceCreatorType; 109# } 110# # ------------------------------------------------------------------------------ 111# sub getDestinationInfo($) 112# { 113# my $sDBStr = shift; 114# 115# my $sDestinationVersion; 116# if ( $sDBStr =~ / destinationversion='(.*?)',/ ) 117# { 118# $sDestinationVersion = $1; 119# log_print( "sDestinationVersion: $sDestinationVersion\n"); 120# } 121# if (! $sDestinationVersion) 122# { 123# log_print( "Error: no value for destinationversion found.\n"); 124# return; 125# } 126# my $sDestinationName; 127# if ( $sDBStr =~ / destinationname='(.*?)',/ ) 128# { 129# $sDestinationName = $1; 130# log_print( "sDestinationName: $sDestinationName\n"); 131# } 132# my $sDestinationCreatorType; 133# if ( $sDBStr =~ / destinationcreatortype='(.*?)',/ ) 134# { 135# $sDestinationCreatorType = $1; 136# log_print( "sDestinationCreatorType: $sDestinationCreatorType\n"); 137# } 138# return $sDestinationVersion, $sDestinationName, $sDestinationCreatorType; 139# } 140# # ------------------------------------------------------------------------------ 141# # sub getMailAddress($) 142# # { 143# # my $sDBStr = shift; 144# # my $sMailAddress = ""; 145# # if ( $sDBStr =~ / mailfeedback='(.*?)',/ ) 146# # { 147# # $sMailAddress = $1; 148# # log_print( "sMailAddress: $sMailAddress\n"); 149# # } 150# # return $sMailAddress; 151# # } 152# 153# # sub getDocumentInfo($) 154# # { 155# # my $sDBStr = shift; 156# # 157# # my $sDocumentPoolPath; 158# # if ( $sDBStr =~ / documentpoolpath='(.*?)',/ ) 159# # { 160# # $sDocumentPoolPath = $1; 161# # log_print( "sDocumentPoolPath: $sDocumentPoolPath\n"); 162# # } 163# # if (! $sDocumentPoolPath) 164# # { 165# # log_print( "Error: no value for documentpoolpath found.\n"); 166# # return; 167# # } 168# # my $sDocumentPool; 169# # if ( $sDBStr =~ / documentpool='(.*?)',/ ) 170# # { 171# # $sDocumentPool = $1; 172# # log_print( "sDocumentPool: $sDocumentPool\n"); 173# # } 174# # if (! $sDocumentPool) 175# # { 176# # log_print( "Error: no value for documentpool found.\n"); 177# # return; 178# # } 179# # my $sDocumentName; 180# # if ( $sDBStr =~ / name='(.*?)',/ ) 181# # { 182# # $sDocumentName = $1; 183# # log_print( "sDocumentName: $sDocumentName\n"); 184# # } 185# # return $sDocumentPoolPath, $sDocumentPool, $sDocumentName; 186# # } 187# 188# sub getDistinct($) 189# { 190# my $sDBStr = shift; 191# my $sDBDistinct; 192# if ( $sDBStr =~ / dbdistinct2='(\S*?)',/ ) 193# { 194# $sDBDistinct = $1; 195# log_print( "dbdistinct2: $sDBDistinct\n"); 196# } 197# return $sDBDistinct; 198# } 199# 200# sub getIDInfo($) 201# { 202# my $sDBStr = shift; 203# # my $dbdistinct; 204# 205# my $sDBDistinct = getDistinct($sDBStr); 206# # if ( $sDBStr =~ / dbdistinct2='(\S*?)',/ ) 207# # { 208# # $sDBDistinct = $1; 209# # log_print( "dbdistinct2: $sDBDistinct\n"); 210# # } 211# if (! $sDBDistinct) 212# { 213# log_print( "Error: no dbdistinct given.\n"); 214# return; 215# } 216# my $sDocID; 217# if ( $sDBStr =~ / docid=(\S*?),/ ) 218# { 219# $sDocID = $1; 220# log_print( "docid: $sDocID\n"); 221# } 222# if (! $sDocID) 223# { 224# log_print( "Error: no docid given.\n"); 225# return; 226# } 227# return $sDBDistinct, $sDocID; 228# } 229# 230