当前位置: 首页>>代码示例>>Java>>正文


Java PGConnection类代码示例

本文整理汇总了Java中com.impossibl.postgres.api.jdbc.PGConnection的典型用法代码示例。如果您正苦于以下问题:Java PGConnection类的具体用法?Java PGConnection怎么用?Java PGConnection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PGConnection类属于com.impossibl.postgres.api.jdbc包,在下文中一共展示了PGConnection类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: refreshTypes

import com.impossibl.postgres.api.jdbc.PGConnection; //导入依赖的package包/类
@SneakyThrows
public static void refreshTypes(Connection connection) {
    PGConnection conn = getPgConnection(connection);

    PGConnectionImpl connImpl = (PGConnectionImpl) conn;
    Version serverVersion = connImpl.getServerVersion();

    //Load types
    String typeSQL = PgType.INSTANCE.getSQL(serverVersion);
    pgTypes = connImpl.queryResults(typeSQL, PgType.Row.class);

    //Load attributes
    String attrsSQL = PgAttribute.INSTANCE.getSQL(serverVersion);
    pgAttrs = connImpl.queryResults(attrsSQL, PgAttribute.Row.class);

    //Load procs
    String procsSQL = PgProc.INSTANCE.getSQL(serverVersion);
    pgProcs = connImpl.queryResults(procsSQL, PgProc.Row.class);
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:20,代码来源:PostgreSQLSerialization.java

示例2: startNotificationListener

import com.impossibl.postgres.api.jdbc.PGConnection; //导入依赖的package包/类
@Override
public void startNotificationListener(DBMSSynchronizer dbmsSynchronizer) {
    // Disable cleanup output of ThreadedHousekeeper
    Logger.getLogger(ThreadedHousekeeper.class.getName()).setLevel(Level.SEVERE);

    this.listener = new PostgresSQLNotificationListener(dbmsSynchronizer);

    PGDataSource dataSource = new PGDataSource();
    dataSource.setHost(connectionProperties.getHost());
    dataSource.setPort(connectionProperties.getPort());
    dataSource.setDatabase(connectionProperties.getDatabase());
    dataSource.setUser(connectionProperties.getUser());
    dataSource.setPassword(connectionProperties.getPassword());

    try {
        pgConnection = (PGConnection) dataSource.getConnection();
        pgConnection.createStatement().execute("LISTEN jabrefLiveUpdate");
        // Do not use `new PostgresSQLNotificationListener(...)` as the object has to exist continuously!
        // Otherwise the listener is going to be deleted by GC.
        pgConnection.addNotificationListener(listener);
    } catch (SQLException e) {
        LOGGER.error("SQL Error: ", e);
    }
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:25,代码来源:PostgreSQLProcessor.java

示例3: refreshConnectionRegistry

import com.impossibl.postgres.api.jdbc.PGConnection; //导入依赖的package包/类
public static void refreshConnectionRegistry(Connection connection) {
    PGConnection conn = getPgConnection(connection);

    PGConnectionImpl connImpl = (PGConnectionImpl) conn;
    //Update the registry with known types
    connImpl.getRegistry().update(pgTypes, pgAttrs, pgProcs);
}
 
开发者ID:eventsourcing,项目名称:es4j,代码行数:8,代码来源:PostgreSQLSerialization.java


注:本文中的com.impossibl.postgres.api.jdbc.PGConnection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。