|
91 | 91 | #pragma implementation // gcc: Class implementation |
92 | 92 | #endif |
93 | 93 |
|
94 | | -// include them before any other headers which might include my_global.h |
95 | | -// see https://trac.osgeo.org/gdal/ticket/2972 |
96 | 94 | #include <fstream> |
97 | 95 | #include <cassert> |
98 | 96 |
|
@@ -390,13 +388,27 @@ static bool example_is_supported_system_table(const char *db, |
390 | 388 |
|
391 | 389 | int ha_example::open(const char *name, int mode, uint test_if_locked) |
392 | 390 | { |
393 | | - DBUG_ENTER("ha_example::open"); |
| 391 | + DBUG_ENTER("ha_example::open"); |
394 | 392 |
|
395 | | - if (!(share = get_share(name, table))) |
396 | | - DBUG_RETURN(1); |
397 | | - thr_lock_data_init(&share->lock,&lock,NULL); |
| 393 | + if (!(share = get_share(name, table))) { |
| 394 | + DBUG_RETURN(1); |
| 395 | + } |
398 | 396 |
|
399 | | - DBUG_RETURN(0); |
| 397 | + thr_lock_data_init(&share->lock, &lock, NULL); |
| 398 | + |
| 399 | + String table_file_pathname; |
| 400 | + table_file_pathname.append(name); |
| 401 | + table_file_pathname.append(*bas_ext()); |
| 402 | + |
| 403 | + DBUG_PRINT("ha_example", ("filename is '%s'", table_file_pathname.c_ptr())); |
| 404 | + |
| 405 | + std::ofstream table_file; |
| 406 | + table_file.open(table_file_pathname.c_ptr()); |
| 407 | + assert(table_file.is_open()); |
| 408 | + |
| 409 | + // open_table_file = table_file; |
| 410 | + |
| 411 | + DBUG_RETURN(0); |
400 | 412 | } |
401 | 413 |
|
402 | 414 |
|
@@ -1026,17 +1038,24 @@ int ha_example::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *creat |
1026 | 1038 | { |
1027 | 1039 | DBUG_ENTER("ha_example::create"); |
1028 | 1040 |
|
1029 | | - String file_name; |
1030 | | - file_name.append(name); |
1031 | | - file_name.append(*bas_ext()); |
| 1041 | + String table_file_pathname; |
| 1042 | + table_file_pathname.append(name); |
| 1043 | + table_file_pathname.append(*bas_ext()); |
1032 | 1044 |
|
1033 | | - DBUG_PRINT("ha_example", ("filename is '%s'", file_name.c_ptr())); |
| 1045 | + DBUG_PRINT("ha_example", ("filename is '%s'", table_file_pathname.c_ptr())); |
1034 | 1046 |
|
1035 | 1047 | std::ofstream table_file; |
1036 | | - table_file.open(file_name.c_ptr()); |
| 1048 | + table_file.open(table_file_pathname.c_ptr()); |
1037 | 1049 | assert(table_file.is_open()); |
1038 | 1050 |
|
1039 | 1051 | table_file << "<h1>Contents of " << table_arg->s->table_name.str << "</h1>\n"; |
| 1052 | + table_file << "<ul>\n"; |
| 1053 | + |
| 1054 | + for (uint i = 0; i < table_arg->s->fields; i++) { |
| 1055 | + table_file << "<li>" << table_arg->field[i]->field_name << "</li>\n"; |
| 1056 | + } |
| 1057 | + |
| 1058 | + table_file << "</ul>\n"; |
1040 | 1059 |
|
1041 | 1060 | table_file.close(); |
1042 | 1061 |
|
|
0 commit comments