~ubuntu-branches/ubuntu/raring/pgpool2/raring-proposed

« back to all changes in this revision

Viewing changes to pool_query_context.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2011-06-10 10:18:29 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20110610101829-oy0uronxs3xz6jer
Tags: 3.0.4-1
* New upstream release
* Use format 3.0 (quilt).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*-pgsql-c-*- */
2
2
/*
3
3
 *
4
 
 * $Header: /cvsroot/pgpool/pgpool-II/pool_query_context.c,v 1.32.2.5 2011/02/18 13:35:10 kitagawa Exp $
 
4
 * $Header: /cvsroot/pgpool/pgpool-II/pool_query_context.c,v 1.32.2.7 2011/05/26 05:04:09 kitagawa Exp $
5
5
 *
6
6
 * pgpool: a language independent connection pool server for PostgreSQL 
7
7
 * written by Tatsuo Ishii
303
303
        {
304
304
                pool_set_node_to_be_sent(query_context,
305
305
                                                                 MASTER_SLAVE ? PRIMARY_NODE_ID : REAL_MASTER_NODE_ID);
 
306
                for (i=0;i<NUM_BACKENDS;i++)
 
307
                {
 
308
                        if (query_context->where_to_send[i])
 
309
                        {
 
310
                                query_context->virtual_master_node_id = i;
 
311
                                break;
 
312
                        }
 
313
                }
306
314
                return;
307
315
        }
308
316
 
558
566
                        continue;
559
567
                }
560
568
 
561
 
                per_node_statement_log(backend, i, string);
562
 
 
563
569
                if (*kind == '\0')
564
570
                {
 
571
                        per_node_statement_log(backend, i, string);
 
572
 
565
573
                        if (send_simplequery_message(CONNECTION(backend, i), len, string, MAJOR(backend)) != POOL_CONTINUE)
566
574
                                return POOL_END;
567
575
                }                       
568
576
                else
569
577
                {
 
578
                        if (pool_config->log_per_node_statement)
 
579
                        {
 
580
                                char msgbuf[QUERY_STRING_BUFFER_LEN];
 
581
 
 
582
                                if (*kind == 'P' || *kind == 'E')
 
583
                                {
 
584
                                        char *stmt;
 
585
 
 
586
                                        if (query_context->rewritten_query)
 
587
                                                stmt = query_context->rewritten_query;
 
588
                                        else
 
589
                                                stmt = query_context->original_query;
 
590
 
 
591
                                        if (*kind == 'P')
 
592
                                                snprintf(msgbuf, sizeof(msgbuf), "Parse: %s", stmt);
 
593
                                        else
 
594
                                                snprintf(msgbuf, sizeof(msgbuf), "Execute: %s", stmt);
 
595
                                }
 
596
                                else
 
597
                                {
 
598
                                        snprintf(msgbuf, sizeof(msgbuf), "%c message", *kind);
 
599
                                }
 
600
 
 
601
                                per_node_statement_log(backend, i, msgbuf);
 
602
                        }
 
603
 
570
604
                        if (send_extended_protocol_message(backend, i, kind, len, string) != POOL_CONTINUE)
571
605
                                return POOL_END;
572
606
                }