~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzleslap.cc

merge drizzleslap displaying connection ids in --only-print

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
/* Added this for string translation. */
99
99
#include <drizzled/gettext.h>
100
100
#include <boost/program_options.hpp>
 
101
#include <drizzled/atomics.h>
101
102
 
102
103
#define SLAP_VERSION "1.5"
103
104
 
128
129
 
129
130
std::vector < std::string > primary_keys;
130
131
 
 
132
drizzled::atomic<uint32_t> connection_count;
 
133
 
131
134
static string host, 
132
135
  opt_password, 
133
136
  user,
1562
1565
 
1563
1566
  if (opt_only_print)
1564
1567
  {
1565
 
    printf("%.*s;\n", len, query);
 
1568
    printf("/* CON: %d */ %.*s;\n",
 
1569
           drizzle_context(drizzle_con_drizzle(con)),
 
1570
           len, query);
1566
1571
    return 0;
1567
1572
  }
1568
1573
 
1672
1677
 
1673
1678
  if (opt_only_print)
1674
1679
  {
1675
 
    printf("use %s;\n", db);
 
1680
    printf("/* CON: %u */ use %s;\n",
 
1681
           drizzle_context(drizzle_con_drizzle(con)),
 
1682
           db);
1676
1683
  }
1677
1684
  else
1678
1685
  {
2420
2427
void
2421
2428
slap_close(drizzle_con_st *con)
2422
2429
{
2423
 
  if (opt_only_print)
2424
 
    return;
2425
 
 
2426
2430
  drizzle_free(drizzle_con_drizzle(con));
2427
2431
}
2428
2432
 
2435
2439
  drizzle_return_t ret;
2436
2440
  drizzle_st *drizzle;
2437
2441
 
2438
 
  if (opt_only_print)
2439
 
    return;
2440
 
 
2441
2442
  if (opt_delayed_start)
2442
2443
    usleep(random()%opt_delayed_start);
2443
2444
 
2452
2453
    exit(1);
2453
2454
  }
2454
2455
 
 
2456
  drizzle_set_context(drizzle, (void*)connection_count.fetch_and_increment());
 
2457
 
 
2458
  if (opt_only_print)
 
2459
    return;
 
2460
 
2455
2461
  for (uint32_t x= 0; x < 10; x++)
2456
2462
  {
2457
2463
    if ((ret= drizzle_con_connect(con)) == DRIZZLE_RETURN_OK)