Java Doc for SqlDriver.java in  » Testing » PolePosition-0.20 » com » versant » core » jdbc » sql » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » PolePosition 0.20 » com.versant.core.jdbc.sql 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.versant.core.jdbc.sql.SqlDriver

All known Subclasses:   com.versant.core.jdbc.sql.SybaseSqlDriver,  com.versant.core.jdbc.sql.OracleSqlDriver,  com.versant.core.jdbc.sql.InterbaseSqlDriver,  com.versant.core.jdbc.sql.MySqlSqlDriver,  com.versant.core.jdbc.sql.SapDbSqlDriver,  com.versant.core.jdbc.sql.InformixSqlDriver,  com.versant.core.jdbc.sql.MsSqlDriver,  com.versant.core.jdbc.sql.MckoiSqlDriver,  com.versant.core.jdbc.sql.PostgresSqlDriver,  com.versant.core.jdbc.sql.DaffodilSqlDriver,  com.versant.core.jdbc.sql.CacheSqlDriver,  com.versant.core.jdbc.sql.PointbaseSqlDriver,  com.versant.core.jdbc.sql.HypersonicSqlDriver,  com.versant.core.jdbc.sql.InformixSESqlDriver,  com.versant.core.jdbc.sql.InstantDbSqlDriver,  com.versant.core.jdbc.sql.DB2SqlDriver,
SqlDriver
abstract public class SqlDriver (Code)
This is the base class for the classes responsible for generating SQL for different databases and interfacing to JDBC drivers. There is normally one shared instance per Store. This class is also responsible for creating columns for fields and so on during meta data generation.



Field Summary
final protected static  intCOMMENT_COL
    
final public static  char[]DEFAULT_PARAM_CHARS
    
final public static  int[]JDBC_TYPES
     These are all the JDBC type codes that we care about.
protected  BytesConverter.FactorybytesConverterFactory
    
protected static  DecimalFormatdoubleFormat
    
protected  NullBytesAsBinaryConverter.FactorynullBytesAsBinaryConverterFactory
    

Constructor Summary
public  SqlDriver()
    

Method Summary
protected  voidadd(HashMap ans, JdbcJavaTypeMapping m)
     Add m to ans using its javaType as the key.
protected  voidaddPrimaryKeyConstraint(JdbcTable t, CharBuf s)
     Add the primary key constraint in isolation.
protected  voidappendAddNewColumn(JdbcTable t, JdbcColumn c, CharBuf s, boolean comments)
     Append a column that needs to be added.
protected  voidappendColumnNameList(JdbcColumn[] cols, CharBuf s)
     Append a comma separated list of column names to s.
protected  voidappendColumnType(JdbcColumn c, CharBuf s)
     Append the column type part of a create table statement for a column.
protected  voidappendColumnType(JdbcColumn c, CharBuf s, boolean useZeroScale)
     Append the column type part of a create table statement for a column.
protected  voidappendCreateColumn(JdbcTable t, JdbcColumn c, CharBuf s, boolean comments)
     Append the part of a create table statement for a column.
protected  voidappendCreateColumnAutoInc(JdbcTable t, JdbcColumn c, CharBuf s)
     Append the column auto increment part of a create table statement for a column.
protected  voidappendCreateColumnNulls(JdbcTable t, JdbcColumn c, CharBuf s)
     Append the allow nulls part of the definition for a column in a create table statement.
protected  voidappendCreateIndex(CharBuf s, JdbcTable t, JdbcIndex idx, boolean comments)
     Generate a 'create index' statement for idx.
protected  voidappendDropColumn(TableDiff tableDiff, JdbcColumn c, CharBuf s, boolean comments)
     Append a column that needs to be added.
protected  voidappendDropIndex(CharBuf s, JdbcTable t, JdbcIndex idx, boolean comments)
     Generate a 'drop index' statement for idx.
