Java Doc for Column.java in  » Database-DBMS » hsql » org » hsqldb » 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 » Database DBMS » hsql » org.hsqldb 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.hsqldb.Column

Column
public class Column (Code)
Implementation of SQL table columns as defined in DDL statements with static methods to process their values.

Enhanced type checking and conversion by fredt@users
author:
   Thomas Mueller (Hypersonic SQL Group)
author:
   fredt@users
version:
   1.8.0
since:
   Hypersonic SQL



Field Summary
final static  BigDecimalBIG_DECIMAL_0
    
final static  BigDecimalBIG_DECIMAL_1
    
final static  BigIntegerMAX_INT
    
final static  BigIntegerMAX_LONG
    
final static  BigIntegerMIN_INT
    
final static  BigIntegerMIN_LONG
    
public  HsqlNamecolumnName
    
 longidentityIncrement
    
 longidentityStart
    
static  int[]tenPower
    

Constructor Summary
 Column(HsqlName name, boolean nullable, int type, int size, int scale, boolean primarykey, Expression defexpression)
     Creates a column defined in DDL statement.

Method Summary
static  Objectadd(Object a, Object b, int type)
    
static  StringcheckChar(String s, int len, boolean check)
    
static  StringcheckVarchar(String s, int len, boolean check)
     Checks the length of a VARCHAR string.
static  intcompare(Collation collation, Object a, Object b, int type)
     Compare a with b and return int value as result.
static  intcompareTo(byte[] o1, byte[] o2)
     Compares a byte[] with another specified byte[] for order.
static  intcompareToTypeRange(Object o, int targettype)
    
static  Objectconcat(Object a, Object b)
     Concat two objects by turning them into strings first.
public static  ObjectconvertObject(Object o, int type)
     Convert an object into a Java object that represents its SQL type.

All internal type conversion operations start with this method.

public static  ObjectconvertObject(Session session, Object o, int type, int precision, int scale)
     Explicit casts are handled here.
static  DoubleconvertToDouble(Object o)
     Converter from a numeric object to Double.
static  IntegerconvertToInt(Object o)
     Converter from a numeric object to Integer.
static  LongconvertToLong(Object o)
     Converter from a numeric object to Long.
static  StringcreateSQLString(Object o, int type)
     Return an SQL representation of an object.
public static  StringcreateSQLString(double x)
    
public static  StringcreateSQLString(String s)
    
static  Objectdivide(Object a, Object b, int type)
     Divide numeric object a by object b.
 Columnduplicate(boolean withIdentity)
     Used for primary key changes.
static  ObjectenforceSize(Object obj, int type, int size, int scale, boolean check)
    
static  intgetCombinedNumberType(int type1, int type2, int expType)
     Arithmetic expression terms are promoted to a type that can represent the resulting values and avoid incorrect results.

When the result or the expression is converted to the type of the target column for storage, an exception is thrown if the resulting value cannot be stored in the column

Returns a SQL type "wide" enough to represent the result of the expression.
A type is "wider" than the other if it can represent all its numeric values.
Types narrower than INTEGER (int) are promoted to INTEGER.

 intgetDIType()
    
 intgetDITypeSub()
    
 StringgetDefaultDDL()
     Returns DDL for default value.
 ExpressiongetDefaultExpression()
     Returns default expression for the column.
 ObjectgetDefaultValue(Session session)
     Returns default value in the session context.
static  intgetNumTypeWidth(int type)
    
 intgetScale()
     Scale of the column in DDL (0 if not defined).
 intgetSize()
     Size of the column in DDL (0 if not defined).
 intgetType()
     Type of the column.
public static  byte[]hexToByteArray(String hexString)
     Converts the specified hexadecimal digit String to an equivalent array of bytes.
Parameters:
  hexString - a String of hexadecimal digits
throws:
  HsqlException - if the specified string contains non-hexadecimal digits.
 booleanisIdentity()
     Is this the identity column in the table.
 booleanisNullable()
     Is column nullable.
public  booleanisPrimaryKey()
     Is this single column primary key of the table.
static  Objectmultiply(Object a, Object b, int type)
     Multiply two numeric objects.
static  Objectnegate(Object a, int type)
     Negate a numeric object.
 voidsetDefaultExpression(Expression expr)
    
 voidsetIdentity(boolean identity, long startvalue, long increment)
    
 voidsetNullable(boolean value)
     Set nullable.
 voidsetPrimaryKey(boolean value)
     Set primary key.
 voidsetType(Column other)
    
static  Objectsubtract(Object a, Object b, int type)
     Subtract numeric object b from object a.

Field Detail
BIG_DECIMAL_0
final static BigDecimal BIG_DECIMAL_0(Code)



BIG_DECIMAL_1
final static BigDecimal BIG_DECIMAL_1(Code)



