Package com.impossibl.postgres.system
Class BasicContext
- java.lang.Object
-
- com.impossibl.postgres.system.AbstractContext
-
- com.impossibl.postgres.system.BasicContext
-
- All Implemented Interfaces:
Configuration
,Context
- Direct Known Subclasses:
PGDirectConnection
public class BasicContext extends AbstractContext
-
-
Constructor Summary
Constructors Constructor Description BasicContext(java.net.SocketAddress address, Settings settings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
connectionClosed()
Called whenserverConnection
was closed externally (i.e.protected void
connectionNotificationReceived(int processId, java.lang.String channelName, java.lang.String payload)
Called whenserverConnection
received an asynchronous notificationio.netty.buffer.ByteBufAllocator
getAllocator()
java.nio.charset.Charset
getCharset()
java.text.DecimalFormat
getCurrencyFormatter()
java.util.Map<java.lang.String,java.lang.Class<?>>
getCustomTypeMap()
DateTimeFormat
getDateFormat()
java.text.DecimalFormat
getDecimalFormatter()
java.text.NumberFormat
getIntegerFormatter()
ServerConnection.KeyData
getKeyData()
Registry
getRegistry()
RequestExecutor
getRequestExecutor()
protected ServerConnection
getServerConnection()
ServerInfo
getServerInfo()
<T> T
getSetting(Setting<T> setting)
DateTimeFormat
getTimeFormat()
DateTimeFormat
getTimestampFormat()
java.util.TimeZone
getTimeZone()
java.time.ZoneId
getTimeZoneId()
protected void
init(SharedRegistry.Factory sharedRegistryFactory)
boolean
isUtilQueryPrepared(java.lang.String name)
void
prepareUtilQuery(java.lang.String name, java.lang.String sql, java.lang.String... parameterTypeNames)
void
query(java.lang.String queryTxt, long timeout)
protected ResultBatch
queryBatch(java.lang.String queryTxt, long timeout)
Queries for a single (the first) result batch.protected ResultBatch
queryBatchPrepared(java.lang.String queryTxt, FieldFormatRef[] paramFormats, io.netty.buffer.ByteBuf[] paramBuffers, long timeout)
Queries a single result batch (the first) via a parameterized query.ResultBatch
queryBatchPrepared(java.lang.String queryTxt, java.lang.Object[] paramValues, long timeout)
Queries a single result batch (the first) via a parameterized query.protected java.lang.String
queryString(java.lang.String queryTxt, long timeout)
protected io.netty.channel.ChannelFuture
shutdown()
Context
unwrap()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.impossibl.postgres.system.Configuration
getSetting
-
-
-
-
Constructor Detail
-
BasicContext
public BasicContext(java.net.SocketAddress address, Settings settings) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
shutdown
protected io.netty.channel.ChannelFuture shutdown()
-
connectionClosed
protected void connectionClosed()
Called whenserverConnection
was closed externally (i.e. without callingshutdown()
-
connectionNotificationReceived
protected void connectionNotificationReceived(int processId, java.lang.String channelName, java.lang.String payload)
Called whenserverConnection
received an asynchronous notification
-
getAllocator
public io.netty.buffer.ByteBufAllocator getAllocator()
-
getServerConnection
protected ServerConnection getServerConnection()
-
getRegistry
public Registry getRegistry()
-
getRequestExecutor
public RequestExecutor getRequestExecutor()
-
getSetting
public <T> T getSetting(Setting<T> setting)
- Specified by:
getSetting
in interfaceConfiguration
- Overrides:
getSetting
in classAbstractContext
-
getCustomTypeMap
public java.util.Map<java.lang.String,java.lang.Class<?>> getCustomTypeMap()
-
getCharset
public java.nio.charset.Charset getCharset()
-
getTimeZone
public java.util.TimeZone getTimeZone()
-
getTimeZoneId
public java.time.ZoneId getTimeZoneId()
-
getServerInfo
public ServerInfo getServerInfo()
-
getKeyData
public ServerConnection.KeyData getKeyData()
-
getDateFormat
public DateTimeFormat getDateFormat()
-
getTimeFormat
public DateTimeFormat getTimeFormat()
-
getTimestampFormat
public DateTimeFormat getTimestampFormat()
-
getIntegerFormatter
public java.text.NumberFormat getIntegerFormatter()
-
getDecimalFormatter
public java.text.DecimalFormat getDecimalFormatter()
-
getCurrencyFormatter
public java.text.DecimalFormat getCurrencyFormatter()
-
init
protected void init(SharedRegistry.Factory sharedRegistryFactory) throws java.io.IOException
- Throws:
java.io.IOException
-
isUtilQueryPrepared
public boolean isUtilQueryPrepared(java.lang.String name)
-
prepareUtilQuery
public void prepareUtilQuery(java.lang.String name, java.lang.String sql, java.lang.String... parameterTypeNames) throws java.io.IOException
- Throws:
java.io.IOException
-
query
public void query(java.lang.String queryTxt, long timeout) throws java.io.IOException
- Throws:
java.io.IOException
-
queryString
protected java.lang.String queryString(java.lang.String queryTxt, long timeout) throws java.io.IOException
- Throws:
java.io.IOException
-
queryBatch
protected ResultBatch queryBatch(java.lang.String queryTxt, long timeout) throws java.io.IOException
Queries for a single (the first) result batch. The batch must be released.- Throws:
java.io.IOException
-
queryBatchPrepared
public ResultBatch queryBatchPrepared(java.lang.String queryTxt, java.lang.Object[] paramValues, long timeout) throws java.io.IOException
Queries a single result batch (the first) via a parameterized query. The batch must be released.- Throws:
java.io.IOException
-
queryBatchPrepared
protected ResultBatch queryBatchPrepared(java.lang.String queryTxt, FieldFormatRef[] paramFormats, io.netty.buffer.ByteBuf[] paramBuffers, long timeout) throws java.io.IOException
Queries a single result batch (the first) via a parameterized query. The batch must be released.- Throws:
java.io.IOException
-
unwrap
public Context unwrap()
-
-