static PreparedStatementList prepared_list; /* prepared statement name list */
static PreparedStatement *unnamed_statement = NULL;
static PreparedStatement *unnamed_portal = NULL;
+static int force_replication = 0; /* non 0 if force to replicate query */
+static int prepare_in_session = 0;
+
static int is_drop_database(char *query); /* returns non 0 if this is a DROP DATABASE command */
static void query_ps_status(char *query, POOL_CONNECTION_POOL *backend); /* show ps status */
static int detect_deadlock_error(POOL_CONNECTION *master, int major);
else /* no more query(st == 2) */
{
frontend->no_forward = 0;
+ prepare_in_session = 0;
return POOL_CONTINUE;
}
{
pending_function = add_prepared_list;
pending_prepared_stmt = stmt;
+ force_replication = 1;
+ prepare_in_session = 1;
}
}
else if (frontend &&
return POOL_END;
}
free(buf);
+ force_replication = 1;
}
if (frontend &&
string1 = string;
}
+ /* reset query have to be replicated */
+ if (frontend == NULL && prepare_in_session)
+ force_replication = 1;
+
/* load balance trick */
if (load_balance_enabled(backend, string1))
start_load_balance(backend);
+ else if (force_replication)
+ {
+ replication_was_enabled = REPLICATION;
+ REPLICATION = 1;
+ }
else if (MASTER_SLAVE)
{
master_slave_was_enabled = 1;
master_slave_dml = 0;
}
+ if (force_replication)
+ {
+ force_replication = 0;
+ REPLICATION = replication_was_enabled;
+ replication_was_enabled = 0;
+ }
+
#ifdef NOT_USED
return ProcessFrontendResponse(frontend, backend);
#endif
MASTER_SLAVE = 0;
master_slave_dml = 1;
}
-
status = SimpleForwardToBackend(fkind, frontend, backend);
if (pool_flush(MASTER(backend)))
status = POOL_ERROR;
/* skip data type list */
while (*query && *query != ')')
query++;
+
+ if (!*query)
+ {
+ pool_debug("get_prepared_command_portal_and_statement: could not get statement");
+ return NULL;
+ }
query++;
/* skip spaces */