MAX_INT
final static BigInteger MAX_INT(Code)



MAX_LONG
final static BigInteger MAX_LONG(Code)



MIN_INT
final static BigInteger MIN_INT(Code)



MIN_LONG
final static BigInteger MIN_LONG(Code)



columnName
public HsqlName columnName(Code)



identityIncrement
long identityIncrement(Code)



identityStart
long identityStart(Code)



tenPower
static int[] tenPower(Code)




Constructor Detail
Column
Column(HsqlName name, boolean nullable, int type, int size, int scale, boolean primarykey, Expression defexpression) throws HsqlException(Code)
Creates a column defined in DDL statement.
Parameters:
  name -
Parameters:
  nullable -
Parameters:
  type -
Parameters:
  size -
Parameters:
  scale -
Parameters:
  identity -
Parameters:
  startvalue -
Parameters:
  increment -
Parameters:
  primarykey -
Parameters:
  defstring -




Method Detail
add
static Object add(Object a, Object b, int type) throws HsqlException(Code)
Add two object of a given type
Parameters:
  a -
Parameters:
  b -
Parameters:
  type - result
throws:
  HsqlException -



checkChar
static String checkChar(String s, int len, boolean check) throws HsqlException(Code)
Checks and pads a CHARACTER string to len size
Parameters:
  s - the string to pad to truncate
Parameters:
  len - the len to make the string
Parameters:
  check - if true, throw an exception if truncation takes place the string of size len



checkVarchar
static String checkVarchar(String s, int len, boolean check) throws HsqlException(Code)
Checks the length of a VARCHAR string.
Parameters:
  s - the string to pad to truncate
Parameters:
  len - the len to make the string
Parameters:
  check - if true, throw an exception if truncation takes place the string of size len



compare
static int compare(Collation collation, Object a, Object b, int type)(Code)
Compare a with b and return int value as result.
Parameters:
  a - instance of Java wrapper, depending on type, but always same for a & b (can be null)
Parameters:
  b - instance of Java wrapper, depending on type, but always same for a & b (can be null)
Parameters:
  type - one of the java.sql.Types result 1 if a>b, 0 if a=b, -1 if b>a
throws:
  HsqlException -



compareTo
static int compareTo(byte[] o1, byte[] o2)(Code)
Compares a byte[] with another specified byte[] for order. Returns a negative integer, zero, or a positive integer as the first object is less than, equal to, or greater than the specified second byte[].


Parameters:
  o1 - the first byte[] to be compared
Parameters:
  o2 - the second byte[] to be compared a negative integer, zero, or a positive integer as this objectis less than, equal to, or greater than the specified object.




compareToTypeRange
static int compareToTypeRange(Object o, int targettype)(Code)
returns -1, 0 , +1



concat
static Object concat(Object a, Object b) throws HsqlException(Code)
Concat two objects by turning them into strings first.
Parameters:
  a -
Parameters:
  b - result
throws:
  HsqlException -



convertObject
public static Object convertObject(Object o, int type) throws HsqlException(Code)
Convert an object into a Java object that represents its SQL type.

All internal type conversion operations start with this method. If a direct conversion doesn't take place, the object is converted into a string first and an attempt is made to convert the string into the target type.
One objective of this mehod is to ensure the Object can be converted to the given SQL type. For example, a very large BIGINT value cannot be narrowed down to an INTEGER or SMALLINT.
Type conversion performed by this method has gradually evolved in 1.7.2 to allow narrowing of numeric types in all cases according to the SQL standard.
Another new objective is to normalize DATETIME values.
Objects set via JDBC PreparedStatement use this method to convert the data to the Java type that is required for custom serialization by the engine.

Parameters:
  o -
Parameters:
  type - result
throws:
  HsqlException -




convertObject
public static Object convertObject(Session session, Object o, int type, int precision, int scale) throws HsqlException(Code)
Explicit casts are handled here. This is separate from the implicit casts carried out when inserting/updating rows. SQL standard 6.12 rules for enforcement of size, precision and scale are implemented here are as follows: For no size, precision or scale, default to convertObject(Object) Right truncation is allowed only for CHAR to CHAR casts (CHAR is generic for all string types). For other casts to CHAR, right truncation is not allowed. For numeric conversions, scale is always converted to target first, then precision is imposed. No truncation is allowed. (fredt)



convertToDouble
static Double convertToDouble(Object o) throws HsqlException(Code)
Converter from a numeric object to Double. Input is checked to be within range represented by Double



convertToInt
static Integer convertToInt(Object o) throws HsqlException(Code)
Converter from a numeric object to Integer. Input is checked to be within range represented by Integer.



convertToLong
static Long convertToLong(Object o) throws HsqlException(Code)
Converter from a numeric object to Long. Input is checked to be within range represented by Long.



