1223.4.18
by Brian Aker
More TableIdentifier code. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2009 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
21 |
#include "config.h" |
22 |
||
23 |
#include <assert.h> |
|
24 |
||
1223.4.18
by Brian Aker
More TableIdentifier code. |
25 |
#include <drizzled/table_identifier.h> |
26 |
||
27 |
using namespace std; |
|
28 |
using namespace drizzled; |
|
29 |
||
30 |
// Prototypes, these will be removed.
|
|
31 |
size_t build_tmptable_filename(char *buff, size_t bufflen); |
|
32 |
size_t build_table_filename(char *buff, size_t bufflen, const char *db, const char *table_name, bool is_tmp); |
|
33 |
||
34 |
const char *TableIdentifier::getPath() |
|
35 |
{
|
|
36 |
if (! path_inited) |
|
37 |
{
|
|
38 |
size_t path_length= 0; |
|
39 |
||
40 |
switch (type) { |
|
41 |
case NO_TMP_TABLE: |
|
42 |
path_length= build_table_filename(path, sizeof(path), |
|
43 |
db, table_name, |
|
44 |
false); |
|
45 |
break; |
|
46 |
case INTERNAL_TMP_TABLE: |
|
47 |
path_length= build_table_filename(path, sizeof(path), |
|
48 |
db, table_name, |
|
49 |
true); |
|
50 |
break; |
|
1235.1.3
by Brian Aker
Remove the need for trans/non-trans temp tables for lock conditions. |
51 |
case TEMP_TABLE: |
1223.4.18
by Brian Aker
More TableIdentifier code. |
52 |
path_length= build_tmptable_filename(path, sizeof(path)); |
53 |
break; |
|
54 |
case SYSTEM_TMP_TABLE: |
|
55 |
assert(0); |
|
56 |
}
|
|
57 |
path_inited= true; |
|
58 |
assert(path_length); // TODO throw exception, this is a possibility |
|
59 |
}
|
|
60 |
||
61 |
return path; |
|
62 |
}
|