jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.dbutil
Class ClobColumnDescriptor

java.lang.Object
  extended byuk.co.weft.dbutil.ColumnDescriptor
      extended byuk.co.weft.dbutil.ClobColumnDescriptor

public class ClobColumnDescriptor
extends ColumnDescriptor

CLOBs are large chunks of text which may be stored in or returned by a database. The contents of a CLOB may be too large to handle comfortably in core and consequently it may be handy to store them out to the filesystem; however that will vary from application to application. If a value passed into a ClobColumnDescriptor is a file, the descriptor will ever after store values it gets back from the database in files; otherwise it won't. Warning: there's clearly more thinking to be done here. There may need to be a limit size above which we stop handling these things in core. In any case we have to handle it in core as we're composing the SQL string to send to the database, so it's pretty academic...


Field Summary
static int MAXSTRINGSIZE
          the largest string I will return -- bigger than this and I will create a file.
 
Constructor Summary
ClobColumnDescriptor(java.lang.String n)
           
 
Method Summary
protected  java.lang.String format(Context c)
          what we're going to store in CLOBs is essentially files; and we don't want to store the name of the file, we want to store the content.
protected  java.lang.Object interpret(Context context, java.sql.ResultSet results)
          Read the result from the database either into a String in the context or into a file in the file system depending on the value of useFile.
 
Methods inherited from class uk.co.weft.dbutil.ColumnDescriptor
createColumnDescriptor, formatForInsert, formatForMatch, formatForMatch, formatForSelect, formatForUpdate, genKey, quoteValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAXSTRINGSIZE

public static int MAXSTRINGSIZE
the largest string I will return -- bigger than this and I will create a file.

Constructor Detail

ClobColumnDescriptor

public ClobColumnDescriptor(java.lang.String n)
Parameters:
n - the name of this coumn
Method Detail

format

protected java.lang.String format(Context c)
                           throws DataFormatException
what we're going to store in CLOBs is essentially files; and we don't want to store the name of the file, we want to store the content. Of course, the value of the name in the context may be neither a File object nor the String name of a file, in which case it's the data. Fun disambiguating that...

Overrides:
format in class ColumnDescriptor
Parameters:
c - a context in which a value for my name may be found.
Throws:
DataFormatException

interpret

protected java.lang.Object interpret(Context context,
                                     java.sql.ResultSet results)
                              throws DataFormatException
Read the result from the database either into a String in the context or into a file in the file system depending on the value of useFile. TODO: need to find a way of recycling these files, otherwise the file system will silt up.

Overrides:
interpret in class ColumnDescriptor
Parameters:
context - the service context
results - the results to interpret
Returns:
a file object which is a handle on a file containing the data from the field, or else a String.
Throws:
DataFormatException

jacquard 1.12.0 by The Web Engineering Factory and Toolworks