One result set is created per session (last search) rather than for
each connection which happen to be shared (bug #3009).
enum client_state state;
struct show_raw *show_raw;
struct client *next; // next client in session or next in free list
enum client_state state;
struct show_raw *show_raw;
struct client *next; // next client in session or next in free list
+ ZOOM_resultset resultset;
static int nativesyntax_to_type(struct session_database *sdb, char *type,
ZOOM_record rec);
static int nativesyntax_to_type(struct session_database *sdb, char *type,
ZOOM_record rec);
-static void client_show_immediate(struct client *cl, int position,
- void *data,
- void (*error_handler)(void *data, const char *addinfo),
- void (*record_handler)(void *data, const char *buf,
- size_t sz),
- int binary)
+static void client_show_immediate(
+ ZOOM_resultset resultset, struct session_database *sdb, int position,
+ void *data,
+ void (*error_handler)(void *data, const char *addinfo),
+ void (*record_handler)(void *data, const char *buf, size_t sz),
+ int binary)
- struct connection *co = cl->connection;
- struct session_database *sdb = client_get_database(cl);
- ZOOM_resultset resultset = 0;
ZOOM_record rec = 0;
char type[80];
const char *buf;
int len;
ZOOM_record rec = 0;
char type[80];
const char *buf;
int len;
- assert(co);
-
- resultset = connection_get_resultset(co);
if (!resultset)
{
error_handler(data, "no resultset");
if (!resultset)
{
error_handler(data, "no resultset");
size_t sz),
int binary)
{
size_t sz),
int binary)
{
- if (!cl->connection)
- return -1;
-
if (syntax == 0 && esn == 0)
if (syntax == 0 && esn == 0)
- client_show_immediate(cl, position, data,
+ client_show_immediate(cl->resultset, client_get_database(cl),
+ position, data,
error_handler, record_handler,
binary);
else
{
struct show_raw *rr, **rrp;
error_handler, record_handler,
binary);
else
{
struct show_raw *rr, **rrp;
+
+ if (!cl->connection)
+ return -1;
+
+
rr = xmalloc(sizeof(*rr));
rr->position = position;
rr->active = 0;
rr = xmalloc(sizeof(*rr));
rr->position = position;
rr->active = 0;
if (cl->state == Client_Failed)
{
if (cl->state == Client_Failed)
{
- client_show_raw_error(cl, "client failed");
+ client_show_raw_error(cl, "client failed");
}
else if (cl->state == Client_Disconnected)
{
}
else if (cl->state == Client_Disconnected)
{
{
struct session_database *sdb = client_get_database(cl);
struct connection *co = client_get_connection(cl);
{
struct session_database *sdb = client_get_database(cl);
struct connection *co = client_get_connection(cl);
- ZOOM_resultset set = connection_get_resultset(co);
+ ZOOM_resultset set = cl->resultset;
int offset = cl->show_raw->position;
const char *syntax = 0;
int offset = cl->show_raw->position;
const char *syntax = 0;
struct connection *co = cl->connection;
struct session *se = cl->session;
ZOOM_connection link = connection_get_link(co);
struct connection *co = cl->connection;
struct session *se = cl->session;
ZOOM_connection link = connection_get_link(co);
- ZOOM_resultset resultset = connection_get_resultset(co);
+ ZOOM_resultset resultset = cl->resultset;
const char *error, *addinfo;
if (ZOOM_connection_error(link, &error, &addinfo))
const char *error, *addinfo;
if (ZOOM_connection_error(link, &error, &addinfo))
{
struct connection *co = cl->connection;
ZOOM_connection link = connection_get_link(co);
{
struct connection *co = cl->connection;
ZOOM_connection link = connection_get_link(co);
- ZOOM_resultset resultset = connection_get_resultset(co);
+ ZOOM_resultset resultset = cl->resultset;
const char *error, *addinfo;
if (ZOOM_connection_error(link, &error, &addinfo))
const char *error, *addinfo;
if (ZOOM_connection_error(link, &error, &addinfo))
ZOOM_connection_option_set(link, "databaseName", databaseName);
ZOOM_connection_option_set(link, "presentChunk", "20");
ZOOM_connection_option_set(link, "databaseName", databaseName);
ZOOM_connection_option_set(link, "presentChunk", "20");
if (cl->cqlquery)
{
ZOOM_query q = ZOOM_query_create();
if (cl->cqlquery)
{
ZOOM_query q = ZOOM_query_create();
yaz_log(YLOG_LOG, "Search %s PQF: %s", sdb->database->url, cl->pquery);
rs = ZOOM_connection_search_pqf(link, cl->pquery);
}
yaz_log(YLOG_LOG, "Search %s PQF: %s", sdb->database->url, cl->pquery);
rs = ZOOM_connection_search_pqf(link, cl->pquery);
}
- connection_set_resultset(co, rs);
+ ZOOM_resultset_destroy(cl->resultset);
+ cl->resultset = rs;
connection_continue(co);
}
connection_continue(co);
}
r->diagnostic = 0;
r->state = Client_Disconnected;
r->show_raw = 0;
r->diagnostic = 0;
r->state = Client_Disconnected;
r->show_raw = 0;
if (c->connection)
connection_release(c->connection);
if (c->connection)
connection_release(c->connection);
+
+ ZOOM_resultset_destroy(c->resultset);
+ c->resultset = 0;
c->next = client_freelist;
client_freelist = c;
}
c->next = client_freelist;
client_freelist = c;
}
struct connection {
IOCHAN iochan;
ZOOM_connection link;
struct connection {
IOCHAN iochan;
ZOOM_connection link;
- ZOOM_resultset resultset;
struct host *host;
struct client *client;
char *ibuf;
struct host *host;
struct client *client;
char *ibuf;
-ZOOM_resultset connection_get_resultset(struct connection *co)
-{
- return co->resultset;
-}
-
-void connection_set_resultset(struct connection *co, ZOOM_resultset rs)
-{
- if (co->resultset)
- ZOOM_resultset_destroy(co->resultset);
- co->resultset = rs;
-}
-
static void remove_connection_from_host(struct connection *con)
{
struct connection **conp = &con->host->connections;
static void remove_connection_from_host(struct connection *con)
{
struct connection **conp = &con->host->connections;
ZOOM_connection_destroy(co->link);
iochan_destroy(co->iochan);
}
ZOOM_connection_destroy(co->link);
iochan_destroy(co->iochan);
}
- if (co->resultset)
- ZOOM_resultset_destroy(co->resultset);
-
yaz_log(YLOG_DEBUG, "Connection destroy %s", co->host->hostport);
remove_connection_from_host(co);
yaz_log(YLOG_DEBUG, "Connection destroy %s", co->host->hostport);
remove_connection_from_host(co);
new->zproxy = 0;
client_set_connection(cl, new);
new->link = 0;
new->zproxy = 0;
client_set_connection(cl, new);
new->link = 0;
new->state = Conn_Resolving;
if (host->ipport)
connection_connect(new);
new->state = Conn_Resolving;
if (host->ipport)
connection_connect(new);
const char *connection_get_url(struct connection *co);
void connection_release(struct connection *co);
ZOOM_connection connection_get_link(struct connection *co);
const char *connection_get_url(struct connection *co);
void connection_release(struct connection *co);
ZOOM_connection connection_get_link(struct connection *co);
-ZOOM_resultset connection_get_resultset(struct connection *co);
-void connection_set_resultset(struct connection *co, ZOOM_resultset rs);
void connection_continue(struct connection *co);
#endif
void connection_continue(struct connection *co);
#endif