db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert S. Sfeir" <rob...@codepuccino.com>
Subject [PATCH] DBUtility update of log handling and import cleanup
Date Sun, 23 Nov 2003 01:06:14 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ok let's see if this is closer to what you expect :-)

I also optimized the imports since per the apache docs something like java.sql.* is a no no.
Let me know.
Thanks
R
- --

Index: src/java/org/apache/ojb/broker/ant/DBUtility.java
===================================================================
RCS file: /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/ant/DBUtility.java,v
retrieving revision 1.5
diff -r1.5 DBUtility.java
56a57,58
| import org.apache.commons.logging.impl.SimpleLog;
|
58c60,67
< import java.sql.*;
- ---
| import java.sql.Connection;
| import java.sql.DriverManager;
| import java.sql.PreparedStatement;
| import java.sql.ResultSet;
| import java.sql.ResultSetMetaData;
| import java.sql.SQLException;
| import java.sql.SQLWarning;
| import java.sql.Types;
63c72
<  * exist in a specified database.  This utility does not use the jdbc
- ---
|  * exist in a specified database.  This utility does not use the jdbc
66c75
<  *
- ---
|  *
67a77
|  * @author <a href="mailto:robert@codepuccino.com">Robert S. Sfeir</a>
70c80
< public class DBUtility
- ---
| public class DBUtility
73c83,84
< 	
- ---
|
| 	private final SimpleLog logger = new SimpleLog(this.getClass().getName());
84c95
< 	 *
- ---
| 	 *
90c101
< 	 *
- ---
| 	 *
94c105
< 	public DBUtility(String jdbcDriver, String url, String user, String pwd, URLClassLoader
classLoader)
- ---
| 	public DBUtility(String jdbcDriver, String url, String user, String pwd, URLClassLoader
classLoader)
102c113
< 		m_connection = connect(jdbcDriver, url, user, pwd, classLoader);		
- ---
| 		m_connection = connect(jdbcDriver, url, user, pwd, classLoader);
104c115
< 	
- ---
|
109c120
< 			m_connection.close();	
- ---
| 			m_connection.close();
112c123
< 	
- ---
|
126c137
< 	private Connection connect(String jdbcDriver, String url, String user, String pwd, URLClassLoader
classLoader)
- ---
| 	private Connection connect(String jdbcDriver, String url, String user, String pwd, URLClassLoader
classLoader)
130c141
< 		m_connection = DriverManager.getConnection(url, user, pwd);			
- ---
| 		m_connection = DriverManager.getConnection(url, user, pwd);
133,134c144,145
< 	
< 	
- ---
|
|
137c148
< 	 *  exists, false if it doesn't exist, and throws a SQLException if the
- ---
| 	 *  exists, false if it doesn't exist, and throws a SQLException if the
140c151
< 	 *
- ---
| 	 *
152,153c163,167
< 			//System.out.println("DBUtility: looking up table: " + tableName);
< 			//System.out.println("Select * from " + tableName + " where 1=0");
- ---
| 			if( logger.isDebugEnabled() )
| 			{
| 				logger.debug( "DBUtility: looking up table: " + tableName );
| 				logger.debug( "Select * from " + tableName + " where 1=0" );
| 			}
162c176,179
< 				System.out.println("Exceeded available Oracle cursors.  Resetting connection and
trying the SQL statement again...");
- ---
| 				if(logger.isDebugEnabled())
| 				{
| 					logger.debug( "Exceeded available Oracle cursors.  Resetting connection and trying
the SQL statement again..." );
| 				}
168,169c185,189
< 				//System.out.println("DD - " + e.getMessage());
< 				bReturn = false;	
- ---
| 				if(logger.isFatalEnabled())
| 				{
| 					logger.fatal( "DD - " + e.getMessage(), e );
| 				}
| 				bReturn = false;
172c192
< 	
- ---
|
175c195
< 	
- ---
|
177c197
< 	
- ---
|
186c206
< 	
- ---
|
189,191c209,211
< 	 *  jdbc type.  Returns true if it exists, false if it doesn't exist, and throws
< 	 *  a SQLException if the connection is not established.  NOTE: If a schema is
< 	 *  required for your database, then it should have been provided in the
- ---
| 	 *  jdbc type.  Returns true if it exists, false if it doesn't exist, and throws
| 	 *  a SQLException if the connection is not established.  NOTE: If a schema is
| 	 *  required for your database, then it should have been provided in the
193c213
< 	 *
- ---
| 	 *
196,197c216,217
< 	 * @param	jdbcType		Case insensitive String representation of
< 	 * 							the jdbc type of the column.  Valid values
- ---
| 	 * @param	jdbcType		Case insensitive String representation of
| 	 * 							the jdbc type of the column.  Valid values
202c222
< 	 * 							consider the column name case when searching for
- ---
| 	 * 							consider the column name case when searching for
204c224
< 	 *
- ---
| 	 *
206c226
< 	 */	
- ---
| 	 */
220,221c240,244
< 				//System.out.println("DBUtility: looking up table: " + tableName);
< 				//System.out.println("Select * from " + tableName + " where 1=0");
- ---
| 				if( logger.isDebugEnabled() )
| 				{
| 					logger.debug( "DBUtility: looking up table: " + tableName );
| 					logger.debug( "Select * from " + tableName + " where 1=0" );
| 				}
230c253,256
< 					System.out.println("Exceeded available Oracle cursors.  Resetting connection and
trying the SQL statement again...");
- ---
| 					if(logger.isDebugEnabled())
| 					{
| 						logger.debug( "Exceeded available Oracle cursors.  Resetting connection and trying
the SQL statement again..." );
| 					}
236c262,265
< 					//System.out.println(sqle.getMessage());
- ---
| 					if(logger.isFatalEnabled())
| 					{
| 						logger.debug("An Exception occured in " + this.getClass().getName(), sqle);
| 					}
239c268
< 			}	
- ---
| 			}
241c270
< 		
- ---
|
259c288
< 						return;	
- ---
| 						return;
275c304
< 						return;	
- ---
| 						return;
277,278c306,311
< 				}				
< 				
- ---
| 				}
|
| 			}
| 			if(logger.isDebugEnabled())
| 			{
| 				logger.debug( "Found column: " + rsMeta.getColumnName( i ) );
280,281d312
< 			
< 			//System.out.println("Found column: " + rsMeta.getColumnName(i));
286,287c317,318
< 	}	
< 	
- ---
| 	}
|
292c323
< 	 *  NOTE: If a schema is required for your database, then it should have been
- ---
| 	 *  NOTE: If a schema is required for your database, then it should have been
294c325
< 	 *
- ---
| 	 *
297,298c328,329
< 	 * @param	jdbcType		Case insensitive String representation of
< 	 * 							the jdbc type of the column.  Valid values
- ---
| 	 * @param	jdbcType		Case insensitive String representation of
| 	 * 							the jdbc type of the column.  Valid values
303c334
< 	 * 							consider the column name case when searching for
- ---
| 	 * 							consider the column name case when searching for
305c336
< 	 *
- ---
| 	 *
308c339
< 	 */	
- ---
| 	 */
315c346
< 		
- ---
|
321,322c352,356
< 				//System.out.println("DBUtility: looking up table: " + tableName);
< 				//System.out.println("Select * from " + tableName + " where 1=0");
- ---
| 				if( logger.isDebugEnabled() )
| 				{
| 					logger.debug( "DBUtility: looking up table: " + tableName );
| 					logger.debug( "Select * from " + tableName + " where 1=0" );
| 				}
331c365,368
< 					System.out.println("Exceeded available Oracle cursors.  Resetting connection and
trying the SQL statement again...");
- ---
| 					if(logger.isDebugEnabled())
| 					{
| 					    logger.debug( "Exceeded available Oracle cursors.  Resetting connection and trying
the SQL statement again..." );
| 					}
333c370
< 					existsUseWarnings(tableName, columnName, jdbcType, ignoreCase);
- ---
| 					existsUseWarnings(tableName, columnName, jdbcType, ignoreCase);
337c374,377
< 					//System.out.println(sqle.getMessage());
- ---
| 					if(logger.isFatalEnabled())
| 					{
| 						logger.fatal("An Exception orrcured in " + this.getClass().getName(), sqle);
| 					}
342c382
< 		
- ---
|
360c400
< 						return;	
- ---
| 						return;
376c416
< 						return;	
- ---
| 						return;
378,379c418,423
< 				}				
< 				
- ---
| 				}
|
| 			}
| 			if(logger.isDebugEnabled())
| 			{
| 				logger.debug("Found column: " + rsMeta.getColumnName( i ) );
381,382d424
< 			
< 			//System.out.println("Found column: " + rsMeta.getColumnName(i));
387,389c429,431
< 	}		
< 	
< 	
- ---
| 	}
|
|
391c433
< 	 * 	Checks the database for the existence of this table.column.
- ---
| 	 * 	Checks the database for the existence of this table.column.
395c437
< 	 *
- ---
| 	 *
399c441
< 	 * 							consider the column name case when searching for
- ---
| 	 * 							consider the column name case when searching for
401c443
< 	 *
- ---
| 	 *
403,404c445,446
< 	 */	
< 	
- ---
| 	 */
|
411c453
< 		
- ---
|
417,418c459,463
< 				//System.out.println("DBUtility: looking up table: " + tableName);
< 				//System.out.println("Select * from " + tableName + " where 1=0");
- ---
| 				if(logger.isDebugEnabled())
| 				{
| 					logger.debug("DBUtility: looking up table: " + tableName);
| 					logger.debug( "Select * from " + tableName + " where 1=0" );
| 				}
427c472,475
< 					System.out.println("Exceeded available Oracle cursors.  Resetting connection and
trying the SQL statement again...");
- ---
| 					if(logger.isDebugEnabled())
| 					{
| 						logger.debug( "Exceeded available Oracle cursors.  Resetting connection and trying
the SQL statement again..." );
| 					}
433c481,484
< 					System.out.println(sqle.getMessage());
- ---
| 					if(logger.isFatalEnabled())
| 					{
|                         logger.fatal("An Exception occured in " + this.getClass().getName(),
sqle);
| 					}
438c489
< 		
- ---
|
457,458c508,513
< 				}				
< 				
- ---
| 				}
|
| 			}
| 			if(logger.isDebugEnabled())
| 			{
| 				logger.debug( "Found column: " + rsMeta.getColumnName( i ) );
460,461d514
< 			
< 			//System.out.println("Found column: " + rsMeta.getColumnName(i));
466,468c519,521
< 	}	
< 		
< 	
- ---
| 	}
|
|
470c523
<      * Determines the java.sql.Types constant value from an OJB
- ---
|      * Determines the java.sql.Types constant value from an OJB
472,474c525,527
<      *
<      * @param type The FIELDDESCRIPTOR which JDBC type is to be determined.
<      *
- ---
|      *
|      * @param ojbType The FIELDDESCRIPTOR which JDBC type is to be determined.
|      *
476c529
<      *
- ---
|      *
537c590
<     }	
- ---
|     }
547c600
< 			e.printStackTrace();	
- ---
| 			logger.fatal("An Exception occured in " + this.getClass().getName() + " while calling
finalize method." , e);

***** CVS exited normally with code 1 *****
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/wAgG+cV9vuB27SARAsurAKD9Lw/w66T1qMJzMTldmTQ+ovt79gCgphxs
zX1s0Acv140sAfAlptSa1MY=
=Pv/4
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message