org.d2rq.db.types
Class SQLCharacterString

java.lang.Object
  extended by org.d2rq.db.types.DataType
      extended by org.d2rq.db.types.SQLCharacterString

public class SQLCharacterString
extends DataType

Datatype for fixed-length character strings (e.g., CHAR but not VARCHAR). It does not actually store the specific length. A difference in behaviour from SQLCharacterStringVarying is that trailing spaces are not reported in results. So, even if the database stores 'AAA ', the resulting value will be 'AAA'. This seems closer to user expectations. Note that for standard SQL and many vendors (but not all), 'AAA '='AAA', so selecting still works. Vendors that do not compare strings in that way should not use this class, or selecting will break.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.d2rq.db.types.DataType
DataType.GenericType
 
Field Summary
 
Fields inherited from class org.d2rq.db.types.DataType
log
 
Constructor Summary
SQLCharacterString(String name, boolean supportsDistinct)
           
 
Method Summary
 boolean supportsDistinct()
           
 String value(ResultSet resultSet, int column)
          Retrieves a string value in preferred format (canonical form of the closest XSD type) from a SQL ResultSet.
 
Methods inherited from class org.d2rq.db.types.DataType
equals, hashCode, isIRISafe, isUnsupported, name, rdfType, toSQLLiteral, toString, valueRegex
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SQLCharacterString

public SQLCharacterString(String name,
                          boolean supportsDistinct)
Method Detail

supportsDistinct

public boolean supportsDistinct()
Overrides:
supportsDistinct in class DataType
Returns:
true if this column can be used in SELECT DISTINCT queries

value

public String value(ResultSet resultSet,
                    int column)
             throws SQLException
Description copied from class: DataType
Retrieves a string value in preferred format (canonical form of the closest XSD type) from a SQL ResultSet.

Overrides:
value in class DataType
Parameters:
resultSet - Result of a SELECT query
column - The column index to retrieve; leftmost columns is 1
Returns:
String representation, or null if SQL result was null or is not representable in the XSD type
Throws:
SQLException