use of com.wplatform.ddal.value.Value in project jdbc-shards by wplatform.
the class JdbcConnection method createClob.
/**
* Create a Clob value from this reader.
*
* @param x the reader
* @param length the length (if smaller or equal than 0, all data until the
* end of file is read)
* @return the value
*/
public Value createClob(Reader x, long length) {
if (x == null) {
return ValueNull.INSTANCE;
}
if (length <= 0) {
length = -1;
}
Value v = ValueLobDb.createTempClob(x, length);
session.addTemporaryLob(v);
return v;
}
use of com.wplatform.ddal.value.Value in project jdbc-shards by wplatform.
the class JdbcConnection method createNClob.
/**
* Create a new empty NClob object.
*
* @return the object
*/
@Override
public NClob createNClob() throws SQLException {
try {
int id = getNextId(TraceObject.CLOB);
debugCodeAssign("NClob", TraceObject.CLOB, id, "createNClob()");
checkClosedForWrite();
try {
Value v = ValueLobDb.createTempClob(new InputStreamReader(new ByteArrayInputStream(Utils.EMPTY_BYTES)), 0);
session.addTemporaryLob(v);
return new JdbcClob(this, v, id);
} finally {
afterWriting();
}
} catch (Exception e) {
throw logAndConvert(e);
}
}
use of com.wplatform.ddal.value.Value in project jdbc-shards by wplatform.
the class JdbcConnection method createBlob.
/**
* Create a new empty Blob object.
*
* @return the object
*/
@Override
public Blob createBlob() throws SQLException {
try {
int id = getNextId(TraceObject.BLOB);
debugCodeAssign("Blob", TraceObject.BLOB, id, "createClob()");
checkClosedForWrite();
try {
Value v = ValueLobDb.createTempBlob(new ByteArrayInputStream(Utils.EMPTY_BYTES), 0);
session.addTemporaryLob(v);
return new JdbcBlob(this, v, id);
} finally {
afterWriting();
}
} catch (Exception e) {
throw logAndConvert(e);
}
}
use of com.wplatform.ddal.value.Value in project jdbc-shards by wplatform.
the class Trace method formatParams.
/**
* Format the parameter list.
*
* @param parameters the parameter list
* @return the formatted text
*/
public static String formatParams(ArrayList<? extends ParameterInterface> parameters) {
if (parameters.size() == 0) {
return "";
}
StatementBuilder buff = new StatementBuilder();
int i = 0;
boolean params = false;
for (ParameterInterface p : parameters) {
if (p.isValueSet()) {
if (!params) {
buff.append(" {");
params = true;
}
buff.appendExceptFirst(", ");
Value v = p.getParamValue();
buff.append(++i).append(": ").append(v.getTraceSQL());
}
}
if (params) {
buff.append('}');
}
return buff.toString();
}
Aggregations