public class PostgresqlSQLContext extends java.lang.Object implements SQLContext
| Constructor and Description |
|---|
PostgresqlSQLContext(AppContext ctx,
DatabaseService serv,
java.sql.Connection conn) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Clean up internal state
|
DateSQLExpression |
convertToDate(SQLExpression<? extends java.lang.Number> val,
long res)
Convert a Number
SQLExpression to a date. |
SQLExpression<? extends java.lang.Number> |
convertToMilliseconds(SQLExpression<java.util.Date> expr)
Convert a Date
SQLExpression to milliseconds |
java.sql.Connection |
getConnection()
Get a database connection for the current context
|
java.lang.String |
getConnectionHost()
Get an identifying string for the database host we are connected to.
|
AppContext |
getContext() |
FieldTypeVisitor |
getCreateVisitor(java.lang.StringBuilder sb,
java.util.List<java.lang.Object> args)
Get a
FieldTypeVisitor used to generate table specifications. |
DatabaseService |
getService()
get the
DatabaseService |
SQLExpression<java.lang.String> |
hashFunction(Hash h,
SQLExpression<java.lang.String> arg)
Generate a SQL hash function.
|
boolean |
isReadOnly()
Is this a read-only connection
|
java.lang.StringBuilder |
quote(java.lang.StringBuilder sb,
java.lang.String name)
Quote a field or table name
|
java.lang.StringBuilder |
quoteQualified(java.lang.StringBuilder sb,
java.lang.String table,
java.lang.String name)
Quote a field or table name
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconvertToSeconds, dateDifferencepublic PostgresqlSQLContext(AppContext ctx, DatabaseService serv, java.sql.Connection conn)
public java.sql.Connection getConnection()
SQLContextgetConnection in interface SQLContextpublic java.lang.StringBuilder quote(java.lang.StringBuilder sb,
java.lang.String name)
SQLContextquote in interface SQLContextsb - StringBuilderpublic java.lang.StringBuilder quoteQualified(java.lang.StringBuilder sb,
java.lang.String table,
java.lang.String name)
SQLContextquoteQualified in interface SQLContextsb - StringBuilderpublic SQLExpression<? extends java.lang.Number> convertToMilliseconds(SQLExpression<java.util.Date> expr)
SQLContextSQLExpression to millisecondsconvertToMilliseconds in interface SQLContextpublic DateSQLExpression convertToDate(SQLExpression<? extends java.lang.Number> val, long res)
SQLContextSQLExpression to a date.convertToDate in interface SQLContextres - resolution in millisecondsSQLExpressionpublic FieldTypeVisitor getCreateVisitor(java.lang.StringBuilder sb, java.util.List<java.lang.Object> args)
SQLContextFieldTypeVisitor used to generate table specifications.getCreateVisitor in interface SQLContextsb - StringBuilder to add SQL fragments toargs - List query parametersFieldTypeVisitorpublic void close()
throws java.sql.SQLException
SQLContextclose in interface SQLContextjava.sql.SQLExceptionpublic AppContext getContext()
getContext in interface Contexedpublic SQLExpression<java.lang.String> hashFunction(Hash h, SQLExpression<java.lang.String> arg) throws CannotUseSQLException
SQLContexthashFunction in interface SQLContexth - Hash algorithm to applyarg - SQLExpression to hashSQLExpressionCannotUseSQLExceptionpublic java.lang.String getConnectionHost()
SQLContextgetConnectionHost in interface SQLContextpublic DatabaseService getService()
SQLContextDatabaseServicegetService in interface SQLContextpublic boolean isReadOnly()
SQLContextisReadOnly in interface SQLContext