public class PgServer extends Object implements Service
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PORT
The default port to use for the PG server.
|
static int |
PG_TYPE_INT2VECTOR
The integer array type (for the column pg_index.indkey).
|
static int |
PG_TYPE_VARCHAR
The VARCHAR type.
|
Constructor and Description |
---|
PgServer() |
Modifier and Type | Method and Description |
---|---|
static int |
convertType(int type)
Convert the SQL type to a PostgreSQL type
|
boolean |
getAllowOthers()
Check if remote connections are allowed.
|
static String |
getCurrentSchema(Connection conn)
Get the name of the current schema.
|
static int |
getCurrentTid(String table,
String id)
Get the current transaction id.
|
static String |
getEncodingName(int code)
Get the name of this encoding code.
|
static String |
getIndexColumn(Connection conn,
int indexId,
Integer ordinalPosition,
Boolean pretty)
The Java implementation of the PostgreSQL function pg_get_indexdef.
|
String |
getName()
Get the human readable name of the service.
|
static int |
getOid(Connection conn,
String tableName)
Get the OID of an object.
|
int |
getPort()
Gets the port this service is listening on.
|
static Timestamp |
getStartTime()
Get the current system time.
|
String |
getType()
Get the human readable short name of the service.
|
String |
getURL()
Get the URL of this service in a human readable form
|
static String |
getUserById(Connection conn,
int id)
Get the user name for this id.
|
static String |
getVersion()
Get the version.
|
static boolean |
hasDatabasePrivilege(int id,
String privilege)
Check if the this session has the given database privilege.
|
static boolean |
hasTablePrivilege(String table,
String privilege)
Check if the current session has access to this table.
|
void |
init(String... args)
Initialize the service from command line options.
|
boolean |
isDaemon()
Check if a daemon thread should be used.
|
boolean |
isRunning(boolean traceError)
Check if the service is running.
|
void |
listen()
Listen for incoming connections.
|
void |
start()
Start the service.
|
void |
stop()
Stop the service.
|
public static final int DEFAULT_PORT
public static final int PG_TYPE_VARCHAR
public static final int PG_TYPE_INT2VECTOR
public void init(String... args)
Service
public String getURL()
Service
public int getPort()
Service
public void start()
Service
public void listen()
Service
public void stop()
Service
public boolean isRunning(boolean traceError)
Service
public boolean getAllowOthers()
Service
getAllowOthers
in interface Service
public String getType()
Service
public String getName()
Service
public static String getIndexColumn(Connection conn, int indexId, Integer ordinalPosition, Boolean pretty) throws SQLException
conn
- the connectionindexId
- the index idordinalPosition
- the ordinal position (null if the SQL statement
should be returned)pretty
- this flag is ignoredSQLException
public static String getCurrentSchema(Connection conn) throws SQLException
conn
- the connectionSQLException
public static int getOid(Connection conn, String tableName) throws SQLException
conn
- the connectiontableName
- the table nameSQLException
public static String getEncodingName(int code)
code
- the encoding codepublic static String getVersion()
public static Timestamp getStartTime()
public static String getUserById(Connection conn, int id) throws SQLException
conn
- the connectionid
- the user idSQLException
public static boolean hasDatabasePrivilege(int id, String privilege)
id
- the session idprivilege
- the privilege to checkpublic static boolean hasTablePrivilege(String table, String privilege)
table
- the table nameprivilege
- the privilege to checkpublic static int getCurrentTid(String table, String id)
table
- the table nameid
- the idpublic static int convertType(int type)
type
- the SQL typeCopyright © 2012 JBoss by Red Hat. All Rights Reserved.