Merge lp:~mordred/drizzle/boost-fs-path-work into lp:~drizzle-trunk/drizzle/development
- boost-fs-path-work
- Merge into development
Proposed by
Monty Taylor
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Monty Taylor | ||||||||
Approved revision: | 1829 | ||||||||
Merged at revision: | 1820 | ||||||||
Proposed branch: | lp:~mordred/drizzle/boost-fs-path-work | ||||||||
Merge into: | lp:~drizzle-trunk/drizzle/development | ||||||||
Diff against target: |
1800 lines (+367/-390) 33 files modified
drizzled/data_home.h (+5/-5) drizzled/drizzled.cc (+73/-163) drizzled/file_exchange.h (+2/-1) drizzled/function/str/load_file.cc (+48/-10) drizzled/main.cc (+6/-10) drizzled/module/library.cc (+13/-13) drizzled/module/library.h (+3/-1) drizzled/module/loader.cc (+0/-1) drizzled/plugin.h (+2/-1) drizzled/select_export.h (+3/-1) drizzled/select_to_file.h (+5/-2) drizzled/session.cc (+40/-31) drizzled/set_var.cc (+15/-40) drizzled/set_var.h (+43/-5) drizzled/sql_load.cc (+56/-54) drizzled/thr_lock.cc (+1/-1) plugin/innobase/handler/ha_innodb.cc (+10/-9) plugin/pbms/src/database_ms.cc (+4/-4) plugin/pbms/src/mysql_ms.cc (+3/-3) plugin/pbms/src/mysql_ms.h (+3/-1) plugin/pbms/src/pbmsdaemon_ms.cc (+1/-1) plugin/pbms/src/system_table_ms.cc (+1/-1) plugin/pbxt/src/myxt_xt.cc (+6/-6) plugin/pbxt/src/xt_defs.h (+2/-1) plugin/schema_engine/schema.cc (+1/-1) plugin/signal_handler/signal_handler.cc (+4/-4) plugin/status_dictionary/variables.h (+1/-1) tests/r/func_str.result (+1/-5) tests/r/loaddata.result (+3/-4) tests/r/outfile.result (+8/-5) tests/t/func_str.test (+1/-4) tests/t/loaddata.test (+1/-1) tests/t/outfile.test (+2/-0) |
||||||||
To merge this branch: | bzr merge lp:~mordred/drizzle/boost-fs-path-work | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Merge Team | Pending | ||
Review via email: mp+37710@code.launchpad.net |
This proposal supersedes a proposal from 2010-10-06.
Commit message
Description of the change
A bunch of work cleaning up how paths are managed/handled.
To post a comment you must log in.
Revision history for this message
Monty Taylor (mordred) wrote : | # |
Revision history for this message
Lee Bieber (kalebral-deactivatedaccount) wrote : | # |
Fails with debug build
- 1830. By Monty Taylor
-
Fixed an alarming issue in debug builds of pbmx. Oh well.
Revision history for this message
Monty Taylor (mordred) wrote : | # |
Fixed the pbms issue.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'drizzled/data_home.h' | |||
2 | --- drizzled/data_home.h 2010-09-26 01:21:36 +0000 | |||
3 | +++ drizzled/data_home.h 2010-10-06 07:38:58 +0000 | |||
4 | @@ -20,15 +20,15 @@ | |||
5 | 20 | #ifndef DRIZZLED_DATA_HOME_H | 20 | #ifndef DRIZZLED_DATA_HOME_H |
6 | 21 | #define DRIZZLED_DATA_HOME_H | 21 | #define DRIZZLED_DATA_HOME_H |
7 | 22 | 22 | ||
9 | 23 | #include <string> | 23 | #include <boost/filesystem.hpp> |
10 | 24 | 24 | ||
11 | 25 | namespace drizzled | 25 | namespace drizzled |
12 | 26 | { | 26 | { |
13 | 27 | 27 | ||
18 | 28 | std::string& getDataHome(); | 28 | extern boost::filesystem::path full_data_home; |
19 | 29 | std::string& getDataHomeCatalog(); | 29 | |
20 | 30 | char *getDatadir(); | 30 | boost::filesystem::path& getDataHome(); |
21 | 31 | char **getDatadirPtr(); | 31 | boost::filesystem::path& getDataHomeCatalog(); |
22 | 32 | 32 | ||
23 | 33 | } /* namespace drizzled */ | 33 | } /* namespace drizzled */ |
24 | 34 | 34 | ||
25 | 35 | 35 | ||
26 | === modified file 'drizzled/drizzled.cc' | |||
27 | --- drizzled/drizzled.cc 2010-10-04 22:44:31 +0000 | |||
28 | +++ drizzled/drizzled.cc 2010-10-06 07:38:58 +0000 | |||
29 | @@ -232,8 +232,6 @@ | |||
30 | 232 | plugin::StorageEngine *heap_engine; | 232 | plugin::StorageEngine *heap_engine; |
31 | 233 | plugin::StorageEngine *myisam_engine; | 233 | plugin::StorageEngine *myisam_engine; |
32 | 234 | 234 | ||
33 | 235 | char* opt_secure_file_priv= 0; | ||
34 | 236 | |||
35 | 237 | bool calling_initgroups= false; /**< Used in SIGSEGV handler. */ | 235 | bool calling_initgroups= false; /**< Used in SIGSEGV handler. */ |
36 | 238 | 236 | ||
37 | 239 | uint32_t drizzled_bind_timeout; | 237 | uint32_t drizzled_bind_timeout; |
38 | @@ -288,7 +286,14 @@ | |||
39 | 288 | time_t server_start_time; | 286 | time_t server_start_time; |
40 | 289 | time_t flush_status_time; | 287 | time_t flush_status_time; |
41 | 290 | 288 | ||
43 | 291 | char drizzle_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30]; | 289 | fs::path basedir(PREFIX); |
44 | 290 | fs::path pid_file; | ||
45 | 291 | fs::path secure_file_priv(""); | ||
46 | 292 | fs::path plugin_dir; | ||
47 | 293 | fs::path system_config_dir(SYSCONFDIR); | ||
48 | 294 | |||
49 | 295 | |||
50 | 296 | char system_time_zone[30]; | ||
51 | 292 | char *default_tz_name; | 297 | char *default_tz_name; |
52 | 293 | char glob_hostname[FN_REFLEN]; | 298 | char glob_hostname[FN_REFLEN]; |
53 | 294 | 299 | ||
54 | @@ -336,7 +341,6 @@ | |||
55 | 336 | /* Static variables */ | 341 | /* Static variables */ |
56 | 337 | 342 | ||
57 | 338 | int cleanup_done; | 343 | int cleanup_done; |
58 | 339 | static char *drizzle_home_ptr, *pidfile_name_ptr; | ||
59 | 340 | 344 | ||
60 | 341 | passwd *user_info; | 345 | passwd *user_info; |
61 | 342 | 346 | ||
62 | @@ -352,7 +356,6 @@ | |||
63 | 352 | 356 | ||
64 | 353 | static void drizzle_init_variables(void); | 357 | static void drizzle_init_variables(void); |
65 | 354 | static void get_options(); | 358 | static void get_options(); |
66 | 355 | static const char *get_relative_path(const char *path); | ||
67 | 356 | static void fix_paths(); | 359 | static void fix_paths(); |
68 | 357 | 360 | ||
69 | 358 | static void usage(void); | 361 | static void usage(void); |
70 | @@ -369,34 +372,26 @@ | |||
71 | 369 | vector<string> unknown_options; | 372 | vector<string> unknown_options; |
72 | 370 | vector<string> defaults_file_list; | 373 | vector<string> defaults_file_list; |
73 | 371 | po::variables_map vm; | 374 | po::variables_map vm; |
75 | 372 | char * data_dir_ptr; | 375 | |
76 | 376 | fs::path data_home(LOCALSTATEDIR); | ||
77 | 377 | fs::path full_data_home(LOCALSTATEDIR); | ||
78 | 373 | 378 | ||
79 | 374 | po::variables_map &getVariablesMap() | 379 | po::variables_map &getVariablesMap() |
80 | 375 | { | 380 | { |
81 | 376 | return vm; | 381 | return vm; |
82 | 377 | } | 382 | } |
83 | 378 | 383 | ||
85 | 379 | std::string& getDataHome() | 384 | fs::path& getDataHome() |
86 | 380 | { | 385 | { |
87 | 381 | static string data_home(LOCALSTATEDIR); | ||
88 | 382 | return data_home; | 386 | return data_home; |
89 | 383 | } | 387 | } |
90 | 384 | 388 | ||
92 | 385 | std::string& getDataHomeCatalog() | 389 | fs::path& getDataHomeCatalog() |
93 | 386 | { | 390 | { |
95 | 387 | static string data_home_catalog(getDataHome()); | 391 | static fs::path data_home_catalog(getDataHome()); |
96 | 388 | return data_home_catalog; | 392 | return data_home_catalog; |
97 | 389 | } | 393 | } |
98 | 390 | 394 | ||
99 | 391 | char *getDatadir() | ||
100 | 392 | { | ||
101 | 393 | return data_dir_ptr; | ||
102 | 394 | } | ||
103 | 395 | |||
104 | 396 | char **getDatadirPtr() | ||
105 | 397 | { | ||
106 | 398 | return &data_dir_ptr; | ||
107 | 399 | } | ||
108 | 400 | 395 | ||
109 | 401 | /**************************************************************************** | 396 | /**************************************************************************** |
110 | 402 | ** Code to end drizzled | 397 | ** Code to end drizzled |
111 | @@ -511,13 +506,10 @@ | |||
112 | 511 | return; | 506 | return; |
113 | 512 | 507 | ||
114 | 513 | table_cache_free(); | 508 | table_cache_free(); |
115 | 514 | set_var_free(); | ||
116 | 515 | free_charsets(); | 509 | free_charsets(); |
117 | 516 | module::Registry &modules= module::Registry::singleton(); | 510 | module::Registry &modules= module::Registry::singleton(); |
118 | 517 | modules.shutdownModules(); | 511 | modules.shutdownModules(); |
119 | 518 | xid_cache_free(); | 512 | xid_cache_free(); |
120 | 519 | if (opt_secure_file_priv) | ||
121 | 520 | free(opt_secure_file_priv); | ||
122 | 521 | 513 | ||
123 | 522 | deinit_temporal_formats(); | 514 | deinit_temporal_formats(); |
124 | 523 | 515 | ||
125 | @@ -525,7 +517,7 @@ | |||
126 | 525 | google::protobuf::ShutdownProtobufLibrary(); | 517 | google::protobuf::ShutdownProtobufLibrary(); |
127 | 526 | #endif | 518 | #endif |
128 | 527 | 519 | ||
130 | 528 | (void) unlink(pidfile_name); // This may not always exist | 520 | (void) unlink(pid_file.file_string().c_str()); // This may not always exist |
131 | 529 | 521 | ||
132 | 530 | if (print_message && server_start_time) | 522 | if (print_message && server_start_time) |
133 | 531 | errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_SHUTDOWN_COMPLETE)),internal::my_progname); | 523 | errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_SHUTDOWN_COMPLETE)),internal::my_progname); |
134 | @@ -535,8 +527,6 @@ | |||
135 | 535 | COND_server_end.notify_all(); | 527 | COND_server_end.notify_all(); |
136 | 536 | LOCK_thread_count.unlock(); | 528 | LOCK_thread_count.unlock(); |
137 | 537 | 529 | ||
138 | 538 | char **data_home_ptr= getDatadirPtr(); | ||
139 | 539 | delete[](*data_home_ptr); | ||
140 | 540 | /* | 530 | /* |
141 | 541 | The following lines may never be executed as the main thread may have | 531 | The following lines may never be executed as the main thread may have |
142 | 542 | killed us | 532 | killed us |
143 | @@ -716,15 +706,29 @@ | |||
144 | 716 | base_plugin_dir /= "plugin"; | 706 | base_plugin_dir /= "plugin"; |
145 | 717 | base_plugin_dir /= ".libs"; | 707 | base_plugin_dir /= ".libs"; |
146 | 718 | } | 708 | } |
156 | 719 | (void) internal::my_load_path(opt_plugin_dir, fs::path(fs::system_complete(base_plugin_dir)).file_string().c_str(), ""); | 709 | |
157 | 720 | } | 710 | if (plugin_dir.root_directory() == "") |
158 | 721 | 711 | { | |
159 | 722 | static void notify_plugin_dir(string in_plugin_dir) | 712 | fs::path full_plugin_dir(fs::system_complete(base_plugin_dir)); |
160 | 723 | { | 713 | full_plugin_dir /= plugin_dir; |
161 | 724 | if (not in_plugin_dir.empty()) | 714 | plugin_dir= full_plugin_dir; |
162 | 725 | { | 715 | } |
163 | 726 | (void) internal::my_load_path(opt_plugin_dir, in_plugin_dir.c_str(), drizzle_home); | 716 | } |
164 | 727 | } | 717 | |
165 | 718 | static void notify_plugin_dir(fs::path in_plugin_dir) | ||
166 | 719 | { | ||
167 | 720 | plugin_dir= in_plugin_dir; | ||
168 | 721 | if (plugin_dir.root_directory() == "") | ||
169 | 722 | { | ||
170 | 723 | fs::path full_plugin_dir(fs::system_complete(basedir)); | ||
171 | 724 | full_plugin_dir /= plugin_dir; | ||
172 | 725 | plugin_dir= full_plugin_dir; | ||
173 | 726 | } | ||
174 | 727 | } | ||
175 | 728 | |||
176 | 729 | static void expand_secure_file_priv(fs::path in_secure_file_priv) | ||
177 | 730 | { | ||
178 | 731 | secure_file_priv= fs::system_complete(in_secure_file_priv); | ||
179 | 728 | } | 732 | } |
180 | 729 | 733 | ||
181 | 730 | static void check_limits_aii(uint64_t in_auto_increment_increment) | 734 | static void check_limits_aii(uint64_t in_auto_increment_increment) |
182 | @@ -906,17 +910,6 @@ | |||
183 | 906 | global_system_variables.max_sort_length= in_max_sort_length; | 910 | global_system_variables.max_sort_length= in_max_sort_length; |
184 | 907 | } | 911 | } |
185 | 908 | 912 | ||
186 | 909 | static void check_limits_mwlc(uint64_t in_min_examined_row_limit) | ||
187 | 910 | { | ||
188 | 911 | global_system_variables.min_examined_row_limit= ULONG_MAX; | ||
189 | 912 | if (in_min_examined_row_limit > ULONG_MAX) | ||
190 | 913 | { | ||
191 | 914 | cout << N_("Error: Invalid Value for min_examined_row_limit"); | ||
192 | 915 | exit(-1); | ||
193 | 916 | } | ||
194 | 917 | global_system_variables.min_examined_row_limit= in_min_examined_row_limit; | ||
195 | 918 | } | ||
196 | 919 | |||
197 | 920 | static void check_limits_osd(uint32_t in_optimizer_search_depth) | 913 | static void check_limits_osd(uint32_t in_optimizer_search_depth) |
198 | 921 | { | 914 | { |
199 | 922 | global_system_variables.optimizer_search_depth= 0; | 915 | global_system_variables.optimizer_search_depth= 0; |
200 | @@ -1120,19 +1113,18 @@ | |||
201 | 1120 | iter != defaults_file_list.end(); | 1113 | iter != defaults_file_list.end(); |
202 | 1121 | ++iter) | 1114 | ++iter) |
203 | 1122 | { | 1115 | { |
205 | 1123 | string file_location(vm["config-dir"].as<string>()); | 1116 | fs::path file_location(system_config_dir); |
206 | 1124 | if ((*iter)[0] != '/') | 1117 | if ((*iter)[0] != '/') |
207 | 1125 | { | 1118 | { |
208 | 1126 | /* Relative path - add config dir */ | 1119 | /* Relative path - add config dir */ |
211 | 1127 | file_location.push_back('/'); | 1120 | file_location /= *iter; |
210 | 1128 | file_location.append(*iter); | ||
212 | 1129 | } | 1121 | } |
213 | 1130 | else | 1122 | else |
214 | 1131 | { | 1123 | { |
215 | 1132 | file_location= *iter; | 1124 | file_location= *iter; |
216 | 1133 | } | 1125 | } |
217 | 1134 | 1126 | ||
219 | 1135 | ifstream input_defaults_file(file_location.c_str()); | 1127 | ifstream input_defaults_file(file_location.file_string().c_str()); |
220 | 1136 | 1128 | ||
221 | 1137 | po::parsed_options file_parsed= | 1129 | po::parsed_options file_parsed= |
222 | 1138 | po::parse_config_file(input_defaults_file, full_options, true); | 1130 | po::parse_config_file(input_defaults_file, full_options, true); |
223 | @@ -1211,15 +1203,15 @@ | |||
224 | 1211 | strncpy(glob_hostname, STRING_WITH_LEN("localhost")); | 1203 | strncpy(glob_hostname, STRING_WITH_LEN("localhost")); |
225 | 1212 | errmsg_printf(ERRMSG_LVL_WARN, _("gethostname failed, using '%s' as hostname"), | 1204 | errmsg_printf(ERRMSG_LVL_WARN, _("gethostname failed, using '%s' as hostname"), |
226 | 1213 | glob_hostname); | 1205 | glob_hostname); |
228 | 1214 | strncpy(pidfile_name, STRING_WITH_LEN("drizzle")); | 1206 | pid_file= "drizzle"; |
229 | 1215 | } | 1207 | } |
230 | 1216 | else | 1208 | else |
237 | 1217 | strncpy(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); | 1209 | { |
238 | 1218 | strcpy(internal::fn_ext(pidfile_name),".pid"); // Add proper extension | 1210 | pid_file= glob_hostname; |
239 | 1219 | 1211 | } | |
240 | 1220 | std::string system_config_dir_drizzle(SYSCONFDIR); | 1212 | pid_file.replace_extension(".pid"); |
241 | 1221 | system_config_dir_drizzle.append("/drizzle"); | 1213 | |
242 | 1222 | 1214 | system_config_dir /= "drizzle"; | |
243 | 1223 | std::string system_config_file_drizzle("drizzled.cnf"); | 1215 | std::string system_config_file_drizzle("drizzled.cnf"); |
244 | 1224 | 1216 | ||
245 | 1225 | config_options.add_options() | 1217 | config_options.add_options() |
246 | @@ -1229,9 +1221,9 @@ | |||
247 | 1229 | N_("Configuration file defaults are not used if no-defaults is set")) | 1221 | N_("Configuration file defaults are not used if no-defaults is set")) |
248 | 1230 | ("defaults-file", po::value<vector<string> >()->composing()->notifier(&compose_defaults_file_list), | 1222 | ("defaults-file", po::value<vector<string> >()->composing()->notifier(&compose_defaults_file_list), |
249 | 1231 | N_("Configuration file to use")) | 1223 | N_("Configuration file to use")) |
251 | 1232 | ("config-dir", po::value<string>()->default_value(system_config_dir_drizzle), | 1224 | ("config-dir", po::value<fs::path>(&system_config_dir), |
252 | 1233 | N_("Base location for config files")) | 1225 | N_("Base location for config files")) |
254 | 1234 | ("plugin-dir", po::value<string>()->notifier(¬ify_plugin_dir), | 1226 | ("plugin-dir", po::value<fs::path>(&plugin_dir)->notifier(¬ify_plugin_dir), |
255 | 1235 | N_("Directory for plugins.")) | 1227 | N_("Directory for plugins.")) |
256 | 1236 | ; | 1228 | ; |
257 | 1237 | 1229 | ||
258 | @@ -1255,7 +1247,7 @@ | |||
259 | 1255 | N_("Auto-increment columns are incremented by this")) | 1247 | N_("Auto-increment columns are incremented by this")) |
260 | 1256 | ("auto-increment-offset", po::value<uint64_t>(&global_system_variables.auto_increment_offset)->default_value(1)->notifier(&check_limits_aio), | 1248 | ("auto-increment-offset", po::value<uint64_t>(&global_system_variables.auto_increment_offset)->default_value(1)->notifier(&check_limits_aio), |
261 | 1257 | N_("Offset added to Auto-increment columns. Used when auto-increment-increment != 1")) | 1249 | N_("Offset added to Auto-increment columns. Used when auto-increment-increment != 1")) |
263 | 1258 | ("basedir,b", po::value<string>(), | 1250 | ("basedir,b", po::value<fs::path>(&basedir), |
264 | 1259 | N_("Path to installation directory. All paths are usually resolved " | 1251 | N_("Path to installation directory. All paths are usually resolved " |
265 | 1260 | "relative to this.")) | 1252 | "relative to this.")) |
266 | 1261 | ("chroot,r", po::value<string>(), | 1253 | ("chroot,r", po::value<string>(), |
267 | @@ -1265,7 +1257,7 @@ | |||
268 | 1265 | ("completion-type", po::value<uint32_t>(&global_system_variables.completion_type)->default_value(0)->notifier(&check_limits_completion_type), | 1257 | ("completion-type", po::value<uint32_t>(&global_system_variables.completion_type)->default_value(0)->notifier(&check_limits_completion_type), |
269 | 1266 | N_("Default completion type.")) | 1258 | N_("Default completion type.")) |
270 | 1267 | ("core-file", N_("Write core on errors.")) | 1259 | ("core-file", N_("Write core on errors.")) |
272 | 1268 | ("datadir", po::value<string>(), | 1260 | ("datadir", po::value<fs::path>(&data_home), |
273 | 1269 | N_("Path to the database root.")) | 1261 | N_("Path to the database root.")) |
274 | 1270 | ("default-storage-engine", po::value<string>(), | 1262 | ("default-storage-engine", po::value<string>(), |
275 | 1271 | N_("Set the default storage engine for tables.")) | 1263 | N_("Set the default storage engine for tables.")) |
276 | @@ -1279,11 +1271,11 @@ | |||
277 | 1279 | N_("Set the language used for the month names and the days of the week.")) | 1271 | N_("Set the language used for the month names and the days of the week.")) |
278 | 1280 | ("log-warnings,W", po::value<string>(), | 1272 | ("log-warnings,W", po::value<string>(), |
279 | 1281 | N_("Log some not critical warnings to the log file.")) | 1273 | N_("Log some not critical warnings to the log file.")) |
281 | 1282 | ("pid-file", po::value<string>(), | 1274 | ("pid-file", po::value<fs::path>(&pid_file), |
282 | 1283 | N_("Pid file used by drizzled.")) | 1275 | N_("Pid file used by drizzled.")) |
283 | 1284 | ("port-open-timeout", po::value<uint32_t>(&drizzled_bind_timeout)->default_value(0), | 1276 | ("port-open-timeout", po::value<uint32_t>(&drizzled_bind_timeout)->default_value(0), |
284 | 1285 | N_("Maximum time in seconds to wait for the port to become free. ")) | 1277 | N_("Maximum time in seconds to wait for the port to become free. ")) |
286 | 1286 | ("secure-file-priv", po::value<string>(), | 1278 | ("secure-file-priv", po::value<fs::path>(&secure_file_priv)->notifier(expand_secure_file_priv), |
287 | 1287 | N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files " | 1279 | N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files " |
288 | 1288 | "within specified directory")) | 1280 | "within specified directory")) |
289 | 1289 | ("server-id", po::value<uint32_t>(&server_id)->default_value(0), | 1281 | ("server-id", po::value<uint32_t>(&server_id)->default_value(0), |
290 | @@ -1339,7 +1331,7 @@ | |||
291 | 1339 | N_("The number of bytes to use when sorting BLOB or TEXT values " | 1331 | N_("The number of bytes to use when sorting BLOB or TEXT values " |
292 | 1340 | "(only the first max_sort_length bytes of each value are used; the " | 1332 | "(only the first max_sort_length bytes of each value are used; the " |
293 | 1341 | "rest are ignored).")) | 1333 | "rest are ignored).")) |
295 | 1342 | ("max-write-lock-count", po::value<uint64_t>(&max_write_lock_count)->default_value(ULONG_MAX)->notifier(&check_limits_mwlc), | 1334 | ("max-write-lock-count", po::value<uint64_t>(&max_write_lock_count)->default_value(UINT64_MAX), |
296 | 1343 | N_("After this many write locks, allow some read locks to run in between.")) | 1335 | N_("After this many write locks, allow some read locks to run in between.")) |
297 | 1344 | ("min-examined-row-limit", po::value<uint64_t>(&global_system_variables.min_examined_row_limit)->default_value(0)->notifier(&check_limits_merl), | 1336 | ("min-examined-row-limit", po::value<uint64_t>(&global_system_variables.min_examined_row_limit)->default_value(0)->notifier(&check_limits_merl), |
298 | 1345 | N_("Don't log queries which examine less than min_examined_row_limit " | 1337 | N_("Don't log queries which examine less than min_examined_row_limit " |
299 | @@ -1426,9 +1418,10 @@ | |||
300 | 1426 | system_config_file_drizzle); | 1418 | system_config_file_drizzle); |
301 | 1427 | } | 1419 | } |
302 | 1428 | 1420 | ||
306 | 1429 | string config_conf_d_location(vm["config-dir"].as<string>()); | 1421 | fs::path config_conf_d_location(system_config_dir); |
307 | 1430 | config_conf_d_location.append("/conf.d"); | 1422 | config_conf_d_location /= "conf.d"; |
308 | 1431 | CachedDirectory config_conf_d(config_conf_d_location); | 1423 | |
309 | 1424 | CachedDirectory config_conf_d(config_conf_d_location.file_string()); | ||
310 | 1432 | if (not config_conf_d.fail()) | 1425 | if (not config_conf_d.fail()) |
311 | 1433 | { | 1426 | { |
312 | 1434 | 1427 | ||
313 | @@ -1442,10 +1435,9 @@ | |||
314 | 1442 | && file_entry != "." | 1435 | && file_entry != "." |
315 | 1443 | && file_entry != "..") | 1436 | && file_entry != "..") |
316 | 1444 | { | 1437 | { |
321 | 1445 | string the_entry(config_conf_d_location); | 1438 | fs::path the_entry(config_conf_d_location); |
322 | 1446 | the_entry.push_back('/'); | 1439 | the_entry /= file_entry; |
323 | 1447 | the_entry.append(file_entry); | 1440 | defaults_file_list.push_back(the_entry.file_string()); |
320 | 1448 | defaults_file_list.push_back(the_entry); | ||
324 | 1449 | } | 1441 | } |
325 | 1450 | } | 1442 | } |
326 | 1451 | } | 1443 | } |
327 | @@ -1761,7 +1753,7 @@ | |||
328 | 1761 | {"basedir", 'b', | 1753 | {"basedir", 'b', |
329 | 1762 | N_("Path to installation directory. All paths are usually resolved " | 1754 | N_("Path to installation directory. All paths are usually resolved " |
330 | 1763 | "relative to this."), | 1755 | "relative to this."), |
332 | 1764 | (char**) &drizzle_home_ptr, (char**) &drizzle_home_ptr, 0, GET_STR, REQUIRED_ARG, | 1756 | NULL, NULL, 0, GET_STR, REQUIRED_ARG, |
333 | 1765 | 0, 0, 0, 0, 0, 0}, | 1757 | 0, 0, 0, 0, 0, 0}, |
334 | 1766 | {"chroot", 'r', | 1758 | {"chroot", 'r', |
335 | 1767 | N_("Chroot drizzled daemon during startup."), | 1759 | N_("Chroot drizzled daemon during startup."), |
336 | @@ -1813,7 +1805,7 @@ | |||
337 | 1813 | 0, 0, 0}, | 1805 | 0, 0, 0}, |
338 | 1814 | {"pid-file", OPT_PID_FILE, | 1806 | {"pid-file", OPT_PID_FILE, |
339 | 1815 | N_("Pid file used by drizzled."), | 1807 | N_("Pid file used by drizzled."), |
341 | 1816 | (char**) &pidfile_name_ptr, (char**) &pidfile_name_ptr, 0, GET_STR, | 1808 | NULL, NULL, 0, GET_STR, |
342 | 1817 | REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, | 1809 | REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
343 | 1818 | {"port-open-timeout", OPT_PORT_OPEN_TIMEOUT, | 1810 | {"port-open-timeout", OPT_PORT_OPEN_TIMEOUT, |
344 | 1819 | N_("Maximum time in seconds to wait for the port to become free. " | 1811 | N_("Maximum time in seconds to wait for the port to become free. " |
345 | @@ -1823,7 +1815,7 @@ | |||
346 | 1823 | {"secure-file-priv", OPT_SECURE_FILE_PRIV, | 1815 | {"secure-file-priv", OPT_SECURE_FILE_PRIV, |
347 | 1824 | N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files " | 1816 | N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files " |
348 | 1825 | "within specified directory"), | 1817 | "within specified directory"), |
350 | 1826 | (char**) &opt_secure_file_priv, (char**) &opt_secure_file_priv, 0, | 1818 | NULL, NULL, 0, |
351 | 1827 | GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, | 1819 | GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
352 | 1828 | {"server-id", OPT_SERVER_ID, | 1820 | {"server-id", OPT_SERVER_ID, |
353 | 1829 | N_("Uniquely identifies the server instance in the community of " | 1821 | N_("Uniquely identifies the server instance in the community of " |
354 | @@ -2121,9 +2113,7 @@ | |||
355 | 2121 | static void drizzle_init_variables(void) | 2113 | static void drizzle_init_variables(void) |
356 | 2122 | { | 2114 | { |
357 | 2123 | /* Things reset to zero */ | 2115 | /* Things reset to zero */ |
358 | 2124 | drizzle_home[0]= pidfile_name[0]= 0; | ||
359 | 2125 | opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name ! | 2116 | opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name ! |
360 | 2126 | opt_secure_file_priv= 0; | ||
361 | 2127 | cleanup_done= 0; | 2117 | cleanup_done= 0; |
362 | 2128 | dropping_tables= ha_open_options=0; | 2118 | dropping_tables= ha_open_options=0; |
363 | 2129 | test_flags.reset(); | 2119 | test_flags.reset(); |
364 | @@ -2141,8 +2131,6 @@ | |||
365 | 2141 | character_set_filesystem= &my_charset_bin; | 2131 | character_set_filesystem= &my_charset_bin; |
366 | 2142 | 2132 | ||
367 | 2143 | /* Things with default values that are not zero */ | 2133 | /* Things with default values that are not zero */ |
368 | 2144 | drizzle_home_ptr= drizzle_home; | ||
369 | 2145 | pidfile_name_ptr= pidfile_name; | ||
370 | 2146 | session_startup_options= (OPTION_AUTO_IS_NULL | OPTION_SQL_NOTES); | 2134 | session_startup_options= (OPTION_AUTO_IS_NULL | OPTION_SQL_NOTES); |
371 | 2147 | refresh_version= 1L; /* Increments on each reload */ | 2135 | refresh_version= 1L; /* Increments on each reload */ |
372 | 2148 | global_thread_id= 1UL; | 2136 | global_thread_id= 1UL; |
373 | @@ -2197,11 +2185,6 @@ | |||
374 | 2197 | have_symlink=SHOW_OPTION_YES; | 2185 | have_symlink=SHOW_OPTION_YES; |
375 | 2198 | #endif | 2186 | #endif |
376 | 2199 | 2187 | ||
377 | 2200 | const char *tmpenv; | ||
378 | 2201 | if (!(tmpenv = getenv("MY_BASEDIR_VERSION"))) | ||
379 | 2202 | tmpenv = PREFIX; | ||
380 | 2203 | (void) strncpy(drizzle_home, tmpenv, sizeof(drizzle_home)-1); | ||
381 | 2204 | |||
382 | 2205 | connection_count= 0; | 2188 | connection_count= 0; |
383 | 2206 | } | 2189 | } |
384 | 2207 | 2190 | ||
385 | @@ -2213,19 +2196,9 @@ | |||
386 | 2213 | static void get_options() | 2196 | static void get_options() |
387 | 2214 | { | 2197 | { |
388 | 2215 | 2198 | ||
399 | 2216 | if (vm.count("base-dir")) | 2199 | fs::path &data_home_catalog= getDataHomeCatalog(); |
390 | 2217 | { | ||
391 | 2218 | strncpy(drizzle_home,vm["base-dir"].as<string>().c_str(),sizeof(drizzle_home)-1); | ||
392 | 2219 | } | ||
393 | 2220 | |||
394 | 2221 | if (vm.count("datadir")) | ||
395 | 2222 | { | ||
396 | 2223 | getDataHome()= vm["datadir"].as<string>(); | ||
397 | 2224 | } | ||
398 | 2225 | string &data_home_catalog= getDataHomeCatalog(); | ||
400 | 2226 | data_home_catalog= getDataHome(); | 2200 | data_home_catalog= getDataHome(); |
403 | 2227 | data_home_catalog.push_back('/'); | 2201 | data_home_catalog /= "local"; |
402 | 2228 | data_home_catalog.append("local"); | ||
404 | 2229 | 2202 | ||
405 | 2230 | if (vm.count("user")) | 2203 | if (vm.count("user")) |
406 | 2231 | { | 2204 | { |
407 | @@ -2277,11 +2250,6 @@ | |||
408 | 2277 | internal::my_use_symdir=0; | 2250 | internal::my_use_symdir=0; |
409 | 2278 | } | 2251 | } |
410 | 2279 | 2252 | ||
411 | 2280 | if (vm.count("pid-file")) | ||
412 | 2281 | { | ||
413 | 2282 | strncpy(pidfile_name, vm["pid-file"].as<string>().c_str(), sizeof(pidfile_name)-1); | ||
414 | 2283 | } | ||
415 | 2284 | |||
416 | 2285 | if (vm.count("transaction-isolation")) | 2253 | if (vm.count("transaction-isolation")) |
417 | 2286 | { | 2254 | { |
418 | 2287 | int type; | 2255 | int type; |
419 | @@ -2329,61 +2297,15 @@ | |||
420 | 2329 | } | 2297 | } |
421 | 2330 | 2298 | ||
422 | 2331 | 2299 | ||
423 | 2332 | static const char *get_relative_path(const char *path) | ||
424 | 2333 | { | ||
425 | 2334 | if (internal::test_if_hard_path(path) && | ||
426 | 2335 | (strncmp(path, PREFIX, strlen(PREFIX)) == 0) && | ||
427 | 2336 | strcmp(PREFIX,FN_ROOTDIR)) | ||
428 | 2337 | { | ||
429 | 2338 | if (strlen(PREFIX) < strlen(path)) | ||
430 | 2339 | path+=(size_t) strlen(PREFIX); | ||
431 | 2340 | while (*path == FN_LIBCHAR) | ||
432 | 2341 | path++; | ||
433 | 2342 | } | ||
434 | 2343 | return path; | ||
435 | 2344 | } | ||
436 | 2345 | |||
437 | 2346 | |||
438 | 2347 | static void fix_paths() | 2300 | static void fix_paths() |
439 | 2348 | { | 2301 | { |
461 | 2349 | char buff[FN_REFLEN],*pos,rp_buff[PATH_MAX]; | 2302 | fs::path pid_file_path(pid_file); |
441 | 2350 | internal::convert_dirname(drizzle_home,drizzle_home,NULL); | ||
442 | 2351 | /* Resolve symlinks to allow 'drizzle_home' to be a relative symlink */ | ||
443 | 2352 | #if defined(HAVE_BROKEN_REALPATH) | ||
444 | 2353 | internal::my_load_path(drizzle_home, drizzle_home, NULL); | ||
445 | 2354 | #else | ||
446 | 2355 | if (!realpath(drizzle_home,rp_buff)) | ||
447 | 2356 | internal::my_load_path(rp_buff, drizzle_home, NULL); | ||
448 | 2357 | rp_buff[FN_REFLEN-1]= '\0'; | ||
449 | 2358 | strcpy(drizzle_home,rp_buff); | ||
450 | 2359 | /* Ensure that drizzle_home ends in FN_LIBCHAR */ | ||
451 | 2360 | pos= strchr(drizzle_home, '\0'); | ||
452 | 2361 | #endif | ||
453 | 2362 | if (pos[-1] != FN_LIBCHAR) | ||
454 | 2363 | { | ||
455 | 2364 | pos[0]= FN_LIBCHAR; | ||
456 | 2365 | pos[1]= 0; | ||
457 | 2366 | } | ||
458 | 2367 | (void) internal::my_load_path(drizzle_home, drizzle_home,""); // Resolve current dir | ||
459 | 2368 | |||
460 | 2369 | fs::path pid_file_path(pidfile_name); | ||
462 | 2370 | if (pid_file_path.root_path().string() == "") | 2303 | if (pid_file_path.root_path().string() == "") |
463 | 2371 | { | 2304 | { |
479 | 2372 | pid_file_path= fs::path(getDataHome()); | 2305 | pid_file_path= getDataHome(); |
480 | 2373 | pid_file_path /= pidfile_name; | 2306 | pid_file_path /= pid_file; |
481 | 2374 | } | 2307 | } |
482 | 2375 | strncpy(pidfile_name, pid_file_path.file_string().c_str(), sizeof(pidfile_name)-1); | 2308 | pid_file= pid_file_path; |
468 | 2376 | |||
469 | 2377 | |||
470 | 2378 | const char *sharedir= get_relative_path(PKGDATADIR); | ||
471 | 2379 | if (internal::test_if_hard_path(sharedir)) | ||
472 | 2380 | strncpy(buff,sharedir,sizeof(buff)-1); | ||
473 | 2381 | else | ||
474 | 2382 | { | ||
475 | 2383 | strcpy(buff, drizzle_home); | ||
476 | 2384 | strncat(buff, sharedir, sizeof(buff)-strlen(drizzle_home)-1); | ||
477 | 2385 | } | ||
478 | 2386 | internal::convert_dirname(buff,buff,NULL); | ||
483 | 2387 | 2309 | ||
484 | 2388 | if (not opt_help) | 2310 | if (not opt_help) |
485 | 2389 | { | 2311 | { |
486 | @@ -2397,7 +2319,7 @@ | |||
487 | 2397 | } | 2319 | } |
488 | 2398 | else if (tmp_string == NULL) | 2320 | else if (tmp_string == NULL) |
489 | 2399 | { | 2321 | { |
491 | 2400 | drizzle_tmpdir.append(getDataHome()); | 2322 | drizzle_tmpdir.append(getDataHome().file_string()); |
492 | 2401 | drizzle_tmpdir.push_back(FN_LIBCHAR); | 2323 | drizzle_tmpdir.push_back(FN_LIBCHAR); |
493 | 2402 | drizzle_tmpdir.append(GLOBAL_TEMPORARY_EXT); | 2324 | drizzle_tmpdir.append(GLOBAL_TEMPORARY_EXT); |
494 | 2403 | } | 2325 | } |
495 | @@ -2425,18 +2347,6 @@ | |||
496 | 2425 | } | 2347 | } |
497 | 2426 | } | 2348 | } |
498 | 2427 | 2349 | ||
499 | 2428 | /* | ||
500 | 2429 | Convert the secure-file-priv option to system format, allowing | ||
501 | 2430 | a quick strcmp to check if read or write is in an allowed dir | ||
502 | 2431 | */ | ||
503 | 2432 | if (vm.count("secure-file-priv")) | ||
504 | 2433 | { | ||
505 | 2434 | internal::convert_dirname(buff, vm["secure-file-priv"].as<string>().c_str(), NULL); | ||
506 | 2435 | free(opt_secure_file_priv); | ||
507 | 2436 | opt_secure_file_priv= strdup(buff); | ||
508 | 2437 | if (opt_secure_file_priv == NULL) | ||
509 | 2438 | exit(1); | ||
510 | 2439 | } | ||
511 | 2440 | } | 2350 | } |
512 | 2441 | 2351 | ||
513 | 2442 | } /* namespace drizzled */ | 2352 | } /* namespace drizzled */ |
514 | 2443 | 2353 | ||
515 | === modified file 'drizzled/file_exchange.h' | |||
516 | --- drizzled/file_exchange.h 2010-02-04 08:14:46 +0000 | |||
517 | +++ drizzled/file_exchange.h 2010-10-06 07:38:58 +0000 | |||
518 | @@ -40,7 +40,8 @@ | |||
519 | 40 | XXX: We never call destructor for objects of this class. | 40 | XXX: We never call destructor for objects of this class. |
520 | 41 | */ | 41 | */ |
521 | 42 | 42 | ||
523 | 43 | class file_exchange :public memory::SqlAlloc | 43 | class file_exchange : |
524 | 44 | public memory::SqlAlloc | ||
525 | 44 | { | 45 | { |
526 | 45 | public: | 46 | public: |
527 | 46 | enum enum_filetype filetype; /* load XML, Added by Arnold & Erik */ | 47 | enum enum_filetype filetype; /* load XML, Added by Arnold & Erik */ |
528 | 47 | 48 | ||
529 | === modified file 'drizzled/function/str/load_file.cc' | |||
530 | --- drizzled/function/str/load_file.cc 2010-09-22 07:05:47 +0000 | |||
531 | +++ drizzled/function/str/load_file.cc 2010-10-06 07:38:58 +0000 | |||
532 | @@ -25,8 +25,14 @@ | |||
533 | 25 | #include <drizzled/session.h> | 25 | #include <drizzled/session.h> |
534 | 26 | #include "drizzled/internal/my_sys.h" | 26 | #include "drizzled/internal/my_sys.h" |
535 | 27 | 27 | ||
536 | 28 | #include <boost/filesystem.hpp> | ||
537 | 29 | |||
538 | 28 | #include <fcntl.h> | 30 | #include <fcntl.h> |
539 | 29 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
540 | 32 | #include <iostream> | ||
541 | 33 | |||
542 | 34 | namespace fs=boost::filesystem; | ||
543 | 35 | using namespace std; | ||
544 | 30 | 36 | ||
545 | 31 | namespace drizzled | 37 | namespace drizzled |
546 | 32 | { | 38 | { |
547 | @@ -37,27 +43,49 @@ | |||
548 | 37 | String *file_name; | 43 | String *file_name; |
549 | 38 | int file; | 44 | int file; |
550 | 39 | struct stat stat_info; | 45 | struct stat stat_info; |
551 | 40 | char path[FN_REFLEN]; | ||
552 | 41 | 46 | ||
553 | 42 | if (!(file_name= args[0]->val_str(str))) | 47 | if (!(file_name= args[0]->val_str(str))) |
555 | 43 | goto err; | 48 | { |
556 | 49 | null_value = 1; | ||
557 | 50 | return(0); | ||
558 | 51 | } | ||
559 | 44 | 52 | ||
562 | 45 | (void) internal::fn_format(path, file_name->c_ptr(), getDataHome().c_str(), "", | 53 | fs::path target_path(fs::system_complete(getDataHomeCatalog())); |
563 | 46 | MY_RELATIVE_PATH | MY_UNPACK_FILENAME); | 54 | fs::path to_file(file_name->c_ptr()); |
564 | 55 | if (not to_file.has_root_directory()) | ||
565 | 56 | { | ||
566 | 57 | target_path /= to_file; | ||
567 | 58 | } | ||
568 | 59 | else | ||
569 | 60 | { | ||
570 | 61 | target_path= to_file; | ||
571 | 62 | } | ||
572 | 47 | 63 | ||
573 | 48 | /* Read only allowed from within dir specified by secure_file_priv */ | 64 | /* Read only allowed from within dir specified by secure_file_priv */ |
577 | 49 | if (opt_secure_file_priv && | 65 | if (not secure_file_priv.string().empty()) |
578 | 50 | strncmp(opt_secure_file_priv, path, strlen(opt_secure_file_priv))) | 66 | { |
579 | 51 | goto err; | 67 | fs::path secure_file_path(fs::system_complete(secure_file_priv)); |
580 | 68 | if (target_path.file_string().substr(0, secure_file_path.file_string().size()) != secure_file_path.file_string()) | ||
581 | 69 | { | ||
582 | 70 | /* Read only allowed from within dir specified by secure_file_priv */ | ||
583 | 71 | my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv"); | ||
584 | 72 | null_value = 1; | ||
585 | 73 | return 0; | ||
586 | 74 | } | ||
587 | 75 | } | ||
588 | 52 | 76 | ||
590 | 53 | if (stat(path, &stat_info)) | 77 | if (stat(target_path.file_string().c_str(), &stat_info)) |
591 | 78 | { | ||
592 | 79 | my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), file_name->c_ptr()); | ||
593 | 54 | goto err; | 80 | goto err; |
594 | 81 | } | ||
595 | 55 | 82 | ||
596 | 56 | if (!(stat_info.st_mode & S_IROTH)) | 83 | if (!(stat_info.st_mode & S_IROTH)) |
597 | 57 | { | 84 | { |
599 | 58 | /* my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), file_name->c_ptr()); */ | 85 | my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), file_name->c_ptr()); |
600 | 59 | goto err; | 86 | goto err; |
601 | 60 | } | 87 | } |
602 | 88 | |||
603 | 61 | if (stat_info.st_size > (long) session.variables.max_allowed_packet) | 89 | if (stat_info.st_size > (long) session.variables.max_allowed_packet) |
604 | 62 | { | 90 | { |
605 | 63 | push_warning_printf(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN, | 91 | push_warning_printf(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN, |
606 | @@ -66,15 +94,25 @@ | |||
607 | 66 | func_name(), session.variables.max_allowed_packet); | 94 | func_name(), session.variables.max_allowed_packet); |
608 | 67 | goto err; | 95 | goto err; |
609 | 68 | } | 96 | } |
610 | 97 | |||
611 | 98 | if (stat_info.st_size == 0) | ||
612 | 99 | { | ||
613 | 100 | goto err; | ||
614 | 101 | } | ||
615 | 102 | |||
616 | 69 | if (tmp_value.alloc((size_t)stat_info.st_size)) | 103 | if (tmp_value.alloc((size_t)stat_info.st_size)) |
617 | 70 | goto err; | 104 | goto err; |
619 | 71 | if ((file = internal::my_open(file_name->c_ptr(), O_RDONLY, MYF(0))) < 0) | 105 | if ((file = internal::my_open(target_path.file_string().c_str(), O_RDONLY, MYF(0))) < 0) |
620 | 72 | goto err; | 106 | goto err; |
621 | 73 | if (internal::my_read(file, (unsigned char*) tmp_value.ptr(), (size_t)stat_info.st_size, MYF(MY_NABP))) | 107 | if (internal::my_read(file, (unsigned char*) tmp_value.ptr(), (size_t)stat_info.st_size, MYF(MY_NABP))) |
622 | 74 | { | 108 | { |
623 | 75 | internal::my_close(file, MYF(0)); | 109 | internal::my_close(file, MYF(0)); |
624 | 76 | goto err; | 110 | goto err; |
625 | 77 | } | 111 | } |
626 | 112 | if (strlen(tmp_value.ptr()) == 0) | ||
627 | 113 | { | ||
628 | 114 | goto err; | ||
629 | 115 | } | ||
630 | 78 | tmp_value.length((size_t)stat_info.st_size); | 116 | tmp_value.length((size_t)stat_info.st_size); |
631 | 79 | internal::my_close(file, MYF(0)); | 117 | internal::my_close(file, MYF(0)); |
632 | 80 | null_value = 0; | 118 | null_value = 0; |
633 | 81 | 119 | ||
634 | === modified file 'drizzled/main.cc' | |||
635 | --- drizzled/main.cc 2010-10-05 08:06:38 +0000 | |||
636 | +++ drizzled/main.cc 2010-10-06 07:38:58 +0000 | |||
637 | @@ -255,11 +255,11 @@ | |||
638 | 255 | 255 | ||
639 | 256 | if (not opt_help) | 256 | if (not opt_help) |
640 | 257 | { | 257 | { |
642 | 258 | if (chdir(getDataHome().c_str())) | 258 | if (chdir(getDataHome().file_string().c_str())) |
643 | 259 | { | 259 | { |
644 | 260 | errmsg_printf(ERRMSG_LVL_ERROR, | 260 | errmsg_printf(ERRMSG_LVL_ERROR, |
645 | 261 | _("Data directory %s does not exist\n"), | 261 | _("Data directory %s does not exist\n"), |
647 | 262 | getDataHome().c_str()); | 262 | getDataHome().file_string().c_str()); |
648 | 263 | unireg_abort(1); | 263 | unireg_abort(1); |
649 | 264 | } | 264 | } |
650 | 265 | if (mkdir("local", 0700)) | 265 | if (mkdir("local", 0700)) |
651 | @@ -270,15 +270,11 @@ | |||
652 | 270 | { | 270 | { |
653 | 271 | errmsg_printf(ERRMSG_LVL_ERROR, | 271 | errmsg_printf(ERRMSG_LVL_ERROR, |
654 | 272 | _("Local catalog %s/local does not exist\n"), | 272 | _("Local catalog %s/local does not exist\n"), |
656 | 273 | getDataHome().c_str()); | 273 | getDataHome().file_string().c_str()); |
657 | 274 | unireg_abort(1); | 274 | unireg_abort(1); |
658 | 275 | } | 275 | } |
665 | 276 | /* TODO: This is a hack until we can properly support std::string in sys_var*/ | 276 | |
666 | 277 | char **data_home_ptr= getDatadirPtr(); | 277 | full_data_home= fs::system_complete(getDataHome()); |
661 | 278 | fs::path full_data_home_path(fs::system_complete(fs::path(getDataHome()))); | ||
662 | 279 | std::string full_data_home(full_data_home_path.file_string()); | ||
663 | 280 | *data_home_ptr= new char[full_data_home.size()+1] (); | ||
664 | 281 | memcpy(*data_home_ptr, full_data_home.c_str(), full_data_home.size()); | ||
667 | 282 | getDataHomeCatalog()= "./"; | 278 | getDataHomeCatalog()= "./"; |
668 | 283 | getDataHome()= "../"; | 279 | getDataHome()= "../"; |
669 | 284 | } | 280 | } |
670 | @@ -319,7 +315,7 @@ | |||
671 | 319 | select_thread_in_use=0; | 315 | select_thread_in_use=0; |
672 | 320 | (void) pthread_kill(signal_thread, SIGTERM); | 316 | (void) pthread_kill(signal_thread, SIGTERM); |
673 | 321 | 317 | ||
675 | 322 | (void) unlink(pidfile_name); // Not needed anymore | 318 | (void) unlink(pid_file.file_string().c_str()); // Not needed anymore |
676 | 323 | 319 | ||
677 | 324 | exit(1); | 320 | exit(1); |
678 | 325 | } | 321 | } |
679 | 326 | 322 | ||
680 | === modified file 'drizzled/module/library.cc' | |||
681 | --- drizzled/module/library.cc 2010-08-10 17:04:19 +0000 | |||
682 | +++ drizzled/module/library.cc 2010-10-06 07:38:58 +0000 | |||
683 | @@ -24,6 +24,8 @@ | |||
684 | 24 | #include <cerrno> | 24 | #include <cerrno> |
685 | 25 | #include <string> | 25 | #include <string> |
686 | 26 | 26 | ||
687 | 27 | #include <boost/filesystem.hpp> | ||
688 | 28 | |||
689 | 27 | #include "drizzled/plugin.h" | 29 | #include "drizzled/plugin.h" |
690 | 28 | #include "drizzled/definitions.h" | 30 | #include "drizzled/definitions.h" |
691 | 29 | #include "drizzled/error.h" | 31 | #include "drizzled/error.h" |
692 | @@ -31,6 +33,7 @@ | |||
693 | 31 | #include "drizzled/module/library.h" | 33 | #include "drizzled/module/library.h" |
694 | 32 | 34 | ||
695 | 33 | using namespace std; | 35 | using namespace std; |
696 | 36 | namespace fs=boost::filesystem; | ||
697 | 34 | 37 | ||
698 | 35 | namespace drizzled | 38 | namespace drizzled |
699 | 36 | { | 39 | { |
700 | @@ -50,22 +53,19 @@ | |||
701 | 50 | */ | 53 | */ |
702 | 51 | } | 54 | } |
703 | 52 | 55 | ||
705 | 53 | const string module::Library::getLibraryPath(const string &plugin_name) | 56 | const fs::path module::Library::getLibraryPath(const string &plugin_name) |
706 | 54 | { | 57 | { |
715 | 55 | /* Compile dll path */ | 58 | string plugin_lib_name("lib"); |
716 | 56 | string dlpath; | 59 | plugin_lib_name.append(plugin_name); |
717 | 57 | dlpath.reserve(FN_REFLEN); | 60 | plugin_lib_name.append("_plugin"); |
710 | 58 | dlpath.append(opt_plugin_dir); | ||
711 | 59 | dlpath.append("/"); | ||
712 | 60 | dlpath.append("lib"); | ||
713 | 61 | dlpath.append(plugin_name); | ||
714 | 62 | dlpath.append("_plugin"); | ||
718 | 63 | #if defined(TARGET_OS_OSX) | 61 | #if defined(TARGET_OS_OSX) |
720 | 64 | dlpath.append(".dylib"); | 62 | plugin_lib_name.append(".dylib"); |
721 | 65 | #else | 63 | #else |
723 | 66 | dlpath.append(".so"); | 64 | plugin_lib_name.append(".so"); |
724 | 67 | #endif | 65 | #endif |
726 | 68 | return dlpath; | 66 | |
727 | 67 | /* Compile dll path */ | ||
728 | 68 | return plugin_dir / plugin_lib_name; | ||
729 | 69 | } | 69 | } |
730 | 70 | 70 | ||
731 | 71 | module::Library *module::Library::loadLibrary(const string &plugin_name, bool builtin) | 71 | module::Library *module::Library::loadLibrary(const string &plugin_name, bool builtin) |
732 | @@ -102,7 +102,7 @@ | |||
733 | 102 | else | 102 | else |
734 | 103 | { | 103 | { |
735 | 104 | /* Open new dll handle */ | 104 | /* Open new dll handle */ |
737 | 105 | dlpath.assign(Library::getLibraryPath(plugin_name)); | 105 | dlpath.assign(Library::getLibraryPath(plugin_name).file_string()); |
738 | 106 | handle= dlopen(dlpath.c_str(), RTLD_NOW|RTLD_GLOBAL); | 106 | handle= dlopen(dlpath.c_str(), RTLD_NOW|RTLD_GLOBAL); |
739 | 107 | if (handle == NULL) | 107 | if (handle == NULL) |
740 | 108 | { | 108 | { |
741 | 109 | 109 | ||
742 | === modified file 'drizzled/module/library.h' | |||
743 | --- drizzled/module/library.h 2010-05-15 18:23:34 +0000 | |||
744 | +++ drizzled/module/library.h 2010-10-06 07:38:58 +0000 | |||
745 | @@ -30,6 +30,8 @@ | |||
746 | 30 | 30 | ||
747 | 31 | #include <string> | 31 | #include <string> |
748 | 32 | 32 | ||
749 | 33 | #include <boost/filesystem.hpp> | ||
750 | 34 | |||
751 | 33 | namespace drizzled | 35 | namespace drizzled |
752 | 34 | { | 36 | { |
753 | 35 | namespace module | 37 | namespace module |
754 | @@ -67,7 +69,7 @@ | |||
755 | 67 | return manifest; | 69 | return manifest; |
756 | 68 | } | 70 | } |
757 | 69 | 71 | ||
759 | 70 | static const std::string getLibraryPath(const std::string &plugin_name); | 72 | static const boost::filesystem::path getLibraryPath(const std::string &plugin_name); |
760 | 71 | static Library *loadLibrary(const std::string &plugin_name, bool builtin); | 73 | static Library *loadLibrary(const std::string &plugin_name, bool builtin); |
761 | 72 | }; | 74 | }; |
762 | 73 | 75 | ||
763 | 74 | 76 | ||
764 | === modified file 'drizzled/module/loader.cc' | |||
765 | --- drizzled/module/loader.cc 2010-10-02 21:15:42 +0000 | |||
766 | +++ drizzled/module/loader.cc 2010-10-06 07:38:58 +0000 | |||
767 | @@ -75,7 +75,6 @@ | |||
768 | 75 | static PluginOptions opt_plugin_load; | 75 | static PluginOptions opt_plugin_load; |
769 | 76 | static PluginOptions opt_plugin_add; | 76 | static PluginOptions opt_plugin_add; |
770 | 77 | static PluginOptions opt_plugin_remove; | 77 | static PluginOptions opt_plugin_remove; |
771 | 78 | char opt_plugin_dir[FN_REFLEN]; | ||
772 | 79 | const char *builtin_plugins= PANDORA_BUILTIN_LIST; | 78 | const char *builtin_plugins= PANDORA_BUILTIN_LIST; |
773 | 80 | 79 | ||
774 | 81 | /* Note that 'int version' must be the first field of every plugin | 80 | /* Note that 'int version' must be the first field of every plugin |
775 | 82 | 81 | ||
776 | === modified file 'drizzled/plugin.h' | |||
777 | --- drizzled/plugin.h 2010-09-27 18:14:40 +0000 | |||
778 | +++ drizzled/plugin.h 2010-10-06 07:38:58 +0000 | |||
779 | @@ -29,6 +29,7 @@ | |||
780 | 29 | #include "drizzled/lex_string.h" | 29 | #include "drizzled/lex_string.h" |
781 | 30 | #include "drizzled/xid.h" | 30 | #include "drizzled/xid.h" |
782 | 31 | #include <boost/program_options.hpp> | 31 | #include <boost/program_options.hpp> |
783 | 32 | #include <boost/filesystem.hpp> | ||
784 | 32 | 33 | ||
785 | 33 | namespace drizzled | 34 | namespace drizzled |
786 | 34 | { | 35 | { |
787 | @@ -46,7 +47,7 @@ | |||
788 | 46 | typedef drizzle_lex_string LEX_STRING; | 47 | typedef drizzle_lex_string LEX_STRING; |
789 | 47 | struct option; | 48 | struct option; |
790 | 48 | 49 | ||
792 | 49 | extern char opt_plugin_dir[FN_REFLEN]; | 50 | extern boost::filesystem::path plugin_dir; |
793 | 50 | 51 | ||
794 | 51 | namespace plugin { class StorageEngine; } | 52 | namespace plugin { class StorageEngine; } |
795 | 52 | 53 | ||
796 | 53 | 54 | ||
797 | === modified file 'drizzled/select_export.h' | |||
798 | --- drizzled/select_export.h 2010-03-29 20:16:08 +0000 | |||
799 | +++ drizzled/select_export.h 2010-10-06 07:38:58 +0000 | |||
800 | @@ -29,7 +29,9 @@ | |||
801 | 29 | namespace drizzled | 29 | namespace drizzled |
802 | 30 | { | 30 | { |
803 | 31 | 31 | ||
805 | 32 | class select_export :public select_to_file { | 32 | class select_export : |
806 | 33 | public select_to_file | ||
807 | 34 | { | ||
808 | 33 | uint32_t field_term_length; | 35 | uint32_t field_term_length; |
809 | 34 | int field_sep_char,escape_char,line_sep_char; | 36 | int field_sep_char,escape_char,line_sep_char; |
810 | 35 | int field_term_char; // first char of FIELDS TERMINATED BY or MAX_INT | 37 | int field_term_char; // first char of FIELDS TERMINATED BY or MAX_INT |
811 | 36 | 38 | ||
812 | === modified file 'drizzled/select_to_file.h' | |||
813 | --- drizzled/select_to_file.h 2010-02-04 08:14:46 +0000 | |||
814 | +++ drizzled/select_to_file.h 2010-10-06 07:38:58 +0000 | |||
815 | @@ -21,6 +21,8 @@ | |||
816 | 21 | #ifndef DRIZZLED_SELECT_TO_FILE_H | 21 | #ifndef DRIZZLED_SELECT_TO_FILE_H |
817 | 22 | #define DRIZZLED_SELECT_TO_FILE_H | 22 | #define DRIZZLED_SELECT_TO_FILE_H |
818 | 23 | 23 | ||
819 | 24 | #include <boost/filesystem.hpp> | ||
820 | 25 | |||
821 | 24 | namespace drizzled | 26 | namespace drizzled |
822 | 25 | { | 27 | { |
823 | 26 | 28 | ||
824 | @@ -29,14 +31,15 @@ | |||
825 | 29 | typedef struct st_io_cache IO_CACHE; | 31 | typedef struct st_io_cache IO_CACHE; |
826 | 30 | } | 32 | } |
827 | 31 | 33 | ||
829 | 32 | class select_to_file : public select_result_interceptor | 34 | class select_to_file : |
830 | 35 | public select_result_interceptor | ||
831 | 33 | { | 36 | { |
832 | 34 | protected: | 37 | protected: |
833 | 35 | file_exchange *exchange; | 38 | file_exchange *exchange; |
834 | 36 | int file; | 39 | int file; |
835 | 37 | internal::IO_CACHE *cache; | 40 | internal::IO_CACHE *cache; |
836 | 38 | ha_rows row_count; | 41 | ha_rows row_count; |
838 | 39 | char path[FN_REFLEN]; | 42 | boost::filesystem::path path; |
839 | 40 | 43 | ||
840 | 41 | public: | 44 | public: |
841 | 42 | select_to_file(file_exchange *ex); | 45 | select_to_file(file_exchange *ex); |
842 | 43 | 46 | ||
843 | === modified file 'drizzled/session.cc' | |||
844 | --- drizzled/session.cc 2010-09-28 06:27:36 +0000 | |||
845 | +++ drizzled/session.cc 2010-10-06 07:38:58 +0000 | |||
846 | @@ -913,7 +913,7 @@ | |||
847 | 913 | { | 913 | { |
848 | 914 | (void) end_io_cache(cache); | 914 | (void) end_io_cache(cache); |
849 | 915 | (void) internal::my_close(file, MYF(0)); | 915 | (void) internal::my_close(file, MYF(0)); |
851 | 916 | (void) internal::my_delete(path, MYF(0)); // Delete file on error | 916 | (void) internal::my_delete(path.file_string().c_str(), MYF(0)); // Delete file on error |
852 | 917 | file= -1; | 917 | file= -1; |
853 | 918 | } | 918 | } |
854 | 919 | } | 919 | } |
855 | @@ -947,7 +947,7 @@ | |||
856 | 947 | (void) internal::my_close(file, MYF(0)); | 947 | (void) internal::my_close(file, MYF(0)); |
857 | 948 | file= -1; | 948 | file= -1; |
858 | 949 | } | 949 | } |
860 | 950 | path[0]= '\0'; | 950 | path= ""; |
861 | 951 | row_count= 0; | 951 | row_count= 0; |
862 | 952 | } | 952 | } |
863 | 953 | 953 | ||
864 | @@ -957,7 +957,7 @@ | |||
865 | 957 | cache(static_cast<internal::IO_CACHE *>(memory::sql_calloc(sizeof(internal::IO_CACHE)))), | 957 | cache(static_cast<internal::IO_CACHE *>(memory::sql_calloc(sizeof(internal::IO_CACHE)))), |
866 | 958 | row_count(0L) | 958 | row_count(0L) |
867 | 959 | { | 959 | { |
869 | 960 | path[0]=0; | 960 | path= ""; |
870 | 961 | } | 961 | } |
871 | 962 | 962 | ||
872 | 963 | select_to_file::~select_to_file() | 963 | select_to_file::~select_to_file() |
873 | @@ -991,31 +991,40 @@ | |||
874 | 991 | */ | 991 | */ |
875 | 992 | 992 | ||
876 | 993 | 993 | ||
878 | 994 | static int create_file(Session *session, char *path, file_exchange *exchange, internal::IO_CACHE *cache) | 994 | static int create_file(Session *session, |
879 | 995 | fs::path &target_path, | ||
880 | 996 | file_exchange *exchange, | ||
881 | 997 | internal::IO_CACHE *cache) | ||
882 | 995 | { | 998 | { |
883 | 999 | fs::path to_file(exchange->file_name); | ||
884 | 996 | int file; | 1000 | int file; |
892 | 997 | uint32_t option= MY_UNPACK_FILENAME | MY_RELATIVE_PATH; | 1001 | |
893 | 998 | 1002 | if (not to_file.has_root_directory()) | |
887 | 999 | #ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS | ||
888 | 1000 | option|= MY_REPLACE_DIR; // Force use of db directory | ||
889 | 1001 | #endif | ||
890 | 1002 | |||
891 | 1003 | if (!internal::dirname_length(exchange->file_name)) | ||
894 | 1004 | { | 1003 | { |
900 | 1005 | strcpy(path, getDataHomeCatalog().c_str()); | 1004 | target_path= fs::system_complete(getDataHomeCatalog()); |
901 | 1006 | strncat(path, "/", 1); | 1005 | if (not session->db.empty()) |
902 | 1007 | if (! session->db.empty()) | 1006 | { |
903 | 1008 | strncat(path, session->db.c_str(), FN_REFLEN-getDataHomeCatalog().size()); | 1007 | int count_elements= 0; |
904 | 1009 | (void) internal::fn_format(path, exchange->file_name, path, "", option); | 1008 | for (fs::path::iterator iter= to_file.begin(); |
905 | 1009 | iter != to_file.end(); | ||
906 | 1010 | ++iter, ++count_elements) | ||
907 | 1011 | { } | ||
908 | 1012 | |||
909 | 1013 | if (count_elements == 1) | ||
910 | 1014 | { | ||
911 | 1015 | target_path /= session->db; | ||
912 | 1016 | } | ||
913 | 1017 | } | ||
914 | 1018 | target_path /= to_file; | ||
915 | 1010 | } | 1019 | } |
916 | 1011 | else | 1020 | else |
918 | 1012 | (void) internal::fn_format(path, exchange->file_name, getDataHomeCatalog().c_str(), "", option); | 1021 | { |
919 | 1022 | target_path = exchange->file_name; | ||
920 | 1023 | } | ||
921 | 1013 | 1024 | ||
923 | 1014 | if (opt_secure_file_priv) | 1025 | if (not secure_file_priv.string().empty()) |
924 | 1015 | { | 1026 | { |
928 | 1016 | fs::path secure_file_path(fs::system_complete(fs::path(opt_secure_file_priv))); | 1027 | if (target_path.file_string().substr(0, secure_file_priv.file_string().size()) != secure_file_priv.file_string()) |
926 | 1017 | fs::path target_path(fs::system_complete(fs::path(path))); | ||
927 | 1018 | if (target_path.file_string().substr(0, secure_file_path.file_string().size()) != secure_file_path.file_string()) | ||
929 | 1019 | { | 1028 | { |
930 | 1020 | /* Write only allowed to dir or subdir specified by secure_file_priv */ | 1029 | /* Write only allowed to dir or subdir specified by secure_file_priv */ |
931 | 1021 | my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv"); | 1030 | my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv"); |
932 | @@ -1023,19 +1032,19 @@ | |||
933 | 1023 | } | 1032 | } |
934 | 1024 | } | 1033 | } |
935 | 1025 | 1034 | ||
937 | 1026 | if (!access(path, F_OK)) | 1035 | if (!access(target_path.file_string().c_str(), F_OK)) |
938 | 1027 | { | 1036 | { |
939 | 1028 | my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name); | 1037 | my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name); |
940 | 1029 | return -1; | 1038 | return -1; |
941 | 1030 | } | 1039 | } |
942 | 1031 | /* Create the file world readable */ | 1040 | /* Create the file world readable */ |
944 | 1032 | if ((file= internal::my_create(path, 0666, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0) | 1041 | if ((file= internal::my_create(target_path.file_string().c_str(), 0666, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0) |
945 | 1033 | return file; | 1042 | return file; |
946 | 1034 | (void) fchmod(file, 0666); // Because of umask() | 1043 | (void) fchmod(file, 0666); // Because of umask() |
947 | 1035 | if (init_io_cache(cache, file, 0L, internal::WRITE_CACHE, 0L, 1, MYF(MY_WME))) | 1044 | if (init_io_cache(cache, file, 0L, internal::WRITE_CACHE, 0L, 1, MYF(MY_WME))) |
948 | 1036 | { | 1045 | { |
949 | 1037 | internal::my_close(file, MYF(0)); | 1046 | internal::my_close(file, MYF(0)); |
951 | 1038 | internal::my_delete(path, MYF(0)); // Delete file on error, it was just created | 1047 | internal::my_delete(target_path.file_string().c_str(), MYF(0)); // Delete file on error, it was just created |
952 | 1039 | return -1; | 1048 | return -1; |
953 | 1040 | } | 1049 | } |
954 | 1041 | return file; | 1050 | return file; |
955 | @@ -1049,7 +1058,9 @@ | |||
956 | 1049 | bool string_results= false, non_string_results= false; | 1058 | bool string_results= false, non_string_results= false; |
957 | 1050 | unit= u; | 1059 | unit= u; |
958 | 1051 | if ((uint32_t) strlen(exchange->file_name) + NAME_LEN >= FN_REFLEN) | 1060 | if ((uint32_t) strlen(exchange->file_name) + NAME_LEN >= FN_REFLEN) |
960 | 1052 | strncpy(path,exchange->file_name,FN_REFLEN-1); | 1061 | { |
961 | 1062 | path= exchange->file_name; | ||
962 | 1063 | } | ||
963 | 1053 | 1064 | ||
964 | 1054 | /* Check if there is any blobs in data */ | 1065 | /* Check if there is any blobs in data */ |
965 | 1055 | { | 1066 | { |
966 | @@ -1318,7 +1329,7 @@ | |||
967 | 1318 | if (row_count++ > 1) | 1329 | if (row_count++ > 1) |
968 | 1319 | { | 1330 | { |
969 | 1320 | my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0)); | 1331 | my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0)); |
971 | 1321 | goto err; | 1332 | return 1; |
972 | 1322 | } | 1333 | } |
973 | 1323 | while ((item=li++)) | 1334 | while ((item=li++)) |
974 | 1324 | { | 1335 | { |
975 | @@ -1326,17 +1337,15 @@ | |||
976 | 1326 | if (!res) // If NULL | 1337 | if (!res) // If NULL |
977 | 1327 | { | 1338 | { |
978 | 1328 | if (my_b_write(cache,(unsigned char*) "",1)) | 1339 | if (my_b_write(cache,(unsigned char*) "",1)) |
980 | 1329 | goto err; | 1340 | return 1; |
981 | 1330 | } | 1341 | } |
982 | 1331 | else if (my_b_write(cache,(unsigned char*) res->ptr(),res->length())) | 1342 | else if (my_b_write(cache,(unsigned char*) res->ptr(),res->length())) |
983 | 1332 | { | 1343 | { |
986 | 1333 | my_error(ER_ERROR_ON_WRITE, MYF(0), path, errno); | 1344 | my_error(ER_ERROR_ON_WRITE, MYF(0), path.file_string().c_str(), errno); |
987 | 1334 | goto err; | 1345 | return 1; |
988 | 1335 | } | 1346 | } |
989 | 1336 | } | 1347 | } |
990 | 1337 | return(0); | 1348 | return(0); |
991 | 1338 | err: | ||
992 | 1339 | return(1); | ||
993 | 1340 | } | 1349 | } |
994 | 1341 | 1350 | ||
995 | 1342 | 1351 | ||
996 | 1343 | 1352 | ||
997 | === modified file 'drizzled/set_var.cc' | |||
998 | --- drizzled/set_var.cc 2010-09-29 16:49:08 +0000 | |||
999 | +++ drizzled/set_var.cc 2010-10-06 07:38:58 +0000 | |||
1000 | @@ -86,7 +86,6 @@ | |||
1001 | 86 | extern size_t my_thread_stack_size; | 86 | extern size_t my_thread_stack_size; |
1002 | 87 | 87 | ||
1003 | 88 | class sys_var_pluginvar; | 88 | class sys_var_pluginvar; |
1004 | 89 | static DYNAMIC_ARRAY fixed_show_vars; | ||
1005 | 90 | typedef map<string, sys_var *> SystemVariableMap; | 89 | typedef map<string, sys_var *> SystemVariableMap; |
1006 | 91 | static SystemVariableMap system_variable_map; | 90 | static SystemVariableMap system_variable_map; |
1007 | 92 | extern char *opt_drizzle_tmpdir; | 91 | extern char *opt_drizzle_tmpdir; |
1008 | @@ -135,7 +134,14 @@ | |||
1009 | 135 | sys_auto_increment_offset(&vars, "auto_increment_offset", | 134 | sys_auto_increment_offset(&vars, "auto_increment_offset", |
1010 | 136 | &system_variables::auto_increment_offset); | 135 | &system_variables::auto_increment_offset); |
1011 | 137 | 136 | ||
1013 | 138 | static sys_var_const_str sys_basedir(&vars, "basedir", drizzle_home); | 137 | static sys_var_fs_path sys_basedir(&vars, "basedir", basedir); |
1014 | 138 | static sys_var_fs_path sys_pid_file(&vars, "pid_file", pid_file); | ||
1015 | 139 | static sys_var_fs_path sys_plugin_dir(&vars, "plugin_dir", plugin_dir); | ||
1016 | 140 | |||
1017 | 141 | static sys_var_size_t_ptr sys_thread_stack_size(&vars, "thread_stack", | ||
1018 | 142 | &my_thread_stack_size); | ||
1019 | 143 | static sys_var_uint32_t_ptr sys_back_log(&vars, "back_log", &back_log); | ||
1020 | 144 | |||
1021 | 139 | static sys_var_session_uint64_t sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size", | 145 | static sys_var_session_uint64_t sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size", |
1022 | 140 | &system_variables::bulk_insert_buff_size); | 146 | &system_variables::bulk_insert_buff_size); |
1023 | 141 | static sys_var_session_uint32_t sys_completion_type(&vars, "completion_type", | 147 | static sys_var_session_uint32_t sys_completion_type(&vars, "completion_type", |
1024 | @@ -144,7 +150,7 @@ | |||
1025 | 144 | fix_completion_type); | 150 | fix_completion_type); |
1026 | 145 | static sys_var_collation_sv | 151 | static sys_var_collation_sv |
1027 | 146 | sys_collation_server(&vars, "collation_server", &system_variables::collation_server, &default_charset_info); | 152 | sys_collation_server(&vars, "collation_server", &system_variables::collation_server, &default_charset_info); |
1029 | 147 | static sys_var_const_str_ptr sys_datadir(&vars, "datadir", getDatadirPtr()); | 153 | static sys_var_fs_path sys_datadir(&vars, "datadir", getDataHome()); |
1030 | 148 | 154 | ||
1031 | 149 | static sys_var_session_uint64_t sys_join_buffer_size(&vars, "join_buffer_size", | 155 | static sys_var_session_uint64_t sys_join_buffer_size(&vars, "join_buffer_size", |
1032 | 150 | &system_variables::join_buff_size); | 156 | &system_variables::join_buff_size); |
1033 | @@ -198,8 +204,8 @@ | |||
1034 | 198 | false, fix_session_mem_root); | 204 | false, fix_session_mem_root); |
1035 | 199 | static sys_var_readonly sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir); | 205 | static sys_var_readonly sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir); |
1036 | 200 | 206 | ||
1039 | 201 | static sys_var_const_str_ptr sys_secure_file_priv(&vars, "secure_file_priv", | 207 | static sys_var_fs_path sys_secure_file_priv(&vars, "secure_file_priv", |
1040 | 202 | &opt_secure_file_priv); | 208 | secure_file_priv); |
1041 | 203 | 209 | ||
1042 | 204 | static sys_var_const_str_ptr sys_scheduler(&vars, "scheduler", | 210 | static sys_var_const_str_ptr sys_scheduler(&vars, "scheduler", |
1043 | 205 | (char**)&opt_scheduler); | 211 | (char**)&opt_scheduler); |
1044 | @@ -307,21 +313,6 @@ | |||
1045 | 307 | /* Global read-only variable containing hostname */ | 313 | /* Global read-only variable containing hostname */ |
1046 | 308 | static sys_var_const_str sys_hostname(&vars, "hostname", glob_hostname); | 314 | static sys_var_const_str sys_hostname(&vars, "hostname", glob_hostname); |
1047 | 309 | 315 | ||
1048 | 310 | /* | ||
1049 | 311 | Additional variables (not derived from sys_var class, not accessible as | ||
1050 | 312 | @@varname in SELECT or SET). Sorted in alphabetical order to facilitate | ||
1051 | 313 | maintenance - SHOW VARIABLES will sort its output. | ||
1052 | 314 | TODO: remove this list completely | ||
1053 | 315 | */ | ||
1054 | 316 | |||
1055 | 317 | #define FIXED_VARS_SIZE (sizeof(fixed_vars) / sizeof(drizzle_show_var)) | ||
1056 | 318 | static drizzle_show_var fixed_vars[]= { | ||
1057 | 319 | {"back_log", (char*) &back_log, SHOW_INT}, | ||
1058 | 320 | {"pid_file", (char*) pidfile_name, SHOW_CHAR}, | ||
1059 | 321 | {"plugin_dir", (char*) opt_plugin_dir, SHOW_CHAR}, | ||
1060 | 322 | {"thread_stack", (char*) &my_thread_stack_size, SHOW_INT}, | ||
1061 | 323 | }; | ||
1062 | 324 | |||
1063 | 325 | bool sys_var::check(Session *, set_var *var) | 316 | bool sys_var::check(Session *, set_var *var) |
1064 | 326 | { | 317 | { |
1065 | 327 | var->save_result.uint64_t_value= var->value->val_int(); | 318 | var->save_result.uint64_t_value= var->value->val_int(); |
1066 | @@ -1562,23 +1553,20 @@ | |||
1067 | 1562 | SYNOPSIS | 1553 | SYNOPSIS |
1068 | 1563 | enumerate_sys_vars() | 1554 | enumerate_sys_vars() |
1069 | 1564 | session current thread | 1555 | session current thread |
1070 | 1565 | sorted If TRUE, the system variables should be sorted | ||
1071 | 1566 | 1556 | ||
1072 | 1567 | RETURN VALUES | 1557 | RETURN VALUES |
1073 | 1568 | pointer Array of drizzle_show_var elements for display | 1558 | pointer Array of drizzle_show_var elements for display |
1074 | 1569 | NULL FAILURE | 1559 | NULL FAILURE |
1075 | 1570 | */ | 1560 | */ |
1076 | 1571 | 1561 | ||
1078 | 1572 | drizzle_show_var* enumerate_sys_vars(Session *session, bool) | 1562 | drizzle_show_var* enumerate_sys_vars(Session *session) |
1079 | 1573 | { | 1563 | { |
1082 | 1574 | int fixed_count= fixed_show_vars.elements; | 1564 | int size= sizeof(drizzle_show_var) * (system_variable_map.size() + 1); |
1081 | 1575 | int size= sizeof(drizzle_show_var) * (system_variable_map.size() + fixed_count + 1); | ||
1083 | 1576 | drizzle_show_var *result= (drizzle_show_var*) session->alloc(size); | 1565 | drizzle_show_var *result= (drizzle_show_var*) session->alloc(size); |
1084 | 1577 | 1566 | ||
1085 | 1578 | if (result) | 1567 | if (result) |
1086 | 1579 | { | 1568 | { |
1089 | 1580 | drizzle_show_var *show= result + fixed_count; | 1569 | drizzle_show_var *show= result; |
1088 | 1581 | memcpy(result, fixed_show_vars.buffer, fixed_count * sizeof(drizzle_show_var)); | ||
1090 | 1582 | 1570 | ||
1091 | 1583 | SystemVariableMap::const_iterator iter= system_variable_map.begin(); | 1571 | SystemVariableMap::const_iterator iter= system_variable_map.begin(); |
1092 | 1584 | while (iter != system_variable_map.end()) | 1572 | while (iter != system_variable_map.end()) |
1093 | @@ -1587,7 +1575,7 @@ | |||
1094 | 1587 | show->name= var->getName().c_str(); | 1575 | show->name= var->getName().c_str(); |
1095 | 1588 | show->value= (char*) var; | 1576 | show->value= (char*) var; |
1096 | 1589 | show->type= SHOW_SYS; | 1577 | show->type= SHOW_SYS; |
1098 | 1590 | show++; | 1578 | ++show; |
1099 | 1591 | ++iter; | 1579 | ++iter; |
1100 | 1592 | } | 1580 | } |
1101 | 1593 | 1581 | ||
1102 | @@ -1615,13 +1603,6 @@ | |||
1103 | 1615 | 1603 | ||
1104 | 1616 | for (sys_var *var= vars.first; var; var= var->getNext(), count++) {}; | 1604 | for (sys_var *var= vars.first; var; var= var->getNext(), count++) {}; |
1105 | 1617 | 1605 | ||
1106 | 1618 | if (my_init_dynamic_array(&fixed_show_vars, sizeof(drizzle_show_var), | ||
1107 | 1619 | FIXED_VARS_SIZE + 64, 64)) | ||
1108 | 1620 | goto error; | ||
1109 | 1621 | |||
1110 | 1622 | fixed_show_vars.elements= FIXED_VARS_SIZE; | ||
1111 | 1623 | memcpy(fixed_show_vars.buffer, fixed_vars, sizeof(fixed_vars)); | ||
1112 | 1624 | |||
1113 | 1625 | vars.last->setNext(NULL); | 1606 | vars.last->setNext(NULL); |
1114 | 1626 | if (mysql_add_sys_var_chain(vars.first, my_long_options)) | 1607 | if (mysql_add_sys_var_chain(vars.first, my_long_options)) |
1115 | 1627 | goto error; | 1608 | goto error; |
1116 | @@ -1634,12 +1615,6 @@ | |||
1117 | 1634 | } | 1615 | } |
1118 | 1635 | 1616 | ||
1119 | 1636 | 1617 | ||
1120 | 1637 | void set_var_free() | ||
1121 | 1638 | { | ||
1122 | 1639 | delete_dynamic(&fixed_show_vars); | ||
1123 | 1640 | } | ||
1124 | 1641 | |||
1125 | 1642 | |||
1126 | 1643 | /** | 1618 | /** |
1127 | 1644 | Find a user set-table variable. | 1619 | Find a user set-table variable. |
1128 | 1645 | 1620 | ||
1129 | 1646 | 1621 | ||
1130 | === modified file 'drizzled/set_var.h' | |||
1131 | --- drizzled/set_var.h 2010-09-29 16:49:08 +0000 | |||
1132 | +++ drizzled/set_var.h 2010-10-06 07:38:58 +0000 | |||
1133 | @@ -21,6 +21,7 @@ | |||
1134 | 21 | #define DRIZZLED_SET_VAR_H | 21 | #define DRIZZLED_SET_VAR_H |
1135 | 22 | 22 | ||
1136 | 23 | #include <string> | 23 | #include <string> |
1137 | 24 | #include <boost/filesystem.hpp> | ||
1138 | 24 | 25 | ||
1139 | 25 | #include "drizzled/function/func.h" | 26 | #include "drizzled/function/func.h" |
1140 | 26 | #include "drizzled/function/set_user_var.h" | 27 | #include "drizzled/function/set_user_var.h" |
1141 | @@ -62,8 +63,9 @@ | |||
1142 | 62 | extern const char *in_additional_cond; | 63 | extern const char *in_additional_cond; |
1143 | 63 | extern const char *in_having_cond; | 64 | extern const char *in_having_cond; |
1144 | 64 | extern char glob_hostname[FN_REFLEN]; | 65 | extern char glob_hostname[FN_REFLEN]; |
1147 | 65 | extern char drizzle_home[FN_REFLEN]; | 66 | extern boost::filesystem::path basedir; |
1148 | 66 | extern char pidfile_name[FN_REFLEN]; | 67 | extern boost::filesystem::path pid_file; |
1149 | 68 | extern boost::filesystem::path secure_file_priv; | ||
1150 | 67 | extern char system_time_zone[30]; | 69 | extern char system_time_zone[30]; |
1151 | 68 | extern char *opt_tc_log_file; | 70 | extern char *opt_tc_log_file; |
1152 | 69 | extern uint64_t session_startup_options; | 71 | extern uint64_t session_startup_options; |
1153 | @@ -80,7 +82,6 @@ | |||
1154 | 80 | extern uint32_t volatile thread_running; | 82 | extern uint32_t volatile thread_running; |
1155 | 81 | extern uint32_t volatile global_read_lock; | 83 | extern uint32_t volatile global_read_lock; |
1156 | 82 | extern bool opt_readonly; | 84 | extern bool opt_readonly; |
1157 | 83 | extern char* opt_secure_file_priv; | ||
1158 | 84 | extern char *default_tz_name; | 85 | extern char *default_tz_name; |
1159 | 85 | extern const char *opt_scheduler; | 86 | extern const char *opt_scheduler; |
1160 | 86 | 87 | ||
1161 | @@ -360,6 +361,44 @@ | |||
1162 | 360 | }; | 361 | }; |
1163 | 361 | 362 | ||
1164 | 362 | 363 | ||
1165 | 364 | class sys_var_fs_path : | ||
1166 | 365 | public sys_var | ||
1167 | 366 | { | ||
1168 | 367 | const boost::filesystem::path &value; | ||
1169 | 368 | public: | ||
1170 | 369 | sys_var_fs_path(sys_var_chain *chain, | ||
1171 | 370 | const char *name_arg, | ||
1172 | 371 | const boost::filesystem::path& value_arg) : | ||
1173 | 372 | sys_var(name_arg), | ||
1174 | 373 | value(value_arg) | ||
1175 | 374 | { | ||
1176 | 375 | chain_sys_var(chain); | ||
1177 | 376 | } | ||
1178 | 377 | |||
1179 | 378 | inline void set(char *) | ||
1180 | 379 | { } | ||
1181 | 380 | |||
1182 | 381 | bool check(Session *, set_var *) | ||
1183 | 382 | { | ||
1184 | 383 | return true; | ||
1185 | 384 | } | ||
1186 | 385 | bool update(Session *, set_var *) | ||
1187 | 386 | { | ||
1188 | 387 | return true; | ||
1189 | 388 | } | ||
1190 | 389 | SHOW_TYPE show_type() { return SHOW_CHAR; } | ||
1191 | 390 | unsigned char *value_ptr(Session *, sql_var_t, const LEX_STRING *) | ||
1192 | 391 | { | ||
1193 | 392 | return (unsigned char*)(value.file_string().c_str()); | ||
1194 | 393 | } | ||
1195 | 394 | bool check_update_type(Item_result) | ||
1196 | 395 | { | ||
1197 | 396 | return true; | ||
1198 | 397 | } | ||
1199 | 398 | bool check_default(sql_var_t) { return true; } | ||
1200 | 399 | bool is_readonly() const { return true; } | ||
1201 | 400 | }; | ||
1202 | 401 | |||
1203 | 363 | class sys_var_const_str :public sys_var | 402 | class sys_var_const_str :public sys_var |
1204 | 364 | { | 403 | { |
1205 | 365 | char *value; // Pointer to const value | 404 | char *value; // Pointer to const value |
1206 | @@ -912,8 +951,7 @@ | |||
1207 | 912 | */ | 951 | */ |
1208 | 913 | 952 | ||
1209 | 914 | int set_var_init(); | 953 | int set_var_init(); |
1212 | 915 | void set_var_free(); | 954 | drizzle_show_var* enumerate_sys_vars(Session *session); |
1211 | 916 | drizzle_show_var* enumerate_sys_vars(Session *session, bool sorted); | ||
1213 | 917 | void drizzle_add_plugin_sysvar(sys_var_pluginvar *var); | 955 | void drizzle_add_plugin_sysvar(sys_var_pluginvar *var); |
1214 | 918 | void drizzle_del_plugin_sysvar(); | 956 | void drizzle_del_plugin_sysvar(); |
1215 | 919 | int mysql_add_sys_var_chain(sys_var *chain, struct option *long_options); | 957 | int mysql_add_sys_var_chain(sys_var *chain, struct option *long_options); |
1216 | 920 | 958 | ||
1217 | === modified file 'drizzled/sql_load.cc' | |||
1218 | --- drizzled/sql_load.cc 2010-10-02 21:15:42 +0000 | |||
1219 | +++ drizzled/sql_load.cc 2010-10-06 07:38:58 +0000 | |||
1220 | @@ -124,7 +124,6 @@ | |||
1221 | 124 | List<Item> &set_values, | 124 | List<Item> &set_values, |
1222 | 125 | enum enum_duplicates handle_duplicates, bool ignore) | 125 | enum enum_duplicates handle_duplicates, bool ignore) |
1223 | 126 | { | 126 | { |
1224 | 127 | char name[FN_REFLEN]; | ||
1225 | 128 | int file; | 127 | int file; |
1226 | 129 | Table *table= NULL; | 128 | Table *table= NULL; |
1227 | 130 | int error; | 129 | int error; |
1228 | @@ -254,61 +253,62 @@ | |||
1229 | 254 | return(true); | 253 | return(true); |
1230 | 255 | } | 254 | } |
1231 | 256 | 255 | ||
1283 | 257 | { | 256 | fs::path to_file(ex->file_name); |
1284 | 258 | #ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS | 257 | fs::path target_path(fs::system_complete(getDataHomeCatalog())); |
1285 | 259 | ex->file_name+=dirname_length(ex->file_name); | 258 | if (not to_file.has_root_directory()) |
1286 | 260 | #endif | 259 | { |
1287 | 261 | if (!internal::dirname_length(ex->file_name)) | 260 | int count_elements= 0; |
1288 | 262 | { | 261 | for (fs::path::iterator iter= to_file.begin(); |
1289 | 263 | strcpy(name, getDataHomeCatalog().c_str()); | 262 | iter != to_file.end(); |
1290 | 264 | strncat(name, "/", 1); | 263 | ++iter, ++count_elements) |
1291 | 265 | strncat(name, tdb, FN_REFLEN-getDataHomeCatalog().size()); | 264 | { } |
1292 | 266 | (void) internal::fn_format(name, ex->file_name, name, "", | 265 | |
1293 | 267 | MY_RELATIVE_PATH | MY_UNPACK_FILENAME); | 266 | if (count_elements == 1) |
1294 | 268 | } | 267 | { |
1295 | 269 | else | 268 | target_path /= tdb; |
1296 | 270 | { | 269 | } |
1297 | 271 | (void) internal::fn_format(name, ex->file_name, getDataHomeCatalog().c_str(), "", | 270 | target_path /= to_file; |
1298 | 272 | MY_RELATIVE_PATH | MY_UNPACK_FILENAME); | 271 | } |
1299 | 273 | 272 | else | |
1300 | 274 | if (opt_secure_file_priv) | 273 | { |
1301 | 275 | { | 274 | target_path= to_file; |
1302 | 276 | fs::path secure_file_path(fs::system_complete(fs::path(opt_secure_file_priv))); | 275 | } |
1303 | 277 | fs::path target_path(fs::system_complete(fs::path(name))); | 276 | |
1304 | 278 | if (target_path.file_string().substr(0, secure_file_path.file_string().size()) != secure_file_path.file_string()) | 277 | if (not secure_file_priv.string().empty()) |
1305 | 279 | { | 278 | { |
1306 | 280 | /* Read only allowed from within dir specified by secure_file_priv */ | 279 | if (target_path.file_string().substr(0, secure_file_priv.file_string().size()) != secure_file_priv.file_string()) |
1307 | 281 | my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv"); | 280 | { |
1308 | 282 | return(true); | 281 | /* Read only allowed from within dir specified by secure_file_priv */ |
1309 | 283 | } | 282 | my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv"); |
1259 | 284 | } | ||
1260 | 285 | |||
1261 | 286 | struct stat stat_info; | ||
1262 | 287 | if (stat(name,&stat_info)) | ||
1263 | 288 | { | ||
1264 | 289 | my_error(ER_FILE_NOT_FOUND, MYF(0), name, errno); | ||
1265 | 290 | return(true); | ||
1266 | 291 | } | ||
1267 | 292 | |||
1268 | 293 | // if we are not in slave thread, the cursor must be: | ||
1269 | 294 | if (!((stat_info.st_mode & S_IROTH) == S_IROTH && // readable by others | ||
1270 | 295 | (stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a symlink | ||
1271 | 296 | ((stat_info.st_mode & S_IFREG) == S_IFREG || | ||
1272 | 297 | (stat_info.st_mode & S_IFIFO) == S_IFIFO))) | ||
1273 | 298 | { | ||
1274 | 299 | my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), name); | ||
1275 | 300 | return(true); | ||
1276 | 301 | } | ||
1277 | 302 | if ((stat_info.st_mode & S_IFIFO) == S_IFIFO) | ||
1278 | 303 | is_fifo = 1; | ||
1279 | 304 | } | ||
1280 | 305 | if ((file=internal::my_open(name,O_RDONLY,MYF(MY_WME))) < 0) | ||
1281 | 306 | { | ||
1282 | 307 | my_error(ER_CANT_OPEN_FILE, MYF(0), name, errno); | ||
1310 | 308 | return(true); | 283 | return(true); |
1311 | 309 | } | 284 | } |
1312 | 310 | } | 285 | } |
1313 | 311 | 286 | ||
1314 | 287 | struct stat stat_info; | ||
1315 | 288 | if (stat(target_path.file_string().c_str(), &stat_info)) | ||
1316 | 289 | { | ||
1317 | 290 | my_error(ER_FILE_NOT_FOUND, MYF(0), target_path.file_string().c_str(), errno); | ||
1318 | 291 | return(true); | ||
1319 | 292 | } | ||
1320 | 293 | |||
1321 | 294 | // if we are not in slave thread, the cursor must be: | ||
1322 | 295 | if (!((stat_info.st_mode & S_IROTH) == S_IROTH && // readable by others | ||
1323 | 296 | (stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a symlink | ||
1324 | 297 | ((stat_info.st_mode & S_IFREG) == S_IFREG || | ||
1325 | 298 | (stat_info.st_mode & S_IFIFO) == S_IFIFO))) | ||
1326 | 299 | { | ||
1327 | 300 | my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), target_path.file_string().c_str()); | ||
1328 | 301 | return(true); | ||
1329 | 302 | } | ||
1330 | 303 | if ((stat_info.st_mode & S_IFIFO) == S_IFIFO) | ||
1331 | 304 | is_fifo = 1; | ||
1332 | 305 | |||
1333 | 306 | |||
1334 | 307 | if ((file=internal::my_open(target_path.file_string().c_str(), O_RDONLY,MYF(MY_WME))) < 0) | ||
1335 | 308 | { | ||
1336 | 309 | my_error(ER_CANT_OPEN_FILE, MYF(0), target_path.file_string().c_str(), errno); | ||
1337 | 310 | return(true); | ||
1338 | 311 | } | ||
1339 | 312 | CopyInfo info; | 312 | CopyInfo info; |
1340 | 313 | memset(&info, 0, sizeof(info)); | 313 | memset(&info, 0, sizeof(info)); |
1341 | 314 | info.ignore= ignore; | 314 | info.ignore= ignore; |
1342 | @@ -395,14 +395,16 @@ | |||
1343 | 395 | error= -1; // Error on read | 395 | error= -1; // Error on read |
1344 | 396 | goto err; | 396 | goto err; |
1345 | 397 | } | 397 | } |
1347 | 398 | snprintf(name, sizeof(name), ER(ER_LOAD_INFO), info.records, info.deleted, | 398 | |
1348 | 399 | char msg[FN_REFLEN]; | ||
1349 | 400 | snprintf(msg, sizeof(msg), ER(ER_LOAD_INFO), info.records, info.deleted, | ||
1350 | 399 | (info.records - info.copied), session->cuted_fields); | 401 | (info.records - info.copied), session->cuted_fields); |
1351 | 400 | 402 | ||
1352 | 401 | if (session->transaction.stmt.hasModifiedNonTransData()) | 403 | if (session->transaction.stmt.hasModifiedNonTransData()) |
1353 | 402 | session->transaction.all.markModifiedNonTransData(); | 404 | session->transaction.all.markModifiedNonTransData(); |
1354 | 403 | 405 | ||
1355 | 404 | /* ok to client sent only after binlog write and engine commit */ | 406 | /* ok to client sent only after binlog write and engine commit */ |
1357 | 405 | session->my_ok(info.copied + info.deleted, 0, 0L, name); | 407 | session->my_ok(info.copied + info.deleted, 0, 0L, msg); |
1358 | 406 | err: | 408 | err: |
1359 | 407 | assert(transactional_table || !(info.copied || info.deleted) || | 409 | assert(transactional_table || !(info.copied || info.deleted) || |
1360 | 408 | session->transaction.stmt.hasModifiedNonTransData()); | 410 | session->transaction.stmt.hasModifiedNonTransData()); |
1361 | 409 | 411 | ||
1362 | === modified file 'drizzled/thr_lock.cc' | |||
1363 | --- drizzled/thr_lock.cc 2010-10-02 21:15:42 +0000 | |||
1364 | +++ drizzled/thr_lock.cc 2010-10-06 07:38:58 +0000 | |||
1365 | @@ -89,7 +89,7 @@ | |||
1366 | 89 | static enum thr_lock_type thr_upgraded_concurrent_insert_lock = TL_WRITE; | 89 | static enum thr_lock_type thr_upgraded_concurrent_insert_lock = TL_WRITE; |
1367 | 90 | 90 | ||
1368 | 91 | 91 | ||
1370 | 92 | uint64_t max_write_lock_count= ~(uint64_t) 0L; | 92 | uint64_t max_write_lock_count= UINT64_MAX; |
1371 | 93 | 93 | ||
1372 | 94 | /* | 94 | /* |
1373 | 95 | ** For the future (now the thread specific cond is alloced by my_pthread.c) | 95 | ** For the future (now the thread specific cond is alloced by my_pthread.c) |
1374 | 96 | 96 | ||
1375 | === modified file 'plugin/innobase/handler/ha_innodb.cc' | |||
1376 | --- plugin/innobase/handler/ha_innodb.cc 2010-10-02 21:15:42 +0000 | |||
1377 | +++ plugin/innobase/handler/ha_innodb.cc 2010-10-06 07:38:58 +0000 | |||
1378 | @@ -90,10 +90,12 @@ | |||
1379 | 90 | 90 | ||
1380 | 91 | #include <boost/algorithm/string.hpp> | 91 | #include <boost/algorithm/string.hpp> |
1381 | 92 | #include <boost/program_options.hpp> | 92 | #include <boost/program_options.hpp> |
1382 | 93 | #include <boost/filesystem.hpp> | ||
1383 | 93 | #include <drizzled/module/option_map.h> | 94 | #include <drizzled/module/option_map.h> |
1384 | 94 | #include <iostream> | 95 | #include <iostream> |
1385 | 95 | 96 | ||
1386 | 96 | namespace po= boost::program_options; | 97 | namespace po= boost::program_options; |
1387 | 98 | namespace fs=boost::filesystem; | ||
1388 | 97 | using namespace std; | 99 | using namespace std; |
1389 | 98 | 100 | ||
1390 | 99 | /** @file ha_innodb.cc */ | 101 | /** @file ha_innodb.cc */ |
1391 | @@ -307,6 +309,7 @@ | |||
1392 | 307 | 309 | ||
1393 | 308 | /* These get strdup'd from vm variables */ | 310 | /* These get strdup'd from vm variables */ |
1394 | 309 | free(innobase_data_home_dir); | 311 | free(innobase_data_home_dir); |
1395 | 312 | free(innobase_log_group_home_dir); | ||
1396 | 310 | 313 | ||
1397 | 311 | } | 314 | } |
1398 | 312 | 315 | ||
1399 | @@ -1839,7 +1842,7 @@ | |||
1400 | 1839 | } | 1842 | } |
1401 | 1840 | else | 1843 | else |
1402 | 1841 | { | 1844 | { |
1404 | 1842 | innobase_data_home_dir= strdup(getDataHome().c_str()); | 1845 | innobase_data_home_dir= strdup(getDataHome().file_string().c_str()); |
1405 | 1843 | } | 1846 | } |
1406 | 1844 | 1847 | ||
1407 | 1845 | if (vm.count("fast-shutdown")) | 1848 | if (vm.count("fast-shutdown")) |
1408 | @@ -2160,11 +2163,11 @@ | |||
1409 | 2160 | 2163 | ||
1410 | 2161 | if (vm.count("log-group-home-dir")) | 2164 | if (vm.count("log-group-home-dir")) |
1411 | 2162 | { | 2165 | { |
1413 | 2163 | innobase_log_group_home_dir= const_cast<char *>(vm["log-group-home-dir"].as<string>().c_str()); | 2166 | innobase_log_group_home_dir= strdup(vm["log-group-home-dir"].as<string>().c_str()); |
1414 | 2164 | } | 2167 | } |
1415 | 2165 | else | 2168 | else |
1416 | 2166 | { | 2169 | { |
1418 | 2167 | innobase_log_group_home_dir = const_cast<char *>(getDataHome().c_str()); | 2170 | innobase_log_group_home_dir = strdup(getDataHome().file_string().c_str()); |
1419 | 2168 | } | 2171 | } |
1420 | 2169 | 2172 | ||
1421 | 2170 | #ifdef UNIV_LOG_ARCHIVE | 2173 | #ifdef UNIV_LOG_ARCHIVE |
1422 | @@ -6435,7 +6438,6 @@ | |||
1423 | 6435 | ib_int64_t n_rows; | 6438 | ib_int64_t n_rows; |
1424 | 6436 | ulong j; | 6439 | ulong j; |
1425 | 6437 | ulong i; | 6440 | ulong i; |
1426 | 6438 | char path[FN_REFLEN]; | ||
1427 | 6439 | os_file_stat_t stat_info; | 6441 | os_file_stat_t stat_info; |
1428 | 6440 | 6442 | ||
1429 | 6441 | /* If we are forcing recovery at a high level, we will suppress | 6443 | /* If we are forcing recovery at a high level, we will suppress |
1430 | @@ -6479,15 +6481,14 @@ | |||
1431 | 6479 | prebuilt->trx->op_info = "returning various info to MySQL"; | 6481 | prebuilt->trx->op_info = "returning various info to MySQL"; |
1432 | 6480 | } | 6482 | } |
1433 | 6481 | 6483 | ||
1438 | 6482 | snprintf(path, sizeof(path), "%s/%s%s", | 6484 | fs::path get_status_path(getDataHomeCatalog()); |
1439 | 6483 | getDataHomeCatalog().c_str(), ib_table->name, ".dfe"); | 6485 | get_status_path /= ib_table->name; |
1440 | 6484 | 6486 | fs::change_extension(get_status_path, "dfe"); | |
1437 | 6485 | internal::unpack_filename(path,path); | ||
1441 | 6486 | 6487 | ||
1442 | 6487 | /* Note that we do not know the access time of the table, | 6488 | /* Note that we do not know the access time of the table, |
1443 | 6488 | nor the CHECK TABLE time, nor the UPDATE or INSERT time. */ | 6489 | nor the CHECK TABLE time, nor the UPDATE or INSERT time. */ |
1444 | 6489 | 6490 | ||
1446 | 6490 | if (os_file_get_status(path,&stat_info)) { | 6491 | if (os_file_get_status(get_status_path.file_string().c_str(), &stat_info)) { |
1447 | 6491 | stats.create_time = (ulong) stat_info.ctime; | 6492 | stats.create_time = (ulong) stat_info.ctime; |
1448 | 6492 | } | 6493 | } |
1449 | 6493 | } | 6494 | } |
1450 | 6494 | 6495 | ||
1451 | === modified file 'plugin/pbms/src/database_ms.cc' | |||
1452 | --- plugin/pbms/src/database_ms.cc 2010-10-02 21:15:42 +0000 | |||
1453 | +++ plugin/pbms/src/database_ms.cc 2010-10-06 07:38:58 +0000 | |||
1454 | @@ -1259,7 +1259,7 @@ | |||
1455 | 1259 | * The database name is case sensitive here if the file system names are | 1259 | * The database name is case sensitive here if the file system names are |
1456 | 1260 | * case sensitive. This is desirable. | 1260 | * case sensitive. This is desirable. |
1457 | 1261 | */ | 1261 | */ |
1459 | 1262 | path = CSPath::newPath(ms_my_get_mysql_home_path(), RETAIN(db_name)); | 1262 | path = CSPath::newPath(ms_my_get_mysql_home_path().c_str(), RETAIN(db_name)); |
1460 | 1263 | push_(path); | 1263 | push_(path); |
1461 | 1264 | if (create && !path->exists()) { | 1264 | if (create && !path->exists()) { |
1462 | 1265 | CSException::throwException(CS_CONTEXT, MS_ERR_UNKNOWN_DB, db_name->getCString()); | 1265 | CSException::throwException(CS_CONTEXT, MS_ERR_UNKNOWN_DB, db_name->getCString()); |
1463 | @@ -1605,7 +1605,7 @@ | |||
1464 | 1605 | bool create = false; | 1605 | bool create = false; |
1465 | 1606 | uint32_t db_id; | 1606 | uint32_t db_id; |
1466 | 1607 | 1607 | ||
1468 | 1608 | path = createDatabasePath(ms_my_get_mysql_home_path(), CSString::newString(db_name), &db_id, &create); | 1608 | path = createDatabasePath(ms_my_get_mysql_home_path().c_str(), CSString::newString(db_name), &db_id, &create); |
1469 | 1609 | 1609 | ||
1470 | 1610 | if (path) { | 1610 | if (path) { |
1471 | 1611 | MSTransactionManager::dropDatabase(db_id); | 1611 | MSTransactionManager::dropDatabase(db_id); |
1472 | @@ -1636,7 +1636,7 @@ | |||
1473 | 1636 | // 3: <database>/<table> | 1636 | // 3: <database>/<table> |
1474 | 1637 | bool MSDatabase::convertTablePathToIDs(const char *table_path, uint32_t *db_id, uint32_t *tab_id, bool create) | 1637 | bool MSDatabase::convertTablePathToIDs(const char *table_path, uint32_t *db_id, uint32_t *tab_id, bool create) |
1475 | 1638 | { | 1638 | { |
1477 | 1639 | const char *base = ms_my_get_mysql_home_path(); | 1639 | const char *base = ms_my_get_mysql_home_path().c_str(); |
1478 | 1640 | CSString *table_url; | 1640 | CSString *table_url; |
1479 | 1641 | CSString *db_path = NULL; | 1641 | CSString *db_path = NULL; |
1480 | 1642 | CSString *db_name = NULL; | 1642 | CSString *db_name = NULL; |
1481 | @@ -1736,7 +1736,7 @@ | |||
1482 | 1736 | MSDatabase *db; | 1736 | MSDatabase *db; |
1483 | 1737 | enter_(); | 1737 | enter_(); |
1484 | 1738 | 1738 | ||
1486 | 1739 | db = newDatabase(ms_my_get_mysql_home_path(), db_name, 0, create); | 1739 | db = newDatabase(ms_my_get_mysql_home_path().c_str(), db_name, 0, create); |
1487 | 1740 | 1740 | ||
1488 | 1741 | if (db) { | 1741 | if (db) { |
1489 | 1742 | push_(db); | 1742 | push_(db); |
1490 | 1743 | 1743 | ||
1491 | === modified file 'plugin/pbms/src/mysql_ms.cc' | |||
1492 | --- plugin/pbms/src/mysql_ms.cc 2010-10-02 21:15:42 +0000 | |||
1493 | +++ plugin/pbms/src/mysql_ms.cc 2010-10-06 07:38:58 +0000 | |||
1494 | @@ -56,9 +56,9 @@ | |||
1495 | 56 | } | 56 | } |
1496 | 57 | 57 | ||
1497 | 58 | #ifdef DRIZZLED | 58 | #ifdef DRIZZLED |
1499 | 59 | const char *ms_my_get_mysql_home_path() | 59 | const std::string ms_my_get_mysql_home_path() |
1500 | 60 | { | 60 | { |
1502 | 61 | return drizzled::getDataHomeCatalog().c_str(); | 61 | return drizzled::getDataHomeCatalog().file_string(); |
1503 | 62 | } | 62 | } |
1504 | 63 | 63 | ||
1505 | 64 | bool ms_is_autocommit() | 64 | bool ms_is_autocommit() |
1506 | @@ -67,7 +67,7 @@ | |||
1507 | 67 | } | 67 | } |
1508 | 68 | 68 | ||
1509 | 69 | #else | 69 | #else |
1511 | 70 | const char *ms_my_get_mysql_home_path() | 70 | const std::string ms_my_get_mysql_home_path() |
1512 | 71 | { | 71 | { |
1513 | 72 | return mysql_real_data_home; | 72 | return mysql_real_data_home; |
1514 | 73 | } | 73 | } |
1515 | 74 | 74 | ||
1516 | === modified file 'plugin/pbms/src/mysql_ms.h' | |||
1517 | --- plugin/pbms/src/mysql_ms.h 2010-10-02 21:15:42 +0000 | |||
1518 | +++ plugin/pbms/src/mysql_ms.h 2010-10-06 07:38:58 +0000 | |||
1519 | @@ -30,9 +30,11 @@ | |||
1520 | 30 | #ifndef __MS_MYSQL_H__ | 30 | #ifndef __MS_MYSQL_H__ |
1521 | 31 | #define __MS_MYSQL_H__ | 31 | #define __MS_MYSQL_H__ |
1522 | 32 | 32 | ||
1523 | 33 | #include <string> | ||
1524 | 34 | |||
1525 | 33 | void *ms_my_get_thread(); | 35 | void *ms_my_get_thread(); |
1526 | 34 | uint64_t ms_my_1970_to_mysql_time(time_t t); | 36 | uint64_t ms_my_1970_to_mysql_time(time_t t); |
1528 | 35 | const char *ms_my_get_mysql_home_path(); | 37 | const std::string ms_my_get_mysql_home_path(); |
1529 | 36 | void ms_my_set_column_name(const char *table, uint16_t col_index, char *col_name); | 38 | void ms_my_set_column_name(const char *table, uint16_t col_index, char *col_name); |
1530 | 37 | bool ms_is_autocommit(); | 39 | bool ms_is_autocommit(); |
1531 | 38 | 40 | ||
1532 | 39 | 41 | ||
1533 | === modified file 'plugin/pbms/src/pbmsdaemon_ms.cc' | |||
1534 | --- plugin/pbms/src/pbmsdaemon_ms.cc 2010-06-24 19:00:02 +0000 | |||
1535 | +++ plugin/pbms/src/pbmsdaemon_ms.cc 2010-10-06 07:38:58 +0000 | |||
1536 | @@ -59,6 +59,6 @@ | |||
1537 | 59 | pbd_state = state; | 59 | pbd_state = state; |
1538 | 60 | 60 | ||
1539 | 61 | if (pbd_state == DaemonStartUp) { // In theory we could allow this to be set with a commandline option. | 61 | if (pbd_state == DaemonStartUp) { // In theory we could allow this to be set with a commandline option. |
1541 | 62 | cs_make_absolute_path(PATH_MAX, pbd_home_dir, "pbms", ms_my_get_mysql_home_path()); | 62 | cs_make_absolute_path(PATH_MAX, pbd_home_dir, "pbms", ms_my_get_mysql_home_path().c_str()); |
1542 | 63 | } | 63 | } |
1543 | 64 | } | 64 | } |
1544 | 65 | 65 | ||
1545 | === modified file 'plugin/pbms/src/system_table_ms.cc' | |||
1546 | --- plugin/pbms/src/system_table_ms.cc 2010-10-02 21:15:42 +0000 | |||
1547 | +++ plugin/pbms/src/system_table_ms.cc 2010-10-06 07:38:58 +0000 | |||
1548 | @@ -423,7 +423,7 @@ | |||
1549 | 423 | if (!db) | 423 | if (!db) |
1550 | 424 | return false; | 424 | return false; |
1551 | 425 | 425 | ||
1553 | 426 | cs_strcpy(PATH_MAX, path, ms_my_get_mysql_home_path()); | 426 | cs_strcpy(PATH_MAX, path, ms_my_get_mysql_home_path().c_str()); |
1554 | 427 | cs_add_name_to_path(PATH_MAX, path, db); | 427 | cs_add_name_to_path(PATH_MAX, path, db); |
1555 | 428 | 428 | ||
1556 | 429 | if (stat(path, &stat_info) == 0) | 429 | if (stat(path, &stat_info) == 0) |
1557 | 430 | 430 | ||
1558 | === modified file 'plugin/pbxt/src/myxt_xt.cc' | |||
1559 | --- plugin/pbxt/src/myxt_xt.cc 2010-10-02 21:15:42 +0000 | |||
1560 | +++ plugin/pbxt/src/myxt_xt.cc 2010-10-06 07:38:58 +0000 | |||
1561 | @@ -44,9 +44,11 @@ | |||
1562 | 44 | #include <drizzled/charset_info.h> | 44 | #include <drizzled/charset_info.h> |
1563 | 45 | #include <plugin/myisam/my_handler.h> | 45 | #include <plugin/myisam/my_handler.h> |
1564 | 46 | #include <plugin/myisam/myisampack.h> | 46 | #include <plugin/myisam/myisampack.h> |
1565 | 47 | #include <boost/filesystem.hpp> | ||
1566 | 47 | //extern "C" struct charset_info_st *session_charset(Session *session); | 48 | //extern "C" struct charset_info_st *session_charset(Session *session); |
1567 | 48 | extern pthread_key_t THR_Session; | 49 | extern pthread_key_t THR_Session; |
1568 | 49 | 50 | ||
1569 | 51 | namespace fs=boost::filesystem; | ||
1570 | 50 | using namespace drizzled; | 52 | using namespace drizzled; |
1571 | 51 | #else | 53 | #else |
1572 | 52 | #include "mysql_priv.h" | 54 | #include "mysql_priv.h" |
1573 | @@ -2029,12 +2031,10 @@ | |||
1574 | 2029 | message::Table::STANDARD); | 2031 | message::Table::STANDARD); |
1575 | 2030 | } | 2032 | } |
1576 | 2031 | else { | 2033 | else { |
1583 | 2032 | std::string n(getDataHomeCatalog()); | 2034 | fs::path n(getDataHomeCatalog()); |
1584 | 2033 | n.append("/"); | 2035 | n /= database_name; |
1585 | 2034 | n.append(database_name); | 2036 | n /= tab_file_name; |
1586 | 2035 | n.append("/"); | 2037 | ident = new TableIdentifier(database_name, tab_name, n.file_string()); |
1581 | 2036 | n.append(tab_file_name); | ||
1582 | 2037 | ident = new TableIdentifier(database_name, tab_name, n); | ||
1587 | 2038 | } | 2038 | } |
1588 | 2039 | 2039 | ||
1589 | 2040 | share = new TableShare(message::Table::STANDARD); | 2040 | share = new TableShare(message::Table::STANDARD); |
1590 | 2041 | 2041 | ||
1591 | === modified file 'plugin/pbxt/src/xt_defs.h' | |||
1592 | --- plugin/pbxt/src/xt_defs.h 2010-10-02 21:15:42 +0000 | |||
1593 | +++ plugin/pbxt/src/xt_defs.h 2010-10-06 07:38:58 +0000 | |||
1594 | @@ -941,7 +941,8 @@ | |||
1595 | 941 | 941 | ||
1596 | 942 | #define my_pthread_setspecific_ptr(T, V) pthread_setspecific(T, (void*) (V)) | 942 | #define my_pthread_setspecific_ptr(T, V) pthread_setspecific(T, (void*) (V)) |
1597 | 943 | 943 | ||
1599 | 944 | #define mysql_real_data_home ::drizzled::getDataHomeCatalog().c_str() | 944 | /* TODO: This is dangerous! */ |
1600 | 945 | #define mysql_real_data_home ::drizzled::getDataHomeCatalog().file_string().c_str() | ||
1601 | 945 | 946 | ||
1602 | 946 | #define mi_int4store(T,A) { uint32_t def_temp= (uint32_t) (A);\ | 947 | #define mi_int4store(T,A) { uint32_t def_temp= (uint32_t) (A);\ |
1603 | 947 | ((unsigned char*) (T))[3]= (unsigned char) (def_temp);\ | 948 | ((unsigned char*) (T))[3]= (unsigned char) (def_temp);\ |
1604 | 948 | 949 | ||
1605 | === modified file 'plugin/schema_engine/schema.cc' | |||
1606 | --- plugin/schema_engine/schema.cc 2010-09-22 07:05:47 +0000 | |||
1607 | +++ plugin/schema_engine/schema.cc 2010-10-06 07:38:58 +0000 | |||
1608 | @@ -67,7 +67,7 @@ | |||
1609 | 67 | 67 | ||
1610 | 68 | void Schema::prime() | 68 | void Schema::prime() |
1611 | 69 | { | 69 | { |
1613 | 70 | CachedDirectory directory(getDataHomeCatalog(), CachedDirectory::DIRECTORY); | 70 | CachedDirectory directory(getDataHomeCatalog().file_string(), CachedDirectory::DIRECTORY); |
1614 | 71 | CachedDirectory::Entries files= directory.getEntries(); | 71 | CachedDirectory::Entries files= directory.getEntries(); |
1615 | 72 | 72 | ||
1616 | 73 | mutex.lock(); | 73 | mutex.lock(); |
1617 | 74 | 74 | ||
1618 | === modified file 'plugin/signal_handler/signal_handler.cc' | |||
1619 | --- plugin/signal_handler/signal_handler.cc 2010-09-27 23:26:59 +0000 | |||
1620 | +++ plugin/signal_handler/signal_handler.cc 2010-10-06 07:38:58 +0000 | |||
1621 | @@ -28,6 +28,7 @@ | |||
1622 | 28 | #include "drizzled/drizzled.h" | 28 | #include "drizzled/drizzled.h" |
1623 | 29 | 29 | ||
1624 | 30 | #include <boost/thread/thread.hpp> | 30 | #include <boost/thread/thread.hpp> |
1625 | 31 | #include <boost/filesystem.hpp> | ||
1626 | 31 | 32 | ||
1627 | 32 | #include <sys/stat.h> | 33 | #include <sys/stat.h> |
1628 | 33 | #include <fcntl.h> | 34 | #include <fcntl.h> |
1629 | @@ -41,7 +42,7 @@ | |||
1630 | 41 | extern int cleanup_done; | 42 | extern int cleanup_done; |
1631 | 42 | extern bool volatile abort_loop; | 43 | extern bool volatile abort_loop; |
1632 | 43 | extern bool volatile shutdown_in_progress; | 44 | extern bool volatile shutdown_in_progress; |
1634 | 44 | extern char pidfile_name[FN_REFLEN]; | 45 | extern boost::filesystem::path pid_file; |
1635 | 45 | /* Prototypes -> all of these should be factored out into a propper shutdown */ | 46 | /* Prototypes -> all of these should be factored out into a propper shutdown */ |
1636 | 46 | extern void close_connections(void); | 47 | extern void close_connections(void); |
1637 | 47 | extern std::bitset<12> test_flags; | 48 | extern std::bitset<12> test_flags; |
1638 | @@ -88,8 +89,7 @@ | |||
1639 | 88 | int file; | 89 | int file; |
1640 | 89 | char buff[1024]; | 90 | char buff[1024]; |
1641 | 90 | 91 | ||
1644 | 91 | assert(pidfile_name[0]); | 92 | if ((file = open(pid_file.file_string().c_str(), O_CREAT|O_WRONLY|O_TRUNC, S_IRWXU|S_IRGRP|S_IROTH)) > 0) |
1643 | 92 | if ((file = open(pidfile_name, O_CREAT|O_WRONLY|O_TRUNC, S_IRWXU|S_IRGRP|S_IROTH)) > 0) | ||
1645 | 93 | { | 93 | { |
1646 | 94 | int length; | 94 | int length; |
1647 | 95 | 95 | ||
1648 | @@ -103,7 +103,7 @@ | |||
1649 | 103 | (void)close(file); /* We can ignore the error, since we are going to error anyway at this point */ | 103 | (void)close(file); /* We can ignore the error, since we are going to error anyway at this point */ |
1650 | 104 | } | 104 | } |
1651 | 105 | memset(buff, 0, sizeof(buff)); | 105 | memset(buff, 0, sizeof(buff)); |
1653 | 106 | snprintf(buff, sizeof(buff)-1, "Can't start server: can't create PID file (%s)", pidfile_name); | 106 | snprintf(buff, sizeof(buff)-1, "Can't start server: can't create PID file (%s)", pid_file.file_string().c_str()); |
1654 | 107 | sql_perror(buff); | 107 | sql_perror(buff); |
1655 | 108 | exit(1); | 108 | exit(1); |
1656 | 109 | } | 109 | } |
1657 | 110 | 110 | ||
1658 | === modified file 'plugin/status_dictionary/variables.h' | |||
1659 | --- plugin/status_dictionary/variables.h 2010-02-16 00:36:58 +0000 | |||
1660 | +++ plugin/status_dictionary/variables.h 2010-10-06 07:38:58 +0000 | |||
1661 | @@ -37,7 +37,7 @@ | |||
1662 | 37 | 37 | ||
1663 | 38 | drizzled::drizzle_show_var *getVariables() | 38 | drizzled::drizzle_show_var *getVariables() |
1664 | 39 | { | 39 | { |
1666 | 40 | return enumerate_sys_vars(current_session, false); // Final value unused | 40 | return enumerate_sys_vars(current_session); // Final value unused |
1667 | 41 | } | 41 | } |
1668 | 42 | }; | 42 | }; |
1669 | 43 | 43 | ||
1670 | 44 | 44 | ||
1671 | === modified file 'tests/r/func_str.result' | |||
1672 | --- tests/r/func_str.result 2010-08-18 21:57:15 +0000 | |||
1673 | +++ tests/r/func_str.result 2010-10-06 07:38:58 +0000 | |||
1674 | @@ -721,11 +721,7 @@ | |||
1675 | 721 | 1 | 721 | 1 |
1676 | 722 | drop table t1; | 722 | drop table t1; |
1677 | 723 | select load_file("lkjlkj"); | 723 | select load_file("lkjlkj"); |
1683 | 724 | load_file("lkjlkj") | 724 | ERROR HY000: The file 'lkjlkj' must be in the database directory or be readable by all |
1679 | 725 | NULL | ||
1680 | 726 | select ifnull(load_file("lkjlkj"),"it's null"); | ||
1681 | 727 | ifnull(load_file("lkjlkj"),"it's null") | ||
1682 | 728 | it's null | ||
1684 | 729 | CREATE TABLE t1 (a varchar(10)); | 725 | CREATE TABLE t1 (a varchar(10)); |
1685 | 730 | INSERT INTO t1 VALUES ('abc'), ('xyz'); | 726 | INSERT INTO t1 VALUES ('abc'), ('xyz'); |
1686 | 731 | SELECT a, CONCAT(a,' ',a) AS c FROM t1 | 727 | SELECT a, CONCAT(a,' ',a) AS c FROM t1 |
1687 | 732 | 728 | ||
1688 | === modified file 'tests/r/loaddata.result' | |||
1689 | --- tests/r/loaddata.result 2010-09-23 01:53:13 +0000 | |||
1690 | +++ tests/r/loaddata.result 2010-10-06 07:38:58 +0000 | |||
1691 | @@ -150,10 +150,10 @@ | |||
1692 | 150 | 15 NULL Ten | 150 | 15 NULL Ten |
1693 | 151 | show variables like "secure_file_pri%"; | 151 | show variables like "secure_file_pri%"; |
1694 | 152 | Variable_name Value | 152 | Variable_name Value |
1696 | 153 | secure_file_priv MYSQLTEST_VARDIR/ | 153 | secure_file_priv MYSQLTEST_VARDIR |
1697 | 154 | select @@secure_file_priv; | 154 | select @@secure_file_priv; |
1698 | 155 | @@secure_file_priv | 155 | @@secure_file_priv |
1700 | 156 | MYSQLTEST_VARDIR/ | 156 | MYSQLTEST_VARDIR |
1701 | 157 | set @@secure_file_priv= 0; | 157 | set @@secure_file_priv= 0; |
1702 | 158 | ERROR HY000: Variable 'secure_file_priv' is a read only variable | 158 | ERROR HY000: Variable 'secure_file_priv' is a read only variable |
1703 | 159 | truncate table t1; | 159 | truncate table t1; |
1704 | @@ -162,8 +162,7 @@ | |||
1705 | 162 | select * from t1; | 162 | select * from t1; |
1706 | 163 | a b c | 163 | a b c |
1707 | 164 | select load_file("DRIZZLE_TEST_DIR/t/loaddata.test"); | 164 | select load_file("DRIZZLE_TEST_DIR/t/loaddata.test"); |
1710 | 165 | load_file("DRIZZLE_TEST_DIR/t/loaddata.test") | 165 | ERROR HY000: The Drizzle server is running with the --secure-file-priv option so it cannot execute this statement |
1709 | 166 | NULL | ||
1711 | 167 | drop table t1, t2; | 166 | drop table t1, t2; |
1712 | 168 | create table t1(f1 int, f2 timestamp not null default current_timestamp); | 167 | create table t1(f1 int, f2 timestamp not null default current_timestamp); |
1713 | 169 | create table t2(f1 int); | 168 | create table t2(f1 int); |
1714 | 170 | 169 | ||
1715 | === modified file 'tests/r/outfile.result' | |||
1716 | --- tests/r/outfile.result 2010-09-23 01:53:13 +0000 | |||
1717 | +++ tests/r/outfile.result 2010-10-06 07:38:58 +0000 | |||
1718 | @@ -3,10 +3,13 @@ | |||
1719 | 3 | insert into t1 values("hello world"),("Hello mars"),(NULL); | 3 | insert into t1 values("hello world"),("Hello mars"),(NULL); |
1720 | 4 | select load_file(concat(@tmpdir,"/outfile-test.1")); | 4 | select load_file(concat(@tmpdir,"/outfile-test.1")); |
1721 | 5 | load_file(concat(@tmpdir,"/outfile-test.1")) | 5 | load_file(concat(@tmpdir,"/outfile-test.1")) |
1723 | 6 | NULL | 6 | hello world |
1724 | 7 | Hello mars | ||
1725 | 8 | \N | ||
1726 | 9 | |||
1727 | 7 | select load_file(concat(@tmpdir,"/outfile-test.2")); | 10 | select load_file(concat(@tmpdir,"/outfile-test.2")); |
1728 | 8 | load_file(concat(@tmpdir,"/outfile-test.2")) | 11 | load_file(concat(@tmpdir,"/outfile-test.2")) |
1730 | 9 | NULL | 12 | hello world |
1731 | 10 | select load_file(concat(@tmpdir,"/outfile-test.3")); | 13 | select load_file(concat(@tmpdir,"/outfile-test.3")); |
1732 | 11 | load_file(concat(@tmpdir,"/outfile-test.3")) | 14 | load_file(concat(@tmpdir,"/outfile-test.3")) |
1733 | 12 | NULL | 15 | NULL |
1734 | @@ -14,12 +17,12 @@ | |||
1735 | 14 | ERROR HY000: File '../../tmp/outfile-test.2' already exists | 17 | ERROR HY000: File '../../tmp/outfile-test.2' already exists |
1736 | 15 | ERROR HY000: File '../../tmp/outfile-test.3' already exists | 18 | ERROR HY000: File '../../tmp/outfile-test.3' already exists |
1737 | 16 | select load_file(concat(@tmpdir,"/outfile-test.not-exist")); | 19 | select load_file(concat(@tmpdir,"/outfile-test.not-exist")); |
1740 | 17 | load_file(concat(@tmpdir,"/outfile-test.not-exist")) | 20 | ERROR HY000: The file '../../tmp/outfile-test.not-exist' must be in the database directory or be readable by all |
1739 | 18 | NULL | ||
1741 | 19 | drop table t1; | 21 | drop table t1; |
1742 | 20 | select load_file(concat(@tmpdir,"/outfile-test.4")); | 22 | select load_file(concat(@tmpdir,"/outfile-test.4")); |
1743 | 21 | load_file(concat(@tmpdir,"/outfile-test.4")) | 23 | load_file(concat(@tmpdir,"/outfile-test.4")) |
1745 | 22 | NULL | 24 | 1 |
1746 | 25 | |||
1747 | 23 | CREATE TABLE t1 (a INT); | 26 | CREATE TABLE t1 (a INT); |
1748 | 24 | EXPLAIN | 27 | EXPLAIN |
1749 | 25 | SELECT * | 28 | SELECT * |
1750 | 26 | 29 | ||
1751 | === modified file 'tests/t/func_str.test' | |||
1752 | --- tests/t/func_str.test 2010-08-26 21:56:15 +0000 | |||
1753 | +++ tests/t/func_str.test 2010-10-06 07:38:58 +0000 | |||
1754 | @@ -469,12 +469,9 @@ | |||
1755 | 469 | --disable_metadata | 469 | --disable_metadata |
1756 | 470 | drop table t1; | 470 | drop table t1; |
1757 | 471 | 471 | ||
1758 | 472 | # | ||
1759 | 473 | # Bug #10418: LOAD_FILE does not behave like in manual if file does not exist | ||
1760 | 474 | # | ||
1761 | 475 | 472 | ||
1762 | 473 | --error ER_TEXTFILE_NOT_READABLE | ||
1763 | 476 | select load_file("lkjlkj"); | 474 | select load_file("lkjlkj"); |
1764 | 477 | select ifnull(load_file("lkjlkj"),"it's null"); | ||
1765 | 478 | 475 | ||
1766 | 479 | # | 476 | # |
1767 | 480 | # Bug#18243: REVERSE changes its argument | 477 | # Bug#18243: REVERSE changes its argument |
1768 | 481 | 478 | ||
1769 | === modified file 'tests/t/loaddata.test' | |||
1770 | --- tests/t/loaddata.test 2010-09-23 01:53:13 +0000 | |||
1771 | +++ tests/t/loaddata.test 2010-10-06 07:38:58 +0000 | |||
1772 | @@ -135,8 +135,8 @@ | |||
1773 | 135 | eval load data infile '$DRIZZLE_TEST_DIR/t/loaddata.test' into table t1; | 135 | eval load data infile '$DRIZZLE_TEST_DIR/t/loaddata.test' into table t1; |
1774 | 136 | select * from t1; | 136 | select * from t1; |
1775 | 137 | 137 | ||
1776 | 138 | # Test "load_file" returns NULL | ||
1777 | 139 | --replace_result $DRIZZLE_TEST_DIR DRIZZLE_TEST_DIR | 138 | --replace_result $DRIZZLE_TEST_DIR DRIZZLE_TEST_DIR |
1778 | 139 | --error ER_OPTION_PREVENTS_STATEMENT | ||
1779 | 140 | eval select load_file("$DRIZZLE_TEST_DIR/t/loaddata.test"); | 140 | eval select load_file("$DRIZZLE_TEST_DIR/t/loaddata.test"); |
1780 | 141 | 141 | ||
1781 | 142 | # cleanup | 142 | # cleanup |
1782 | 143 | 143 | ||
1783 | === modified file 'tests/t/outfile.test' | |||
1784 | --- tests/t/outfile.test 2010-09-23 01:53:13 +0000 | |||
1785 | +++ tests/t/outfile.test 2010-10-06 07:38:58 +0000 | |||
1786 | @@ -38,6 +38,7 @@ | |||
1787 | 38 | --error ER_FILE_EXISTS_ERROR | 38 | --error ER_FILE_EXISTS_ERROR |
1788 | 39 | eval select * into dumpfile "../../tmp/outfile-test.3" from t1; | 39 | eval select * into dumpfile "../../tmp/outfile-test.3" from t1; |
1789 | 40 | enable_query_log; | 40 | enable_query_log; |
1790 | 41 | --error ER_TEXTFILE_NOT_READABLE | ||
1791 | 41 | select load_file(concat(@tmpdir,"/outfile-test.not-exist")); | 42 | select load_file(concat(@tmpdir,"/outfile-test.not-exist")); |
1792 | 42 | --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1 | 43 | --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1 |
1793 | 43 | --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.2 | 44 | --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.2 |
1794 | @@ -48,6 +49,7 @@ | |||
1795 | 48 | disable_query_log; | 49 | disable_query_log; |
1796 | 49 | eval select 1 into outfile "../../tmp/outfile-test.4"; | 50 | eval select 1 into outfile "../../tmp/outfile-test.4"; |
1797 | 50 | enable_query_log; | 51 | enable_query_log; |
1798 | 52 | --replace_result $DRIZZLE_TEST_DIR DRIZZLE_TEST_DIR | ||
1799 | 51 | select load_file(concat(@tmpdir,"/outfile-test.4")); | 53 | select load_file(concat(@tmpdir,"/outfile-test.4")); |
1800 | 52 | --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 | 54 | --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 |
1801 | 53 | 55 |
This was approved before, but I rebased and repushed under a different name.