Class PgServerThread
java.lang.Object
org.h2.server.pg.PgServerThread
- All Implemented Interfaces:
Runnable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classRepresents a PostgreSQL Portal object.(package private) static classRepresents a PostgreSQL Prepared object. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CommandInterfaceprivate Stringprivate Stringprivate DataInputStreamprivate DataInputStreamprivate DataOutputStreamprivate Stringprivate booleanprivate static final booleanprivate static final intprivate static final intprivate intprivate OutputStreamprivate ByteArrayOutputStreamprivate final HashMap<String, PgServerThread.Portal> private static final int[]private final HashMap<String, PgServerThread.Prepared> private intprivate final intprivate final PgServerprivate SessionLocalprivate static final Patternprivate Socketprivate booleanprivate Threadprivate TimeZoneProviderprivate String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidKill a currently running query on this thread.private static voidcheckParamLength(int expected, int got) (package private) voidclose()Close this connection.private static StringconvertTimeZone(String value, String prefix) private static intdivide(BigInteger[] unscaled, int divisor) private voidexecuteQuery(PgServerThread.Prepared prepared, CommandInterface prep, int[] resultColumnFormat, int maxRows) private static booleanformatAsText(int pgType, int[] formatCodes, int column) Check whether the given type should be formatted as text.private Charset(package private) intprivate String(package private) Threadprivate static intgetTypeSize(int pgType, int precision) private voidinitDb()private static StringpgTimeZone(String value) private voidprocess()private bytereadByte()private voidreadFully(byte[] buff) private intreadInt()private shortprivate Stringvoidrun()private voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidsendCommandComplete(CommandInterface command, long updateCount) private voidprivate voidsendDataRow(ResultInterface result, int[] formatCodes) private voidprivate voidprivate voidsendErrorResponse(String message) private voidprivate voidprivate voidsendParameterDescription(ArrayList<? extends ParameterInterface> parameters, int[] paramTypes) private voidsendParameterStatus(String param, String value) private voidprivate voidprivate voidsendRowDescription(ResultInterface result, int[] formatCodes) private voidsetActiveRequest(CommandInterface statement) private voidsetParameter(ArrayList<? extends ParameterInterface> parameters, int pgType, int i, int[] formatCodes) (package private) voidsetProcessId(int id) (package private) voidprivate voidstartMessage(int newMessageType) private static longtoPostgreDays(long dateValue) private voidwrite(byte[] data) private voidwrite(int b) private voidwrite(ByteArrayOutputStream baos) private voidwriteDataColumn(Value v, int pgType, boolean text) private voidwriteInt(int i) private voidwriteNumericBinary(BigDecimal value) private voidwriteShort(int i) private voidprivate voidprivate voidwriteTimeBinary(long m, int numBytes) private voidwriteTimestampBinary(long m, long nanos)
-
Field Details
-
INTEGER_DATE_TYPES
private static final boolean INTEGER_DATE_TYPES- See Also:
-
SHOULD_QUOTE
-
server
-
socket
-
session
-
stop
private boolean stop -
dataInRaw
-
dataIn
-
out
-
messageType
private int messageType -
outBuffer
-
dataOut
-
thread
-
initDone
private boolean initDone -
userName
-
databaseName
-
processId
private int processId -
secret
private final int secret -
activeRequest
-
clientEncoding
-
dateStyle
-
timeZone
-
prepared
-
portals
-
POWERS10
private static final int[] POWERS10 -
MAX_GROUP_SCALE
private static final int MAX_GROUP_SCALE- See Also:
-
MAX_GROUP_SIZE
private static final int MAX_GROUP_SIZE
-
-
Constructor Details
-
PgServerThread
-
-
Method Details
-
pgTimeZone
-
convertTimeZone
-
run
-
readString
- Throws:
IOException
-
readInt
- Throws:
IOException
-
readShort
- Throws:
IOException
-
readByte
- Throws:
IOException
-
readFully
- Throws:
IOException
-
process
- Throws:
IOException
-
executeQuery
private void executeQuery(PgServerThread.Prepared prepared, CommandInterface prep, int[] resultColumnFormat, int maxRows) throws Exception - Throws:
Exception
-
getSQL
-
sendCommandComplete
- Throws:
IOException
-
sendCommandSuspended
- Throws:
IOException
-
sendDataRow
- Throws:
IOException
-
toPostgreDays
private static long toPostgreDays(long dateValue) -
writeDataColumn
- Throws:
IOException
-
divide
-
writeNumericBinary
- Throws:
IOException
-
writeTimeBinary
- Throws:
IOException
-
writeTimestampBinary
- Throws:
IOException
-
getEncoding
-
setParameter
private void setParameter(ArrayList<? extends ParameterInterface> parameters, int pgType, int i, int[] formatCodes) throws IOException - Throws:
IOException
-
checkParamLength
private static void checkParamLength(int expected, int got) -
sendErrorOrCancelResponse
- Throws:
IOException
-
sendErrorResponse
- Throws:
IOException
-
sendCancelQueryResponse
- Throws:
IOException
-
sendParameterDescription
private void sendParameterDescription(ArrayList<? extends ParameterInterface> parameters, int[] paramTypes) throws Exception - Throws:
Exception
-
sendNoData
- Throws:
IOException
-
sendRowDescription
- Throws:
IOException
-
formatAsText
private static boolean formatAsText(int pgType, int[] formatCodes, int column) Check whether the given type should be formatted as text.- Parameters:
pgType- data typeformatCodes- format codes, ornullcolumn- 0-based column number- Returns:
- true for text
-
getTypeSize
private static int getTypeSize(int pgType, int precision) -
sendErrorResponse
- Throws:
IOException
-
sendParseComplete
- Throws:
IOException
-
sendBindComplete
- Throws:
IOException
-
sendCloseComplete
- Throws:
IOException
-
initDb
private void initDb() -
close
void close()Close this connection. -
sendAuthenticationCleartextPassword
- Throws:
IOException
-
sendAuthenticationOk
- Throws:
IOException
-
sendReadyForQuery
- Throws:
IOException
-
sendBackendKeyData
- Throws:
IOException
-
writeString
- Throws:
IOException
-
writeStringPart
- Throws:
IOException
-
writeInt
- Throws:
IOException
-
writeShort
- Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
startMessage
private void startMessage(int newMessageType) -
sendMessage
- Throws:
IOException
-
sendParameterStatus
- Throws:
IOException
-
setThread
-
getThread
Thread getThread() -
setProcessId
void setProcessId(int id) -
getProcessId
int getProcessId() -
setActiveRequest
-
cancelRequest
private void cancelRequest()Kill a currently running query on this thread.
-