protected  voidappendIndexesInCreateTable(JdbcTable t, CharBuf s)
     Hook for drivers that must create indexes in the create table statement (e.g.
protected  voidappendModifyColumn(TableDiff tableDiff, ColumnDiff diff, CharBuf s, boolean comments)
     Append a column that needs to be added.
protected  voidappendPrimaryKeyConstraint(JdbcTable t, CharBuf s)
     Add the primary key constraint part of a create table statement to s.
protected  voidappendRefConstraint(CharBuf s, JdbcConstraint c)
     Append an 'add constraint' statement for c.
protected  voidappendRefDropConstraint(CharBuf s, JdbcConstraint c, boolean comments)
     Append an 'drop constraint' statement for c.
public  voidappendSqlColumn(JdbcColumn col, String alias, CharBuf s)
     Append the name of the column to s.
public  voidappendSqlFrom(JdbcTable table, String alias, CharBuf s)
     Append the from list entry for a table.
public  voidappendSqlFromJoin(JdbcTable table, String alias, SqlExp exp, boolean outer, CharBuf s)
     Append the from list entry for a table that is the right hand table in a join i.e.
public  voidappendSqlJoin(String leftAlias, JdbcColumn left, String rightAlias, JdbcColumn right, boolean outer, CharBuf s)
     Append a join expression.
public  voidappendSqlLiteral(int type, String value, CharBuf s)
     Append the value of the literal to s.
protected  voidappendTableType(JdbcTable t, CharBuf s)
     Hook for drivers that have to append a table type to the create table statement (e.g.
public  voidappendWhereParam(CharBuf s, JdbcColumn c)
     Append a replacable parameter part of a where clause for the column. This gives the driver a chance to embed type conversions and so on for types not handled well by the JDBC driver (e.g.
public  booleancheckDDL(ArrayList tables, Connection con, PrintWriter errors, PrintWriter fix, ControlParams params)
    
public  booleancheckDDLForStartup(ArrayList tables, Connection con, PrintWriter out, PrintWriter fix, ControlParams params)
     Make sure the database tables and columns exist.
public  booleancheckLenght(JdbcColumn ourCol, JdbcColumn dbCol)
    
public  booleancheckNulls(JdbcColumn ourCol, JdbcColumn dbCol)
    
public  booleancheckScale(JdbcColumn ourCol, JdbcColumn dbCol)
    
protected  booleancheckTable(JdbcTable t, Statement stat, PrintWriter out)
     Check that the columns of t match those in the database schema.
public  booleancheckType(JdbcColumn ourCol, JdbcColumn dbCol)
    
public  voidcleanupForGetQueryPlan(Connection con)
     Cleanup anything done in prepareForGetQueryPlan.
public  Stringcomment(String msg)
     Format a comment.
protected  DefaultJdbcNameGeneratorcreateDefaultJdbcNameGenerator()
    
public static  DrivercreateJdbcDriver(String name, ClassLoader cl)
     Load a JDBC driver class and create an instance of it.
public  JdbcNameGeneratorcreateJdbcNameGenerator()
     Create a default name generator instance for JdbcStore's using this driver.
public static  SqlDrivercreateSqlDriver(String name, Driver jdbcDriver)
     Create a SqlDriver instance by name.
public  voidcustomizeForServer(Connection con)
     Perform any specific configuration appropriate for the database server in use.
public static  RuntimeExceptiondefaultMapException(Throwable cause, String message, boolean isFatal)
     Maps a backend exception to a specific JDO exception. This is the default implementation which is used if no SqlDriver instance is available.
Parameters:
  cause - the backend exception
Parameters:
  message - error message.
protected  voiddropPrimaryKeyConstraint(JdbcTable t, CharBuf s)
     Drop the primary key constraint in isolation.
public  voiddropTable(Connection con, String table)
     Drop the table and all its constraints etc.
protected  voiddropTable(Connection con, String table, Statement stat)
     Drop the table and all its constraints etc.
public  voidenableIdentityInsert(Connection con, String table, boolean on)
     Enable or disable identity insert for the given table if this is required to insert a value into an identity column.
public  voidfillDatabaseMetaData(ArrayList tables, HashMap dbMap)
    
public  voidfixAllNames(HashMap nameMap)
    
protected  voidfixColumnsNonDirect(TableDiff tableDiff, PrintWriter out)
    
protected  voidfixConstraintsForNonDirectColumns(TableDiff tableDiff, PrintWriter out, boolean drop)
    
protected  voidfixCoulumns(TableDiff tableDiff, PrintWriter out)
    
protected  voidfixIndexForNonDirectColumns(TableDiff tableDiff, PrintWriter out, boolean drop)
    
public  voidgenerateConstraints(JdbcTable t, Statement stat, PrintWriter out, boolean comments)
     Generate the 'add constraint' statements for t.
public  voidgenerateCreateIndexes(JdbcTable t, Statement stat, PrintWriter out, boolean comments)
     Generate the 'create index' statements for t.
public  voidgenerateCreateTable(JdbcTable t, Statement stat, PrintWriter out, boolean comments)
     Generate a 'create table' statement for t.
public  voidgenerateDDL(ArrayList tables, Connection con, PrintWriter out, boolean comments)
     Generate SQL to create the database schema for the supplied tables.
public  intgetAggregateTypeCode(int aggType, int currentTypeCode)
     Calculate the typeCode for a aggregate expression.
public  StringgetAliasPrepend()
    
public  ObjectgetAutoIncColumnValue(JdbcTable classTable, Connection con, Statement stat)
     Retrieve the value of the autoinc or serial column for a row just inserted using stat on con.
public  StringgetAutoIncPostInsertSQLSuffix(JdbcTable classTable)
     Get extra SQL to be appended to the insert statement for retrieving the value of an autoinc column after insert.
protected  StringgetCatalog(Connection con)
    
protected  ColumnDiffgetColumnDiffForName(TableDiff tableDiff, String name)
    
public  StringgetConnectionInitSQL()
     Get default SQL used to init a connection or null if none required.
public  StringgetConnectionValidateSQL()
     Get default SQL to test a connection or null if none available.
protected  ConstraintDiffgetConstraintDiffForName(TableDiff tableDiff, String name, boolean db)
    
public  HashMapgetDBSchema(Connection con, ControlParams params)
     Get the JdbcTable from the database for the given database connection and table name.
public  HashMapgetDatabaseMetaData(ArrayList tables, Connection con)
     Get all the database tables and columns that is not system tables and that is filled with what field it belongs to.
protected  StringgetDefaultForType(JdbcColumn ourCol)
    
public  intgetDefaultPsCacheMax()
    
protected  StringgetDefaultValueComment()
    
public static  StringgetDriverFromURL(String url)
     Try and guess an appropriate SqlDriver name from a JDBC URL.
protected  IndexDiffgetIndexDiffForName(TableDiff tableDiff, String name, boolean db)
    
public  HashMapgetJavaTypeMappings()
     Get the default field mappings for this driver.
public  intgetMajorVersion()
    
public  intgetMaxInOperands()
     What is the maximum number of parameters allowed for the IN (?, ..
public  intgetMinorVersion()
    
public  StringgetMinorVersionPatchLevel()
    
abstract public  StringgetName()
     Get the name of this driver.
public static  StringgetNameFromURL(String url)
     Try and guess an appropriate SqlDriver name from a JDBC URL.
public  StringgetQueryPlan(Connection con, PreparedStatement ps)
     Get the query plan for ps and cleanup anything done in prepareForGetQueryPlan.
public  StringgetRunCommand()
    
protected  StringgetSchema(Connection con)
    
public  char[]getSelectForUpdate()
     Get whatever needs to be appended to a SELECT statement to lock the rows if this makes sense for the database.
public  StringgetSqlBinaryOp(int op)
     Get the string form of a binary operator.
public  StringgetSqlParamString(int jdbcType)
     Get a String for a replacable parameter.
public  char[]getSqlParamStringChars(int jdbcType)
     Return a shared char[] of the sqlParamString.
public  StringgetSqlUnaryFunctionName(int func)
     Get the name of a function that accepts one argument.
public  ArrayListgetTableNames(Connection con)
     Get the names of all tables in the database con is connected to.
protected  StringgetTempColumnName(JdbcTable table)
    
protected  StringgetTempTableName(JdbcTable table, int lenght)
    
protected  JdbcTypeMappinggetTypeMapping(int jdbcType)
     Get the default type mapping for the supplied JDBC type code from java.sql.Types or null if the type is not supported.
final public  JdbcTypeMapping[]getTypeMappings()
     Get the default type mappings for this driver.
protected  StringgetTypeName(int jdbcType)
     Get the database specific name for the jdbcType.
public  StringgetVersion()
    
protected  voidinit(Driver jdbcDriver)
     Perform any driver specific customization.
 booleanisAddSequenceColumn(JdbcColumn addColumn)
    
public  booleanisAnsiJoinSyntax()
     Does this driver use the ANSI join syntax (i.e.
public  booleanisAutoIncSupported()
    
public  booleanisBatchingSupportedForJdbcType(int jdbcType)
    
public  booleanisClearBatchRequired()
     Some drivers require a call to clear the batches.
public  booleanisCommentSupported()
    
public  booleanisConvertExistsToDistinctJoin()
     Must 'exists (select ...)' clauses be converted into a join and distinct be added to the select (e.g.
public  booleanisConvertExistsToJoins(int type)
    
public  booleanisCustomizeForServerRequired()
     Does this store do anything in SqlDriver.customizeForServer(java.sql.Connection) .
 booleanisDirectAddColumnSupported(JdbcColumn ourCol)
    
 booleanisDirectDropColumnSupported()
    
 booleanisDirectLenghtColumnChangesSupported(JdbcColumn ourCol, JdbcColumn dbCol)
    
 booleanisDirectNullColumnChangesSupported()
    
 booleanisDirectScaleColumnChangesSupported(JdbcColumn ourCol, JdbcColumn dbCol)
    
 booleanisDirectTypeColumnChangesSupported(JdbcColumn ourCol, JdbcColumn dbCol)
    
 booleanisDropConstraintsForDropTableSupported()
    
 booleanisDropPrimaryKeySupported()
    
 booleanisDropSequenceColumn(TableDiff tableDiff, JdbcColumn dropColumn)
    
public  booleanisDuplicateKey(Throwable e)
    
public  booleanisExtraParens()
    
public  booleanisFetchSizeSupported()
    
public  booleanisHandleDuplicateKey()
    
public  booleanisHandleLockTimeout()
    
public  booleanisInsertBatchingSupported()
    
public  booleanisLikeStupid()
     Does the LIKE operator only support literal string and column arguments (e.g.
public  booleanisLockTimeout(Throwable e)
    
public  booleanisNullForeignKeyOk()
    
public  booleanisOptimizeExistsUnderOrToOuterJoin()
    
public  booleanisOracleStoreProcs()
    
public  booleanisPreparedStatementPoolingOK()
    
public  booleanisPutOrderColsInSelect()
    
public  booleanisScrollableResultSetSupported()
    
public  booleanisSelectForUpdateAppendTable()
    
public  booleanisSelectForUpdateWithAggregateOk()
    
public  booleanisSelectForUpdateWithDistinctOk()
    
public  booleanisSetTransactionIsolationLevelSupported()
    
public  booleanisSubQueryJoinMayUseOuterQueryCols()
     May the ON clauses for joins in a subquery reference columns from the enclosing query? DB2 does not allow this.
public  booleanisUpdateBatchingSupported()
    
public  booleanisUseIndexesForOrderCols()
     Should indexes be used for columns in the order by list that are also in the select list? This is used for databases that will not order by a column that is duplicated in the select list (e.g.
protected  booleanisValidSchemaTable(String tableName)
    
public  RuntimeExceptionmapException(Throwable cause, String message, boolean isFatal)
     Maps a backend exception to a specific JDO exception
Parameters:
  cause - the backend exception
Parameters:
  message - error message.
public static  RuntimeExceptionmapException(SqlDriver sqlDriver, Throwable cause, String message)
     Convenience method, which gets the SqlDriver instance from the store and calls its mapException() method.
public static  RuntimeExceptionmapException(SqlDriver sqlDriver, Throwable cause, String message, boolean isFatal)
     Convenience method, which gets the SqlDriver instance from the store and calls its mapException() method. If no SqlDriver is set, SqlDriver.defaultMapException() is called.
Parameters:
  sqlDriver -
Parameters:
  cause - the backend exception
Parameters:
  message - error message.
protected  Stringpad(int i)
    
public  StringprepareForGetQueryPlan(Connection con, String sql)
     Get con ready for a getQueryPlan call.
protected  voidprint(PrintWriter out, String sql)
     Write an SQL statement to a script with appropriate separator.
public  booleanputOrderColsInGroupBy()
     Should columns be added to groupBy in appear in orderby and not in groupBy.
protected  voidreportFixes(ArrayList diffList, PrintWriter out)
    
public  voidsetAllTableAndViewNames(Connection con)
     Get the names of all tables in the database con is connected to.
protected  StringshrinkName(String name, int maxlen)
     Shrink the supplied name to maxlen chars if it is longer than maxlen.
public  StringtoSqlLiteral(double d)
     Convert d to a String suitable for embedding as a literal in an SQL statement.
public  StringtoSqlLiteral(long l)
     Convert l to a String suitable for embedding as a literal in an SQL statement.
public  StringtoSqlLiteral(String s)
     Convert s to a String suitable for embedding as a literal in an SQL statement.
public  StringtoSqlLiteral(boolean b)
     Convert s to a String suitable for embedding as a literal in an SQL statement.
public  voidupdateClassForPostInsertKeyGen(ClassMetaData cmd, JdbcMappingResolver mappingResolver)
     Provide an oportunity for the driver to update the column's used for post insert keygen.
public  booleanuseColAliasForAddedCols()
     Should we use the col alias for columns that was added to the select list because they are in the orderby and not in the selectList.
public  booleanuseColumnIndexForGroupBy()
     Use the index of the column in the 'group by' expression.
protected  booleanuseZeroScale(JdbcColumn c)
    

Field Detail
COMMENT_COL
final protected static int COMMENT_COL(Code)



DEFAULT_PARAM_CHARS
final public static char[] DEFAULT_PARAM_CHARS(Code)



JDBC_TYPES
final public static int[] JDBC_TYPES(Code)
These are all the JDBC type codes that we care about. All SqlDriver subclasses must provide a mapping for each of these.



bytesConverterFactory
protected BytesConverter.Factory bytesConverterFactory(Code)



doubleFormat
protected static DecimalFormat doubleFormat(Code)



nullBytesAsBinaryConverterFactory
protected NullBytesAsBinaryConverter.Factory nullBytesAsBinaryConverterFactory(Code)




Constructor Detail
SqlDriver
public SqlDriver()(Code)




Method Detail
add
protected void add(HashMap ans, JdbcJavaTypeMapping m)(Code)
Add m to ans using its javaType as the key.



addPrimaryKeyConstraint
protected void addPrimaryKeyConstraint(JdbcTable t, CharBuf s)(Code)
Add the primary key constraint in isolation.



appendAddNewColumn
protected void appendAddNewColumn(JdbcTable t, JdbcColumn c, CharBuf s, boolean comments)(Code)
Append a column that needs to be added.



appendColumnNameList
protected void appendColumnNameList(JdbcColumn[] cols, CharBuf s)(Code)
Append a comma separated list of column names to s.



appendColumnType
protected void appendColumnType(JdbcColumn c, CharBuf s)(Code)
Append the column type part of a create table statement for a column.



appendColumnType
protected void appendColumnType(JdbcColumn c, CharBuf s, boolean useZeroScale)(Code)
Append the column type part of a create table statement for a column.



appendCreateColumn
protected void appendCreateColumn(JdbcTable t, JdbcColumn c, CharBuf s, boolean comments)(Code)
Append the part of a create table statement for a column.



appendCreateColumnAutoInc
protected void appendCreateColumnAutoInc(JdbcTable t, JdbcColumn c, CharBuf s)(Code)
Append the column auto increment part of a create table statement for a column.



appendCreateColumnNulls
protected void appendCreateColumnNulls(JdbcTable t, JdbcColumn c, CharBuf s)(Code)
Append the allow nulls part of the definition for a column in a create table statement.



appendCreateIndex
protected void appendCreateIndex(CharBuf s, JdbcTable t, JdbcIndex idx, boolean comments)(Code)
Generate a 'create index' statement for idx.



appendDropColumn
protected void appendDropColumn(TableDiff tableDiff, JdbcColumn c, CharBuf s, boolean comments)(Code)
Append a column that needs to be added.



appendDropIndex
protected void appendDropIndex(CharBuf s, JdbcTable t, JdbcIndex idx, boolean comments)(Code)
Generate a 'drop index' statement for idx.



appendIndexesInCreateTable
protected void appendIndexesInCreateTable(JdbcTable t, CharBuf s)(Code)
Hook for drivers that must create indexes in the create table statement (e.g. MySQL).



appendModifyColumn
protected void appendModifyColumn(TableDiff tableDiff, ColumnDiff diff, CharBuf s, boolean comments)(Code)
Append a column that needs to be added.



appendPrimaryKeyConstraint
protected void appendPrimaryKeyConstraint(JdbcTable t, CharBuf s)(Code)
Add the primary key constraint part of a create table statement to s.



appendRefConstraint
protected void appendRefConstraint(CharBuf s, JdbcConstraint c)(Code)
Append an 'add constraint' statement for c.



appendRefDropConstraint
protected void appendRefDropConstraint(CharBuf s, JdbcConstraint c, boolean comments)(Code)
Append an 'drop constraint' statement for c.



appendSqlColumn
public void appendSqlColumn(JdbcColumn col, String alias, CharBuf s)(Code)
Append the name of the column to s. If col is null then append '*'.
See Also:   ColumnExp



appendSqlFrom
public void appendSqlFrom(JdbcTable table, String alias, CharBuf s)(Code)
Append the from list entry for a table.



appendSqlFromJoin
public void appendSqlFromJoin(JdbcTable table, String alias, SqlExp exp, boolean outer, CharBuf s)(Code)
Append the from list entry for a table that is the right hand table in a join i.e. it is being joined to.
Parameters:
  exp - This is the expression that joins the tables
Parameters:
  outer - If true then this is an outer join



appendSqlJoin
public void appendSqlJoin(String leftAlias, JdbcColumn left, String rightAlias, JdbcColumn right, boolean outer, CharBuf s)(Code)
Append a join expression.



appendSqlLiteral
public void appendSqlLiteral(int type, String value, CharBuf s)(Code)
Append the value of the literal to s.
See Also:   LiteralExp



appendTableType
protected void appendTableType(JdbcTable t, CharBuf s)(Code)
Hook for drivers that have to append a table type to the create table statement (e.g. MySQL).



appendWhereParam
public void appendWhereParam(CharBuf s, JdbcColumn c)(Code)
Append a replacable parameter part of a where clause for the column. This gives the driver a chance to embed type conversions and so on for types not handled well by the JDBC driver (e.g. BigDecimals and the postgres JDBC driver).



checkDDL
public boolean checkDDL(ArrayList tables, Connection con, PrintWriter errors, PrintWriter fix, ControlParams params) throws SQLException(Code)



checkDDLForStartup
public boolean checkDDLForStartup(ArrayList tables, Connection con, PrintWriter out, PrintWriter fix, ControlParams params) throws SQLException(Code)
Make sure the database tables and columns exist. This is used as a quick check when the server starts.



checkLenght
public boolean checkLenght(JdbcColumn ourCol, JdbcColumn dbCol)(Code)



checkNulls
public boolean checkNulls(JdbcColumn ourCol, JdbcColumn dbCol)(Code)



checkScale
public boolean checkScale(JdbcColumn ourCol, JdbcColumn dbCol)(Code)



checkTable
protected boolean checkTable(JdbcTable t, Statement stat, PrintWriter out)(Code)
Check that the columns of t match those in the database schema.



checkType
public boolean checkType(JdbcColumn ourCol, JdbcColumn dbCol)(Code)



cleanupForGetQueryPlan
public void cleanupForGetQueryPlan(Connection con)(Code)
Cleanup anything done in prepareForGetQueryPlan. Example: On Sybase this will do a 'set showplan 0' and 'set noexec 0'.
See Also:   SqlDriver.prepareForGetQueryPlan
See Also:   SqlDriver.getQueryPlan



comment
public String comment(String msg)(Code)
Format a comment.



createDefaultJdbcNameGenerator
protected DefaultJdbcNameGenerator createDefaultJdbcNameGenerator()(Code)



createJdbcDriver
public static Driver createJdbcDriver(String name, ClassLoader cl)(Code)
Load a JDBC driver class and create an instance of it. The driver class is unregistered if possible.



createJdbcNameGenerator
public JdbcNameGenerator createJdbcNameGenerator()(Code)
Create a default name generator instance for JdbcStore's using this driver.



createSqlDriver
public static SqlDriver createSqlDriver(String name, Driver jdbcDriver)(Code)
Create a SqlDriver instance by name.
Parameters:
  jdbcDriver - Optional JDBC driver for more accurate feature use
throws:
  javax.jdo.JDOFatalUserException - if name is invalid
See Also:   SqlDriver.customizeForServer



customizeForServer
public void customizeForServer(Connection con) throws SQLException(Code)
Perform any specific configuration appropriate for the database server in use. If any SQL is done on con call con.commit() before returning.



defaultMapException
public static RuntimeException defaultMapException(Throwable cause, String message, boolean isFatal)(Code)
Maps a backend exception to a specific JDO exception. This is the default implementation which is used if no SqlDriver instance is available.
Parameters:
  cause - the backend exception
Parameters:
  message - error message. if null, the error message istaken from the backend exception
Parameters:
  isFatal - is the error fatal or not



dropPrimaryKeyConstraint
protected void dropPrimaryKeyConstraint(JdbcTable t, CharBuf s)(Code)
Drop the primary key constraint in isolation.



dropTable
public void dropTable(Connection con, String table) throws SQLException(Code)
Drop the table and all its constraints etc. This must remove constraints to this table from other tables so it can be dropped.



dropTable
protected void dropTable(Connection con, String table, Statement stat) throws SQLException(Code)
Drop the table and all its constraints etc. This must remove constraints to this table from other tables so it can be dropped.



enableIdentityInsert
public void enableIdentityInsert(Connection con, String table, boolean on) throws SQLException(Code)
Enable or disable identity insert for the given table if this is required to insert a value into an identity column.



fillDatabaseMetaData
public void fillDatabaseMetaData(ArrayList tables, HashMap dbMap)(Code)
Fill the db classes with mapping info



fixAllNames
public void fixAllNames(HashMap nameMap)(Code)
Fixes all the names with spaces in
Parameters:
  nameMap -



fixColumnsNonDirect
protected void fixColumnsNonDirect(TableDiff tableDiff, PrintWriter out)(Code)



fixConstraintsForNonDirectColumns
protected void fixConstraintsForNonDirectColumns(TableDiff tableDiff, PrintWriter out, boolean drop)(Code)



fixCoulumns
protected void fixCoulumns(TableDiff tableDiff, PrintWriter out)(Code)



fixIndexForNonDirectColumns
protected void fixIndexForNonDirectColumns(TableDiff tableDiff, PrintWriter out, boolean drop)(Code)



generateConstraints
public void generateConstraints(JdbcTable t, Statement stat, PrintWriter out, boolean comments) throws SQLException(Code)
Generate the 'add constraint' statements for t.



generateCreateIndexes
public void generateCreateIndexes(JdbcTable t, Statement stat, PrintWriter out, boolean comments) throws SQLException(Code)
Generate the 'create index' statements for t.



generateCreateTable
public void generateCreateTable(JdbcTable t, Statement stat, PrintWriter out, boolean comments) throws SQLException(Code)
Generate a 'create table' statement for t.



generateDDL
public void generateDDL(ArrayList tables, Connection con, PrintWriter out, boolean comments)(Code)
Generate SQL to create the database schema for the supplied tables. If con is not null then it must have autoCommit true.



getAggregateTypeCode
public int getAggregateTypeCode(int aggType, int currentTypeCode)(Code)
Calculate the typeCode for a aggregate expression.
Parameters:
  aggType - The aggregate type.
Parameters:
  currentTypeCode - The currenct calculated typeCode.
See Also:   MDStatics



getAliasPrepend
public String getAliasPrepend()(Code)



getAutoIncColumnValue
public Object getAutoIncColumnValue(JdbcTable classTable, Connection con, Statement stat) throws SQLException(Code)
Retrieve the value of the autoinc or serial column for a row just inserted using stat on con.
See Also:   SqlDriver.getAutoIncPostInsertSQLSuffix(JdbcTable)



getAutoIncPostInsertSQLSuffix
public String getAutoIncPostInsertSQLSuffix(JdbcTable classTable)(Code)
Get extra SQL to be appended to the insert statement for retrieving the value of an autoinc column after insert. Return null if none is required or a separate query is run.
See Also:   SqlDriver.getAutoIncColumnValue(JdbcTable,Connection,Statement)



getCatalog
protected String getCatalog(Connection con) throws SQLException(Code)



getColumnDiffForName
protected ColumnDiff getColumnDiffForName(TableDiff tableDiff, String name)(Code)
Gets the Column diff for the column name, else returns null



getConnectionInitSQL
public String getConnectionInitSQL()(Code)
Get default SQL used to init a connection or null if none required.



getConnectionValidateSQL
public String getConnectionValidateSQL()(Code)
Get default SQL to test a connection or null if none available. This must be a query that returns at least one row.



getConstraintDiffForName
protected ConstraintDiff getConstraintDiffForName(TableDiff tableDiff, String name, boolean db)(Code)
Gets the Constraint diff for the constraint name, else returns null



getDBSchema
public HashMap getDBSchema(Connection con, ControlParams params) throws SQLException(Code)
Get the JdbcTable from the database for the given database connection and table name.



getDatabaseMetaData
public HashMap getDatabaseMetaData(ArrayList tables, Connection con) throws SQLException(Code)
Get all the database tables and columns that is not system tables and that is filled with what field it belongs to.



getDefaultForType
protected String getDefaultForType(JdbcColumn ourCol)(Code)



getDefaultPsCacheMax
public int getDefaultPsCacheMax()(Code)
How many PreparedStatement's should the pool be limited to by default (0 for unlimited) ?



getDefaultValueComment
protected String getDefaultValueComment()(Code)



getDriverFromURL
public static String getDriverFromURL(String url)(Code)
Try and guess an appropriate SqlDriver name from a JDBC URL. Returns null if no match.



getIndexDiffForName
protected IndexDiff getIndexDiffForName(TableDiff tableDiff, String name, boolean db)(Code)
Gets the Index diff for the index name, else returns null



getJavaTypeMappings
public HashMap getJavaTypeMappings()(Code)
Get the default field mappings for this driver. These map java classes to column properties. Subclasses should override this, call super() and replace mappings as needed.



getMajorVersion
public int getMajorVersion()(Code)



getMaxInOperands
public int getMaxInOperands()(Code)
What is the maximum number of parameters allowed for the IN (?, .. ?) operator?



getMinorVersion
public int getMinorVersion()(Code)



getMinorVersionPatchLevel
public String getMinorVersionPatchLevel()(Code)



getName
abstract public String getName()(Code)
Get the name of this driver.



getNameFromURL
public static String getNameFromURL(String url)(Code)
Try and guess an appropriate SqlDriver name from a JDBC URL. Returns null if no match.



getQueryPlan
public String getQueryPlan(Connection con, PreparedStatement ps)(Code)
Get the query plan for ps and cleanup anything done in prepareForGetQueryPlan. Return null if this is not supported.
See Also:   SqlDriver.prepareForGetQueryPlan
See Also:   SqlDriver.cleanupForGetQueryPlan



getRunCommand
public String getRunCommand()(Code)



getSchema
protected String getSchema(Connection con)(Code)



getSelectForUpdate
public char[] getSelectForUpdate()(Code)
Get whatever needs to be appended to a SELECT statement to lock the rows if this makes sense for the database. This must have a leading space if not empty.



getSqlBinaryOp
public String getSqlBinaryOp(int op)(Code)
Get the string form of a binary operator.
See Also:   BinaryOpExp



getSqlParamString
public String getSqlParamString(int jdbcType)(Code)
Get a String for a replacable parameter. This gives the driver a chance to embed type conversions and so on for types not handled well by the JDBC driver (e.g. BigDecimals and the postgres JDBC driver).

If you override this method then you must also override SqlDriver.getSqlParamStringChars(int) .




getSqlParamStringChars
public char[] getSqlParamStringChars(int jdbcType)(Code)
Return a shared char[] of the sqlParamString. This array may not be modified. It is used as a stamp when creating a in list.
Parameters:
  jdbcType -



getSqlUnaryFunctionName
public String getSqlUnaryFunctionName(int func)(Code)
Get the name of a function that accepts one argument.
See Also:   UnaryFunctionExp



getTableNames
public ArrayList getTableNames(Connection con) throws SQLException(Code)
Get the names of all tables in the database con is connected to.



getTempColumnName
protected String getTempColumnName(JdbcTable table)(Code)



getTempTableName
protected String getTempTableName(JdbcTable table, int lenght)(Code)



getTypeMapping
protected JdbcTypeMapping getTypeMapping(int jdbcType)(Code)
Get the default type mapping for the supplied JDBC type code from java.sql.Types or null if the type is not supported. There is no need to set the database or jdbcType on the mapping as this is done after this call returns. Subclasses should override this and to customize type mappings.



getTypeMappings
final public JdbcTypeMapping[] getTypeMappings()(Code)
Get the default type mappings for this driver. These map JDBC type codes from java.sql.Types to column properties.
See Also:   SqlDriver.getTypeMapping



getTypeName
protected String getTypeName(int jdbcType)(Code)
Get the database specific name for the jdbcType.
See Also:   Types



getVersion
public String getVersion()(Code)



init
protected void init(Driver jdbcDriver)(Code)
Perform any driver specific customization. This can be used to control functionality depending on the version of JDBC driver in use etc.



isAddSequenceColumn
boolean isAddSequenceColumn(JdbcColumn addColumn)(Code)

Parameters:
  addColumn -



isAnsiJoinSyntax
public boolean isAnsiJoinSyntax()(Code)
Does this driver use the ANSI join syntax (i.e. the join clauses appear in the from list e.g. postgres)?



isAutoIncSupported
public boolean isAutoIncSupported()(Code)
Does this database support autoincrement or serial columns?



isBatchingSupportedForJdbcType
public boolean isBatchingSupportedForJdbcType(int jdbcType)(Code)
Can batching be used if the statement contains a column with the given JDBC type?



isClearBatchRequired
public boolean isClearBatchRequired()(Code)
Some drivers require a call to clear the batches.



isCommentSupported
public boolean isCommentSupported()(Code)
Does this database support comments embedded in SQL?



isConvertExistsToDistinctJoin
public boolean isConvertExistsToDistinctJoin()(Code)
Must 'exists (select ...)' clauses be converted into a join and distinct be added to the select (e.g. MySQL) ?



isConvertExistsToJoins
public boolean isConvertExistsToJoins(int type)(Code)



isCustomizeForServerRequired
public boolean isCustomizeForServerRequired()(Code)
Does this store do anything in SqlDriver.customizeForServer(java.sql.Connection) . This avoids allocating a connection if it is not required which sorts out a problem we have with Torpedo.



isDirectAddColumnSupported
boolean isDirectAddColumnSupported(JdbcColumn ourCol)(Code)



isDirectDropColumnSupported
boolean isDirectDropColumnSupported()(Code)



isDirectLenghtColumnChangesSupported
boolean isDirectLenghtColumnChangesSupported(JdbcColumn ourCol, JdbcColumn dbCol)(Code)



isDirectNullColumnChangesSupported
boolean isDirectNullColumnChangesSupported()(Code)



isDirectScaleColumnChangesSupported
boolean isDirectScaleColumnChangesSupported(JdbcColumn ourCol, JdbcColumn dbCol)(Code)



isDirectTypeColumnChangesSupported
boolean isDirectTypeColumnChangesSupported(JdbcColumn ourCol, JdbcColumn dbCol)(Code)



isDropConstraintsForDropTableSupported
boolean isDropConstraintsForDropTableSupported()(Code)



isDropPrimaryKeySupported
boolean isDropPrimaryKeySupported()(Code)



isDropSequenceColumn
boolean isDropSequenceColumn(TableDiff tableDiff, JdbcColumn dropColumn)(Code)
Is this a sequence column from a List implementation that we are dropping to create a Set?



isDuplicateKey
public boolean isDuplicateKey(Throwable e)(Code)
Is this a duplicate key exception?



isExtraParens
public boolean isExtraParens()(Code)
Must some expressions (+, -, string concat) be wrapped in brackets?



isFetchSizeSupported
public boolean isFetchSizeSupported()(Code)
Does the JDBC driver support Statement.setFetchSize()?



isHandleDuplicateKey
public boolean isHandleDuplicateKey()(Code)
Does the driver detect and handle exceptions caused by duplicate primary keys?



isHandleLockTimeout
public boolean isHandleLockTimeout()(Code)
Does the driver detect and handle exceptions caused by lock timeouts?



isInsertBatchingSupported
public boolean isInsertBatchingSupported()(Code)
Does the JDBC driver support statement batching for inserts?



isLikeStupid
public boolean isLikeStupid()(Code)
Does the LIKE operator only support literal string and column arguments (e.g. Informix)?



isLockTimeout
public boolean isLockTimeout(Throwable e)(Code)
Is this a lock timeout exception?



isNullForeignKeyOk
public boolean isNullForeignKeyOk()(Code)
Is null a valid value for a column with a foreign key constraint?



isOptimizeExistsUnderOrToOuterJoin
public boolean isOptimizeExistsUnderOrToOuterJoin()(Code)
Is it ok to convert simple 'exists (select ...)' clauses under an 'or' into outer joins?



isOracleStoreProcs
public boolean isOracleStoreProcs()(Code)



isPreparedStatementPoolingOK
public boolean isPreparedStatementPoolingOK()(Code)
Should PreparedStatement batching be used for this database and JDBC driver?



isPutOrderColsInSelect
public boolean isPutOrderColsInSelect()(Code)
Must columns used in an order by statement appear in the select list?



isScrollableResultSetSupported
public boolean isScrollableResultSetSupported()(Code)
Does the JDBC driver support scrollable result sets?



isSelectForUpdateAppendTable
public boolean isSelectForUpdateAppendTable()(Code)
Does 'SELECT FOR UPDATE' require the main table of the query to be appended (ala postgres)?



isSelectForUpdateWithAggregateOk
public boolean isSelectForUpdateWithAggregateOk()(Code)



isSelectForUpdateWithDistinctOk
public boolean isSelectForUpdateWithDistinctOk()(Code)
Can 'SELECT FOR UPDATE' be used with a DISTINCT?



isSetTransactionIsolationLevelSupported
public boolean isSetTransactionIsolationLevelSupported()(Code)
Can the tx isolation level be set on this database?



isSubQueryJoinMayUseOuterQueryCols
public boolean isSubQueryJoinMayUseOuterQueryCols()(Code)
May the ON clauses for joins in a subquery reference columns from the enclosing query? DB2 does not allow this.



isUpdateBatchingSupported
public boolean isUpdateBatchingSupported()(Code)
Does the JDBC driver support statement batching for updates?



isUseIndexesForOrderCols
public boolean isUseIndexesForOrderCols()(Code)
Should indexes be used for columns in the order by list that are also in the select list? This is used for databases that will not order by a column that is duplicated in the select list (e.g. Oracle).



isValidSchemaTable
protected boolean isValidSchemaTable(String tableName)(Code)



mapException
public RuntimeException mapException(Throwable cause, String message, boolean isFatal)(Code)
Maps a backend exception to a specific JDO exception
Parameters:
  cause - the backend exception
Parameters:
  message - error message. if null, the error message istaken from the backend exception
Parameters:
  isFatal - is the error fatal or not



mapException
public static RuntimeException mapException(SqlDriver sqlDriver, Throwable cause, String message)(Code)
Convenience method, which gets the SqlDriver instance from the store and calls its mapException() method. isFatal defaults to true. If no SqlDriver is set, SqlDriver.defaultMapException() is called.
Parameters:
  sqlDriver -
Parameters:
  cause - the backend exception
Parameters:
  message - error message. if null, the error message is



mapException
public static RuntimeException mapException(SqlDriver sqlDriver, Throwable cause, String message, boolean isFatal)(Code)
Convenience method, which gets the SqlDriver instance from the store and calls its mapException() method. If no SqlDriver is set, SqlDriver.defaultMapException() is called.
Parameters:
  sqlDriver -
Parameters:
  cause - the backend exception
Parameters:
  message - error message. if null, the error message istaken from the backend exception
Parameters:
  isFatal - is the error fatal or not



pad
protected String pad(int i)(Code)
Get a string back with lengh i



prepareForGetQueryPlan
public String prepareForGetQueryPlan(Connection con, String sql)(Code)
Get con ready for a getQueryPlan call. Example: On Sybase this will do a 'set showplan 1' and 'set noexec 1'. Also make whatever changes are necessary to sql to prepare it for a getQueryPlan call. Example: On Oracle this will prepend 'explain '. The cleanupForGetQueryPlan method must be called in a finally block if this method is called.
See Also:   SqlDriver.cleanupForGetQueryPlan
See Also:   SqlDriver.getQueryPlan



print
protected void print(PrintWriter out, String sql)(Code)
Write an SQL statement to a script with appropriate separator.



putOrderColsInGroupBy
public boolean putOrderColsInGroupBy()(Code)
Should columns be added to groupBy in appear in orderby and not in groupBy.



reportFixes
protected void reportFixes(ArrayList diffList, PrintWriter out) throws SQLException(Code)



setAllTableAndViewNames
public void setAllTableAndViewNames(Connection con) throws SQLException(Code)
Get the names of all tables in the database con is connected to.



shrinkName
protected String shrinkName(String name, int maxlen)(Code)
Shrink the supplied name to maxlen chars if it is longer than maxlen. This implementation removes vowels first and then truncates if it has to.



toSqlLiteral
public String toSqlLiteral(double d)(Code)
Convert d to a String suitable for embedding as a literal in an SQL statement.



toSqlLiteral
public String toSqlLiteral(long l)(Code)
Convert l to a String suitable for embedding as a literal in an SQL statement.



toSqlLiteral
public String toSqlLiteral(String s)(Code)
Convert s to a String suitable for embedding as a literal in an SQL statement.



toSqlLiteral
public String toSqlLiteral(boolean b)(Code)
Convert s to a String suitable for embedding as a literal in an SQL statement.



updateClassForPostInsertKeyGen
public void updateClassForPostInsertKeyGen(ClassMetaData cmd, JdbcMappingResolver mappingResolver)(Code)
Provide an oportunity for the driver to update the column's used for post insert keygen.



useColAliasForAddedCols
public boolean useColAliasForAddedCols()(Code)
Should we use the col alias for columns that was added to the select list because they are in the orderby and not in the selectList.



useColumnIndexForGroupBy
public boolean useColumnIndexForGroupBy()(Code)
Use the index of the column in the 'group by' expression.



useZeroScale
protected boolean useZeroScale(JdbcColumn c)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.