Class Types
java.lang.Object
fc.jdbc.dbo.Types
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetJavaTypeFromSQLType(int java_sql_type, fc.jdbc.dbo.ColumnData cd) Converts a value corresponding toto the Java type used to represent that type.invalid reference
java.sql.TypegetPreparedStmtSetMethod(int java_sql_type, String psvar, String pos, String varname, fc.jdbc.dbo.ColumnData cd) Returns a suitable setXXX method name to set the prepared statement placeholder data for some column.getPreparedStmtSetNullMethod(int java_sql_type, String pos, String varname, fc.jdbc.dbo.ColumnData cd) getResultSetMethod(int java_sql_type, String pos, fc.jdbc.dbo.ColumnData cd) Returns a suitable getResultXXX method name to retrieve the data for some column.getRuntimeResultSetMethod(int java_sql_type, String name, fc.jdbc.dbo.ColumnData cd) Returns a suitable getResultXXX method name to retrieve the data for some column (which will use a runtime prefix argument prepended to the column name).getSQLTypeName(int java_sql_type) Converts thefor some column (returned by the driver) to a readable value.invalid reference
java.sql.TypebooleanusesPrimitiveJavaType(int java_sql_type, fc.jdbc.dbo.ColumnData cd) Uses the same conversion criteria as theand then returns true if the Java type used to represent the specifiedinvalid reference
getJavaTypeFromSQLType()is primitive (int, boolean etc) as opposed to an Object type.invalid reference
java.sql.TypebooleanusesSimpleIntegralJavaType(int java_sql_type) Uses the same conversion criteria as theand then returns true if the Java type used to represent the specifiedinvalid reference
getJavaTypeFromSQLType()is integral.invalid reference
java.sql.Type
-
Constructor Details
-
Types
Constructs a new object.- Parameters:
log- logging destinationprops- PropertyManager that may contain:- dbspecific.mysql.boolean_hack
- generate.preparedstatement.setxxx.length_param
Generate)
-
-
Method Details
-
getResultSetMethod
public String getResultSetMethod(int java_sql_type, String pos, fc.jdbc.dbo.ColumnData cd) throws SQLException Returns a suitable getResultXXX method name to retrieve the data for some column. Used when generating manager code.- Parameters:
java_sql_type- thecorresponding to the column for which the method will be generatedinvalid reference
java.sql.Typepos- A string containing the column index number (starts from 1)- Throws:
SQLException
-
getRuntimeResultSetMethod
public String getRuntimeResultSetMethod(int java_sql_type, String name, fc.jdbc.dbo.ColumnData cd) throws SQLException Returns a suitable getResultXXX method name to retrieve the data for some column (which will use a runtime prefix argument prepended to the column name).- Parameters:
java_sql_type- thecorresponding to the column for which the method will be generatedinvalid reference
java.sql.Typename- column name- Throws:
SQLException
-
getPreparedStmtSetMethod
public String getPreparedStmtSetMethod(int java_sql_type, String psvar, String pos, String varname, fc.jdbc.dbo.ColumnData cd) throws SQLException Returns a suitable setXXX method name to set the prepared statement placeholder data for some column. Used when generating manager code. For example, for an integer column at position 3 and a variable name "x" (which would contain a integer value at runtime), the returned method will be of the form: "setInt(3, x)"- Parameters:
java_sql_type- thecorresponding to the column for which the method will be generatedinvalid reference
java.sql.Typepos- a String containing the column index number (starts from 1) or a runtime value to insert in generate code like "pos++"varname- the name of the variable containing the value to be set at runtime.- Throws:
SQLException
-
getPreparedStmtSetNullMethod
public String getPreparedStmtSetNullMethod(int java_sql_type, String pos, String varname, fc.jdbc.dbo.ColumnData cd) throws SQLException - Throws:
SQLException
-
getJavaTypeFromSQLType
public String getJavaTypeFromSQLType(int java_sql_type, fc.jdbc.dbo.ColumnData cd) throws SQLException Converts a value corresponding toto the Java type used to represent that type. Theinvalid reference
java.sql.Typeis returned by the jdbc driver for some column in a table and we map it to a corresponding java type that will be used to represent/work with that sql type in our java programs. This mapping follows the JDBC guidelines. Similar JDBC API method likeinvalid reference
Sql-TypeResultSetMetaData.getColumnTypeName(column)andreturn tpye names that can be driver/db specific (and don't have to correspond to Java types anyway).invalid reference
DatabaseMetaData#getColumns()- Parameters:
java_sql_type- theto convert to a java language typeinvalid reference
java.sql.Typecd- used to find out if the column is nullable (this can have the effect of using primitive or object types, in some cases, for example, Boolean vs boolean)- Throws:
SQLException
-
usesPrimitiveJavaType
public boolean usesPrimitiveJavaType(int java_sql_type, fc.jdbc.dbo.ColumnData cd) throws SQLException Uses the same conversion criteria as theand then returns true if the Java type used to represent the specifiedinvalid reference
getJavaTypeFromSQLType()is primitive (int, boolean etc) as opposed to an Object type.invalid reference
java.sql.Type- Parameters:
java_sql_type- thefor the corresponding java type.invalid reference
java.sql.Typecd- used to find out if the column is nullable (this can have the effect of using primitive or object types, in some cases, for example, Boolean vs boolean)- Throws:
SQLException
-
usesSimpleIntegralJavaType
Uses the same conversion criteria as theand then returns true if the Java type used to represent the specifiedinvalid reference
getJavaTypeFromSQLType()is integral. This is used for creating the inc/dec methods (only for short, int and long)invalid reference
java.sql.Type- Parameters:
java_sql_type- thefor the corresponding java typeinvalid reference
java.sql.Type- Throws:
SQLException
-
getSQLTypeName
Converts thefor some column (returned by the driver) to a readable value. More convenient than using the "constant field values" section of the not neatly arranged javadocs forinvalid reference
java.sql.Type.invalid reference
java.sql.TypeNote, this method is different from invalid input: '{@link /*missing*/}' because unlike invalid input: '{@link /*missing*/}', this simply returns the variable name corresponding to the parameter value (for example, java.sql.Type.INTEGER == 4 and passing 4 to this method will return "INTEGER").
- Parameters:
java_sql_type- a type frominvalid reference
java.sql.Type
-