~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Monty Taylor
  • Date: 2010-02-04 08:14:46 UTC
  • mfrom: (1277.2.1 build) (1280.2.1 build)
  • mto: This revision was merged to the branch mainline in revision 1283.
  • Revision ID: mordred@inaugust.com-20100204081446-ldh9m486va30uap6
Put everything in drizzled into drizzled namespace.
Put internal stuff into drizzled::internal namespace.
Removed some cruft.
Now every symbol that is shipped in a header is in the drizzled namespace
and everything in the server that's not shipped is labeled internal. woot. 
Removed a lot of the extra extern "C" stuff that was in there. Less ugliness for
internal callbacks now for Sun Studio.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
#include <climits>
55
55
 
56
56
using namespace std;
57
 
using namespace drizzled;
 
57
namespace drizzled
 
58
{
58
59
 
59
60
extern "C"
60
61
{
73
74
extern pthread_key_t THR_Session;
74
75
extern pthread_key_t THR_Mem_root;
75
76
extern uint32_t max_used_connections;
76
 
extern drizzled::atomic<uint32_t> connection_count;
 
77
extern atomic<uint32_t> connection_count;
77
78
 
78
79
 
79
80
/****************************************************************************
109
110
extern "C" int mysql_tmpfile(const char *prefix)
110
111
{
111
112
  char filename[FN_REFLEN];
112
 
  int fd = create_temp_file(filename, drizzle_tmpdir, prefix, MYF(MY_WME));
 
113
  int fd = internal::create_temp_file(filename, drizzle_tmpdir, prefix, MYF(MY_WME));
113
114
  if (fd >= 0) {
114
115
    unlink(filename);
115
116
  }
389
390
  if (client->isConnected())
390
391
  {
391
392
    if (global_system_variables.log_warnings)
392
 
        errmsg_printf(ERRMSG_LVL_WARN, ER(ER_FORCING_CLOSE),my_progname,
 
393
        errmsg_printf(ERRMSG_LVL_WARN, ER(ER_FORCING_CLOSE),internal::my_progname,
393
394
                      thread_id,
394
395
                      (security_ctx.user.c_str() ?
395
396
                       security_ctx.user.c_str() : ""));
976
977
  if (file > 0)
977
978
  {
978
979
    (void) end_io_cache(cache);
979
 
    (void) my_close(file, MYF(0));
980
 
    (void) my_delete(path, MYF(0));             // Delete file on error
 
980
    (void) internal::my_close(file, MYF(0));
 
981
    (void) internal::my_delete(path, MYF(0));           // Delete file on error
981
982
    file= -1;
982
983
  }
983
984
}
986
987
bool select_to_file::send_eof()
987
988
{
988
989
  int error= test(end_io_cache(cache));
989
 
  if (my_close(file, MYF(MY_WME)))
 
990
  if (internal::my_close(file, MYF(MY_WME)))
990
991
    error= 1;
991
992
  if (!error)
992
993
  {
1008
1009
  if (file >= 0)
1009
1010
  {
1010
1011
    (void) end_io_cache(cache);
1011
 
    (void) my_close(file, MYF(0));
 
1012
    (void) internal::my_close(file, MYF(0));
1012
1013
    file= -1;
1013
1014
  }
1014
1015
  path[0]= '\0';
1018
1019
select_to_file::select_to_file(file_exchange *ex)
1019
1020
  : exchange(ex),
1020
1021
    file(-1),
1021
 
    cache(static_cast<IO_CACHE *>(memory::sql_calloc(sizeof(IO_CACHE)))),
 
1022
    cache(static_cast<internal::IO_CACHE *>(memory::sql_calloc(sizeof(internal::IO_CACHE)))),
1022
1023
    row_count(0L)
1023
1024
{
1024
1025
  path[0]=0;
1055
1056
*/
1056
1057
 
1057
1058
 
1058
 
static int create_file(Session *session, char *path, file_exchange *exchange, IO_CACHE *cache)
 
1059
static int create_file(Session *session, char *path, file_exchange *exchange, internal::IO_CACHE *cache)
1059
1060
{
1060
1061
  int file;
1061
1062
  uint32_t option= MY_UNPACK_FILENAME | MY_RELATIVE_PATH;
1064
1065
  option|= MY_REPLACE_DIR;                      // Force use of db directory
1065
1066
#endif
1066
1067
 
1067
 
  if (!dirname_length(exchange->file_name))
 
1068
  if (!internal::dirname_length(exchange->file_name))
1068
1069
  {
1069
1070
    strcpy(path, drizzle_real_data_home);
1070
1071
    if (! session->db.empty())
1071
1072
      strncat(path, session->db.c_str(), FN_REFLEN-strlen(drizzle_real_data_home)-1);
1072
 
    (void) fn_format(path, exchange->file_name, path, "", option);
 
1073
    (void) internal::fn_format(path, exchange->file_name, path, "", option);
1073
1074
  }
1074
1075
  else
1075
 
    (void) fn_format(path, exchange->file_name, drizzle_real_data_home, "", option);
 
1076
    (void) internal::fn_format(path, exchange->file_name, drizzle_real_data_home, "", option);
1076
1077
 
1077
1078
  if (opt_secure_file_priv &&
1078
1079
      strncmp(opt_secure_file_priv, path, strlen(opt_secure_file_priv)))
1088
1089
    return -1;
1089
1090
  }
1090
1091
  /* Create the file world readable */
1091
 
  if ((file= my_create(path, 0666, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0)
 
1092
  if ((file= internal::my_create(path, 0666, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0)
1092
1093
    return file;
1093
1094
  (void) fchmod(file, 0666);                    // Because of umask()
1094
 
  if (init_io_cache(cache, file, 0L, WRITE_CACHE, 0L, 1, MYF(MY_WME)))
 
1095
  if (init_io_cache(cache, file, 0L, internal::WRITE_CACHE, 0L, 1, MYF(MY_WME)))
1095
1096
  {
1096
 
    my_close(file, MYF(0));
1097
 
    my_delete(path, MYF(0));  // Delete file on error, it was just created
 
1097
    internal::my_close(file, MYF(0));
 
1098
    internal::my_delete(path, MYF(0));  // Delete file on error, it was just created
1098
1099
    return -1;
1099
1100
  }
1100
1101
  return file;
2105
2106
  }
2106
2107
  return error;
2107
2108
}
 
2109
 
 
2110
} /* namespace drizzled */