-
Notifications
You must be signed in to change notification settings - Fork 126
Ability to build as dynamic module #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@cryptofuture Patches welcome :) |
@cryptofuture The value of |
Thanks, will try build tomorrow. ngx_http_postgres_module makes more sense. |
Tried build today as dynamic, now ngx_postgres_upstream_send_query(ngx_http_request_t *r, ngx_connection_t *pgxc,
ngx_postgres_upstream_peer_data_t *pgdt)
{
ngx_postgres_loc_conf_t *pglcf;
ngx_int_t pgrc;
u_char *query;
dd("entering");
pglcf = ngx_http_get_module_loc_conf(r, ngx_postgres_module);
query = ngx_pnalloc(r->pool, pgdt->query.len + 1);
if (query == NULL) {
dd("returning NGX_ERROR");
return NGX_ERROR;
}
(void) ngx_cpystrn(query, pgdt->query.data, pgdt->query.len + 1);
dd("sending query: %s", query);
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pgxc->log, 0,
"postgres: sending query: \"%s\"", query);
if (pglcf->output_binary) {
pgrc = PQsendQueryParams(pgdt->pgconn, (const char *) query,
0, NULL, NULL, NULL, NULL, /* binary */ 1);
} else {
pgrc = PQsendQuery(pgdt->pgconn, (const char *) query);
}
if (pgrc == 0) {
dd("sending query failed");
ngx_log_error(NGX_LOG_ERR, pgxc->log, 0,
"postgres: sending query failed: %s",
PQerrorMessage(pgdt->pgconn));
dd("returning NGX_ERROR");
return NGX_ERROR;
}
/* set result timeout */
ngx_add_timer(pgxc->read, r->upstream->conf->read_timeout);
dd("query sent successfully");
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pgxc->log, 0,
"postgres: query sent successfully");
pgxc->log->action = "waiting for result from PostgreSQL database";
pgdt->state = state_db_get_result;
dd("returning NGX_DONE");
return NGX_DONE;
} BTW moved all ngx_postgres reference to ngx_http_postgres locally (a lot changes), was hope I made some error, but ether way |
@cryptofuture You failed to link libpq against your own ngx_http_postgres_module.so, I guess. |
Covered in #54 |
I wanted to convert module myself, but I can miss something (config with too many sections). Currently this is only one non dynamic module I currently use.
The text was updated successfully, but these errors were encountered: