~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/mysql.cc

  • Committer: Patrick
  • Date: 2008-07-11 18:54:31 UTC
  • mto: This revision was merged to the branch mainline in revision 144.
  • Revision ID: patg@localhost.localdomain-20080711185431-lfklbyfanqi3z7sc
All DBUG_x removed from client/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1047
1047
  char buff[80];
1048
1048
 
1049
1049
  MY_INIT(argv[0]);
1050
 
  DBUG_ENTER("main");
1051
 
  DBUG_PROCESS(argv[0]);
1052
 
  
 
1050
 
1053
1051
  delimiter_str= delimiter;
1054
1052
  default_prompt = my_strdup(getenv("MYSQL_PS1") ? 
1055
1053
                             getenv("MYSQL_PS1") : 
1056
 
                             "mysql> ",MYF(MY_WME));
 
1054
                             "drizzle> ",MYF(MY_WME));
1057
1055
  current_prompt = my_strdup(default_prompt,MYF(MY_WME));
1058
1056
  prompt_counter=0;
1059
1057
 
1197
1195
    end_tee();
1198
1196
  mysql_end(0);
1199
1197
#ifndef _lint
1200
 
  DBUG_RETURN(0);                               // Keep compiler happy
 
1198
  return(0);                            // Keep compiler happy
1201
1199
#endif
1202
1200
}
1203
1201
 
1321
1319
  {"compress", 'C', "Use compression in server/client protocol.",
1322
1320
   (char**) &opt_compress, (char**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
1323
1321
   0, 0, 0},
1324
 
 
1325
 
#ifdef DBUG_OFF
1326
 
  {"debug", '#', "This is a non-debug version. Catch this and exit",
1327
 
   0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
1328
 
#else
1329
 
  {"debug", '#', "Output debug log", (char**) &default_dbug_option,
1330
 
   (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
1331
 
#endif
1332
1322
  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
1333
1323
   (char**) &debug_check_flag, (char**) &debug_check_flag, 0,
1334
1324
   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1657
1647
    else
1658
1648
      tty_password= 1;
1659
1649
    break;
1660
 
  case '#':
1661
 
    DBUG_PUSH(argument ? argument : default_dbug_option);
1662
 
    debug_info_flag= 1;
1663
 
    break;
1664
1650
  case 's':
1665
1651
    if (argument == disabled_my_option)
1666
1652
      opt_silent= 0;
1854
1840
{
1855
1841
  uint len;
1856
1842
  char *end;
1857
 
  DBUG_ENTER("find_command");
1858
 
  DBUG_PRINT("enter",("name: '%s'  char: %d", name ? name : "NULL", cmd_char));
1859
1843
 
1860
1844
  if (!name)
1861
1845
  {
1877
1861
                                                (uchar*) name, 9,
1878
1862
                                                (const uchar*) "delimiter",
1879
1863
                                                9))))
1880
 
      DBUG_RETURN((COMMANDS *) 0);
 
1864
      return((COMMANDS *) 0);
1881
1865
    if ((end=strcont(name," \t")))
1882
1866
    {
1883
1867
      len=(uint) (end - name);
1895
1879
    if (commands[i].func &&
1896
1880
        ((name && !my_strnncoll(charset_info,(uchar*)name,len, (uchar*)commands[i].name,len) && !commands[i].name[len] && (!end || (end && commands[i].takes_params))) || (!name && commands[i].cmd_char == cmd_char)))
1897
1881
    {
1898
 
      DBUG_PRINT("exit",("found command: %s", commands[i].name));
1899
 
      DBUG_RETURN(&commands[i]);
 
1882
      return(&commands[i]);
1900
1883
    }
1901
1884
  }
1902
 
  DBUG_RETURN((COMMANDS *) 0);
 
1885
  return((COMMANDS *) 0);
1903
1886
}
1904
1887
 
1905
1888
 
1911
1894
  COMMANDS *com;
1912
1895
  bool need_space= 0;
1913
1896
  bool ss_comment= 0;
1914
 
  DBUG_ENTER("add_line");
 
1897
 
1915
1898
 
1916
1899
  if (!line[0] && buffer.is_empty())
1917
 
    DBUG_RETURN(0);
 
1900
    return(0);
1918
1901
#ifdef HAVE_READLINE
1919
1902
  if (status.add_to_history && line[0] && not_in_history(line))
1920
1903
    add_history(line);
1971
1954
        }
1972
1955
        
1973
1956
        if ((*com->func)(&buffer,pos-1) > 0)
1974
 
          DBUG_RETURN(1);                       // Quit
 
