static DataType postgresOidToDT(char *Oid) { int oid = atoi(Oid); return (DataType) INT_VALUE(MAP_GET_INT(GET_CACHE()->oidToDT,oid)); }
static inline int get_ue_golomb_31(GetBitContext *gb){ unsigned int buf; OPEN_READER(re, gb); UPDATE_CACHE(re, gb); buf=GET_CACHE(re, gb); buf >>= 32 - 9; LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]); CLOSE_READER(re, gb); return ff_ue_golomb_vlc_code[buf]; }
int postgresDatabaseConnectionOpen (void) { StringInfo connStr = makeStringInfo(); // OptionConnection *op = getOptions()->optionConnection; ACQUIRE_MEM_CONTEXT(memContext); /* create connection string */ // if (op->host) appendStringInfo(connStr, " host=%s", getStringOption("connection.host")); // if (op->db) appendStringInfo(connStr, " dbname=%s", getStringOption("connection.db")); // if (op->user) appendStringInfo(connStr, " user=%s", getStringOption("connection.user")); if (optionSet("connection.passwd")) appendStringInfo(connStr, " password=%s", getStringOption("connection.passwd")); // if (op->port) appendStringInfo(connStr, " port=%u", getIntOption("connection.port")); /* try to connect to db */ plugin->conn = PQconnectdb(connStr->data); /* check to see that the backend connection was successfully made */ if (plugin->conn == NULL || PQstatus(plugin->conn) == CONNECTION_BAD) { char *error = PQerrorMessage(plugin->conn); PQfinish(plugin->conn); FATAL_LOG("unable to connect to postgres database %s\n\nfailed " "because of:\n%s", connStr->data, error); } plugin->initialized = TRUE; // prepare queries prepareLookupQueries(); // initialize cache fillOidToDTMap(GET_CACHE()->oidToDT); RELEASE_MEM_CONTEXT(); return EXIT_SUCCESS; }