diff options
Diffstat (limited to 'qadevOOo/runner/convwatch/DBHelper.java')
-rw-r--r-- | qadevOOo/runner/convwatch/DBHelper.java | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/qadevOOo/runner/convwatch/DBHelper.java b/qadevOOo/runner/convwatch/DBHelper.java index e28fafb65ec4..30df13123b99 100644 --- a/qadevOOo/runner/convwatch/DBHelper.java +++ b/qadevOOo/runner/convwatch/DBHelper.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,13 +41,13 @@ class ShareConnection private Connection m_aConnection = null; public ShareConnection() {} - + public Connection getConnection() { if (m_aConnection == null) { try - { + { m_aConnection = DBHelper.getMySQLConnection(); } catch(java.sql.SQLException e) @@ -69,7 +69,7 @@ class ShareConnection m_aCon = _aCon; m_sSQL = _sSQL; } - + public void run() { Statement oStmt = null; @@ -78,13 +78,13 @@ class ShareConnection GlobalLogWriter.get().println("DB: ERROR: in ExecSQL, connection not established."); return; } - + // Connection oCon = null; try - { + { // oCon = getMySQLConnection(); oStmt = m_aCon.createStatement(); - + GlobalLogWriter.get().println("DB: " + m_sSQL); /* ResultSet oResult = */ oStmt.executeUpdate(m_sSQL); @@ -103,8 +103,8 @@ public class DBHelper * This method inserts given values into<br> * the table 'states' * @param values a set of comma separated values to be inserted - */ - + */ + public void SQLinsertValues(Connection _aCon, String _sTableName, String value_names, String values) { if (_aCon == null) @@ -112,13 +112,13 @@ public class DBHelper GlobalLogWriter.get().println("DB: ERROR: in SQLinsertValues, connection not established."); return; } - + // String aInsertStr = ""; - // + // // aInsertStr = "INSERT INTO " + _sTableName + " (" + value_names + " ) VALUES (" + values + ")"; // ExecSQL(_aCon, aInsertStr); StringBuffer aInsertStr = new StringBuffer(); - + aInsertStr.append( "INSERT INTO " ) . append( _sTableName ); aInsertStr.append( " (").append( value_names ).append ( ")" ); aInsertStr.append(" VALUES (" ).append( values ).append( ")" ); @@ -132,13 +132,13 @@ public class DBHelper GlobalLogWriter.get().println("DB: ERROR: in SQLinsertValues, connection not established."); return; } - + // String aUpdateStr = ""; - // + // // aUpdateStr = "UPDATE " + _sTableName + " SET " + _sSet + " WHERE " + _sWhere; // ExecSQL( _aCon, aUpdateStr ); StringBuffer aUpdateStr = new StringBuffer(); - + aUpdateStr.append( "UPDATE " ).append( _sTableName ) .append( " SET " ).append( _sSet ) .append( " WHERE " ).append( _sWhere ); @@ -149,7 +149,7 @@ public class DBHelper private static String m_sDBName; private static String m_sDBUser; private static String m_sDBPasswd; - + protected synchronized void fillDBConnection(String _sInfo) { StringTokenizer aTokenizer = new StringTokenizer(_sInfo,",",false); @@ -175,12 +175,12 @@ public class DBHelper } } } - + /** * This method establishes a Connection<br> * with the database 'module_unit' on jakobus - */ - + */ + public static Connection getMySQLConnection() throws SQLException { try @@ -206,28 +206,28 @@ public class DBHelper * module/platform combination * @param mdl the name of the module, e.g. sal * @param os the name of the platform, e.g. unxsols - */ + */ // LLA: public static void SQLdeleteValues(Connection _aCon, String _sEnvironment, String _sUnitName, String _sMethodName, String _sCWS, String _sDate) // LLA: { - // LLA: String sSQL = + // LLA: String sSQL = // LLA: "DELETE FROM states WHERE " + // LLA: " unit=" + DatabaseEntry.Quote(_sUnitName) + - // LLA: " AND pf=" + DatabaseEntry.Quote (_sEnvironment) + + // LLA: " AND pf=" + DatabaseEntry.Quote (_sEnvironment) + // LLA: " AND meth=" + DatabaseEntry.Quote (_sMethodName) + // LLA: " AND cws=" + DatabaseEntry.Quote(_sCWS) + // LLA: " AND dt=" + DatabaseEntry.Quote(_sDate); - // LLA: + // LLA: // LLA: // ExecSQL(_aCon, sSQL); // LLA: } - + protected synchronized void ExecSQL(Connection _aCon, String _sSQL) { MySQLThread aSQLThread = new MySQLThread(_aCon, _sSQL); aSQLThread.start(); } + - - + // public static int QueryIntFromSQL(String _sSQL, String _sColumnName, String _sValue) // { // boolean bNeedSecondTry = false; @@ -255,10 +255,10 @@ public class DBHelper Connection oCon = null; int nValue = 0; try - { + { // oCon = getMySQLConnection(); oStmt = _aCon.createStatement(); - + ResultSet oResult = oStmt.executeQuery(_sSQL); oResult.next(); @@ -301,7 +301,7 @@ public class DBHelper } return ts + _sToQuote + ts; } - + /* default date format in the MySQL DB yyyy-MM-dd */ public static String today() { |