createSQLString
static String createSQLString(Object o, int type) throws HsqlException(Code)
Return an SQL representation of an object. Strings will be quoted with single quotes, other objects will represented as in a SQL statement.
Parameters:
  o -
Parameters:
  type - result
throws:
  HsqlException -



createSQLString
public static String createSQLString(double x)(Code)



createSQLString
public static String createSQLString(String s)(Code)
Turns a java string into a quoted SQL string
Parameters:
  s - java string quoted SQL string



divide
static Object divide(Object a, Object b, int type) throws HsqlException(Code)
Divide numeric object a by object b.
Parameters:
  a -
Parameters:
  b -
Parameters:
  type - result
throws:
  HsqlException -



duplicate
Column duplicate(boolean withIdentity) throws HsqlException(Code)
Used for primary key changes.



enforceSize
static Object enforceSize(Object obj, int type, int size, int scale, boolean check) throws HsqlException(Code)
Check an object for type CHAR and VARCHAR and truncate/pad based on the size
Parameters:
  obj - object to check
Parameters:
  type - the object type
Parameters:
  size - size to enforce
Parameters:
  check - throw if too long the altered object if the right type, else the objectpassed in unaltered
throws:
  HsqlException - if data too long



getCombinedNumberType
static int getCombinedNumberType(int type1, int type2, int expType)(Code)
Arithmetic expression terms are promoted to a type that can represent the resulting values and avoid incorrect results.

When the result or the expression is converted to the type of the target column for storage, an exception is thrown if the resulting value cannot be stored in the column

Returns a SQL type "wide" enough to represent the result of the expression.
A type is "wider" than the other if it can represent all its numeric values.
Types narrower than INTEGER (int) are promoted to INTEGER. The order is as follows

INTEGER, BIGINT, DOUBLE, DECIMAL

TINYINT and SMALLINT in any combination return INTEGER
INTEGER and INTEGER return BIGINT
BIGINT and INTEGER return NUMERIC/DECIMAL
BIGINT and BIGINT return NUMERIC/DECIMAL
DOUBLE and INTEGER return DOUBLE
DOUBLE and BIGINT return DOUBLE
NUMERIC/DECIMAL and any type returns NUMERIC/DECIMAL

author:
   fredt@users
Parameters:
  type1 - java.sql.Types value for the first numeric type
Parameters:
  type2 - java.sql.Types value for the second numeric type either type1 or type2 on the basis of the above order




getDIType
int getDIType()(Code)



getDITypeSub
int getDITypeSub()(Code)



getDefaultDDL
String getDefaultDDL()(Code)
Returns DDL for default value.



getDefaultExpression
Expression getDefaultExpression()(Code)
Returns default expression for the column.



getDefaultValue
Object getDefaultValue(Session session) throws HsqlException(Code)
Returns default value in the session context.



getNumTypeWidth
static int getNumTypeWidth(int type)(Code)

Parameters:
  type - java.sql.Types int for a numeric type relative width



getScale
int getScale()(Code)
Scale of the column in DDL (0 if not defined). DDL scale of column



getSize
int getSize()(Code)
Size of the column in DDL (0 if not defined). DDL size of column



getType
int getType()(Code)
Type of the column. java.sql.Types int value for the column



hexToByteArray
public static byte[] hexToByteArray(String hexString) throws HsqlException(Code)
Converts the specified hexadecimal digit String to an equivalent array of bytes.
Parameters:
  hexString - a String of hexadecimal digits
throws:
  HsqlException - if the specified string contains non-hexadecimal digits. a byte array equivalent to the specified string of hexadecimal digits



isIdentity
boolean isIdentity()(Code)
Is this the identity column in the table. boolean



isNullable
boolean isNullable()(Code)
Is column nullable. boolean



isPrimaryKey
public boolean isPrimaryKey()(Code)
Is this single column primary key of the table. boolean



multiply
static Object multiply(Object a, Object b, int type) throws HsqlException(Code)
Multiply two numeric objects.
Parameters:
  a -
Parameters:
  b -
Parameters:
  type - result
throws:
  HsqlException -



negate
static Object negate(Object a, int type) throws HsqlException(Code)
Negate a numeric object.
Parameters:
  a -
Parameters:
  type - result
throws:
  HsqlException -



setDefaultExpression
void setDefaultExpression(Expression expr)(Code)



setIdentity
void setIdentity(boolean identity, long startvalue, long increment) throws HsqlException(Code)



setNullable
void setNullable(boolean value)(Code)
Set nullable.



setPrimaryKey
void setPrimaryKey(boolean value)(Code)
Set primary key.



setType
void setType(Column other)(Code)



subtract
static Object subtract(Object a, Object b, int type) throws HsqlException(Code)
Subtract numeric object b from object a.
Parameters:
  a -
Parameters:
  b -
Parameters:
  type - result
throws:
  HsqlException -



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.