⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqlformatter.java

📁 Local Lucene ==================== Provide geographical based searching to lucene in an efficent ma
💻 JAVA
字号:
/** * Title:        <p> * Description:  <p> * Copyright:    Copyright (c) Troy Thompson, Bob Byron<p> * Company:      JavaUnderground<p> * @author       Troy Thompson, Bob Byron * @version 1.1 */package com.javaunderground.jdbc;import java.sql.*;/** * Base class for all database Formatters such as OracleFormatter. */public abstract class SqlFormatter {   /**    * Formats a blob to the following String "'<Blob length = " + blob.length()+">'"    * This method's output will not translate directly into the database. It is informational only.    * @param blob The blob to be translated    * @return The String representation of the blob    * @exception SQLException    */   protected String format(java.sql.Blob blob) throws SQLException{  	 return "'<Blob length = " + blob.length()+">'";   }   /**    * Formats a clob to the following String "'<Clob length = " + clob.length()+">'"    * This method's output will not translate directly into the database. It is informational only.    * @param clob The clob to be translated    * @return The String representation of the clob    * @exception SQLException    */   protected String format(java.sql.Clob clob)throws SQLException{     return "'<Clob length = " + clob.length()+">'";   }   /**    * Formats an Array to the following String "array.getBaseTypeName()"    * This method's output will not translate directly into the database. It is informational only.    * @param array The array to be translated    * @return The base name of the array    * @exception SQLException    *    */   protected String format(java.sql.Array array)throws SQLException{  	 return array.getBaseTypeName();   }   /**    * Formats a Ref to the following String "ref.getBaseTypeName()"    * This method's output will not translate directly into the database. It is informational only.    * @param ref The ref to be translated    * @return The base name of the ref    * @exception SQLException    */   protected String format(java.sql.Ref ref)throws SQLException{  	 return ref.getBaseTypeName();   }   /**    * Checks the String for null and returns "'" + string + "'".    * @param string String to be formatted    * @return formatted String (null returns "NULL")    */   protected String format(java.lang.String string)throws SQLException{     if(string.equals("NULL"))        return string;     else        return "'" + string + "'";   }   /**    * If object is null, Blob, Clob, Array, Ref, or String this returns the value from the protected methods    * in this class that take those Classes.    * @param o Object to be formatted    * @return formatted String    */   public String format(Object o) throws SQLException{     if (o == null)               return "NULL";     if (o instanceof Blob) 	  return format((Blob)o);     if (o instanceof Clob)       return format((Clob)o);     if (o instanceof Array)      return format((Array)o);     if (o instanceof Ref)        return format((Ref)o);     if (o instanceof String)     return format((String)o);     return o.toString();   }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -