From 78d9f3ecbd9203a5ad63138037960e265509efba Mon Sep 17 00:00:00 2001 From: James Moger Date: Fri, 12 Aug 2011 13:04:29 -0400 Subject: Full primitives support. --- docs/01_model_classes.mkd | 124 +++++++++++++--------------------------------- docs/05_releases.mkd | 3 +- 2 files changed, 37 insertions(+), 90 deletions(-) (limited to 'docs') diff --git a/docs/01_model_classes.mkd b/docs/01_model_classes.mkd index cd52c2b..1b370d8 100644 --- a/docs/01_model_classes.mkd +++ b/docs/01_model_classes.mkd @@ -8,64 +8,74 @@ Alternatively, model classes can be automatically generated by iciql using the m ### Configuration Requirements and Limitations 1. Your model class **must** provide a public default constructor. -2. All columns are assumed NULLABLE unless explicitly set *@IQColumn(nullable = false)*. -3. Only the specified types are supported. Other types such as arrays and custom types are not supported. -4. Triggers, views, and other advanced database features are not supported. +2. All **Object** columns are assumed NULLABLE unless explicitly set *@IQColumn(nullable = false)*. +3. All **Primitive** columns are assumed NOT NULLABLE unless explicitly set *@IQColumn(nullable = true)*. +4. Only the specified types are supported. Any other types are not supported. +5. Triggers, views, and other advanced database features are not supported. -### Fully Supported Data Types -The following data types can be used for all iciql expressions. +### Supported Data Types - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + + + + +
Standard SQL Types
java.lang.String
Fully Supported Types
+can be used for all iciql expressions +
ObjectPrimitiveSQL Type
java.lang.String VARCHAR *(length > 0)* or CLOB *(length == 0)*
java.lang.BooleanBIT
java.lang.BooleanbooleanBOOLEAN
java.lang.Byte
java.lang.Bytebyte TINYINT
java.lang.Short
java.lang.Shortshort SMALLINT
java.lang.Integer
java.lang.Integerint INT
java.lang.Long
java.lang.Longlong BIGINT
java.lang.Float
java.lang.Floatfloat REAL
java.lang.Double
java.lang.Doubledouble DOUBLE
java.math.BigDecimal
java.math.BigDecimal DECIMAL *(length == 0)* or DECIMAL(length,scale) *(length > 0)*
java.sql.Date
java.sql.Date DATE
java.sql.Time
java.sql.Time TIME
java.sql.Timestamp
java.sql.Timestamp TIMESTAMP
java.util.Date
java.util.Date TIMESTAMP
java.lang.Enum.name()
*default type*
java.lang.Enum.name()
*default type*
VARCHAR *(length > 0)* or CLOB *(length == 0)*
*EnumType.NAME*
java.lang.Enum.ordinal()
java.lang.Enum.ordinal() INT
*EnumType.ORDINAL*
java.lang.Enum implements
*com.iciql.Iciql.EnumId.enumId()*
java.lang.Enum implements
*com.iciql.Iciql.EnumId.enumId()*
INT
*EnumType.ENUMID*
H2 Database Types
java.util.UUID
Partially Supported Types
+can not be directly referenced in an expression
byte []BLOB
H2 Database Types
+fully supported when paired with an H2 database +
java.util.UUID UUID
@@ -74,70 +84,6 @@ The following data types can be used for all iciql expressions. The reverse lookup used for model generation, SQL type -> Java type, contains more mappings.
Please consult the `com.iciql.ModelUtils` class for details. -### Partially Supported Data Types -The following data types can be mapped to columns for all general statements BUT these field types may **not** be used to specify **compile-time** clauses or constraints. - - - - - - - - - - - - - - - - - - - - - - - - - - -
byte []BLOB
booleanBIT
byteTINYINT
shortSMALLINT
intINT
longBIGINT
floatREAL
doubleDOUBLE
- -#### Partially Supported Data Types Example -%BEGINCODE% -class Primitives { - @IQColumn(primaryKey = true) - int id; - - @IQColumn - String name; - - public Primitives() { - } - - public Primitives(int id, String name) { - this.id = id; - this.name = name; - } -} - -Primitives p = new Primitives(); - -// the following expressions compile, but will throw iciql runtime exceptions -db.from(p).where(p.id).is(100).selectFirst(); -db.from(p).where(p.id).atLeast(10).select(); - -// the following expressions will work as expected -db.from(p).select(); -db.from(p).where("id = ?", 100).selectFirst(); -db.from(p).where("id >= ?", 10).select(); -db.insert(new Primitives(150, "test")); -db.update(new Primitives(150, "modified")); -db.delete(new Primitives(150, "test")); -%ENDCODE% - - ## Annotation Configuration The recommended approach to setup a model class is to annotate the class and field declarations. diff --git a/docs/05_releases.mkd b/docs/05_releases.mkd index a0905e5..22ebb2e 100644 --- a/docs/05_releases.mkd +++ b/docs/05_releases.mkd @@ -7,6 +7,7 @@ **%VERSION%** ([zip](http://code.google.com/p/iciql/downloads/detail?name=%ZIP%)|[jar](http://code.google.com/p/iciql/downloads/detail?name=%JAR%))   *released %BUILDDATE%* - api change release (API v4) +- full support for primitives in all clauses - DECIMAL(length, scale) support - unspecified length String fields are now CLOB instead of TEXT. dialects can intercept this and convert to another type. e.g. MySQL dialect can change CLOB to TEXT. - Boolean now maps to BOOLEAN instead of BIT @@ -15,7 +16,7 @@ - moved dialects back to main package - improved automatic dialect determination on pooled connections - moved create table and create index statement generation into dialects -- added HSQL dialect. HSQL fails 4 out of 49 unit tests: 2 failures are unimplemented merge, 1 has been filed as a bug in HSQL. +- added HSQL dialect. HSQL fails 4 out of 49 unit tests: 2 failures are unimplemented merge, and 1 has been filed as a [bug in HSQL](https://sourceforge.net/tracker/?func=detail&aid=3390047&group_id=23316&atid=378131). - added MySQL dialect. untested. - renamed _ iq_versions table to *iq_versions* since leading _ character is troublesome for some databases. - @IQColumn(allowNull=true) -> @IQColumn(nullable=true) -- cgit v1.2.3