1957
          return(1);                       // Quit
1975
1958
        if (com->takes_params)
1976
1959
        {
1977
1960
          if (ss_comment)
2002
1985
      {
2003
1986
        sprintf(buff,"Unknown command '\\%c'.",inchar);
2004
1987
        if (put_info(buff,INFO_ERROR) > 0)
2005
 
          DBUG_RETURN(1);
 
1988
          return(1);
2006
1989
        *out++='\\';
2007
1990
        *out++=(char) inchar;
2008
1991
        continue;
2024
2007
      if (!buffer.is_empty())
2025
2008
      {
2026
2009
        if (com_go(&buffer, 0) > 0) // < 0 is not fatal
2027
 
          DBUG_RETURN(1);
 
2010
          return(1);
2028
2011
        buffer.length(0);
2029
2012
      }
2030
2013
 
2034
2017
      */
2035
2018
      buffer.append(pos);
2036
2019
      if (com_delimiter(&buffer, pos) > 0)
2037
 
        DBUG_RETURN(1);
 
2020
        return(1);
2038
2021
 
2039
2022
      buffer.length(0);
2040
2023
      break;
2072
2055
      {
2073
2056
          
2074
2057
        if ((*com->func)(&buffer, buffer.c_ptr()) > 0)
2075
 
          DBUG_RETURN(1);                       // Quit 
 
2058
          return(1);                       // Quit 
2076
2059
      }
2077
2060
      else
2078
2061
      {
2079
2062
        if (com_go(&buffer, 0) > 0)             // < 0 is not fatal
2080
 
          DBUG_RETURN(1);
 
2063
          return(1);
2081
2064
      }
2082
2065
      buffer.length(0);
2083
2066
    }
2161
2144
    if (buffer.length() + length >= buffer.alloced_length())
2162
2145
      buffer.realloc(buffer.length()+length+IO_SIZE);
2163
2146
    if ((!*ml_comment || preserve_comments) && buffer.append(line, length))
2164
 
      DBUG_RETURN(1);
 
2147
      return(1);
2165
2148
  }
2166
 
  DBUG_RETURN(0);
 
2149
  return(0);
2167
2150
}
2168
2151
 
2169
2152
/*****************************************************************
2376
2359
  MYSQL_FIELD *sql_field;
2377
2360
  char buf[NAME_LEN*2+2];                // table name plus field name plus 2
2378
2361
  int i,j,num_fields;
2379
 
  DBUG_ENTER("build_completion_hash");
 
2362
 
2380
2363
 
2381
2364
  if (status.batch || quick || !current_db)
2382
 
    DBUG_VOID_RETURN;                   // We don't need completion in batches
 
2365
    return;                     // We don't need completion in batches
2383
2366
  if (!rehash)
2384
 
    DBUG_VOID_RETURN;
 
2367
    return;
2385
2368
 
2386
2369
  /* Free old used memory */
2387
2370
  if (field_names)
2439
2422
  /* hash all field names, both with the table prefix and without it */
2440
2423
  if (!tables)                                  /* no tables */
2441
2424
  {
2442
 
    DBUG_VOID_RETURN;
 
2425
    return;
2443
2426
  }
2444
2427
  mysql_data_seek(tables,0);
2445
2428
  if (!(field_names= (char ***) alloc_root(&hash_mem_root,sizeof(char **) *
2446
2429
                                           (uint) (mysql_num_rows(tables)+1))))
2447
2430
  {
2448
2431
    mysql_free_result(tables);
2449
 
    DBUG_VOID_RETURN;
 
2432
    return;
2450
2433
  }
2451
2434
  i=0;
2452
2435
  while ((table_row=mysql_fetch_row(tables)))
2484
2467
  }
2485
2468
  mysql_free_result(tables);
2486
2469
  field_names[i]=0;                             // End pointer
2487
 
  DBUG_VOID_RETURN;
 
2470
  return;
2488
2471
}
2489
2472
 
2490
2473
        /* for gnu readline */
3240
3223
  MYSQL_FIELD *field;
3241
3224
  MYSQL_FIELD_OFFSET offset;
3242
3225
  
3243
 
#ifndef DBUG_OFF
3244
3226
  offset= mysql_field_tell(result);
3245
 
  DBUG_ASSERT(offset == 0);
3246
 
#else
3247
 
  offset= 0;
3248
 
#endif
 
3227
  assert(offset == 0);
3249
3228
 
3250
3229
  while ((field= mysql_fetch_field(result)) != NULL)
3251
3230
    len+= get_field_disp_length(field) + 3; /* plus bar, space, & final space */