|
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 | +#include <fstream> |
| 97 | +#include <cassert> |
| 98 | + |
94 | 99 | #include "sql_priv.h" |
95 | 100 | #include "sql_class.h" // MYSQL_HANDLERTON_INTERFACE_VERSION |
96 | 101 | #include "ha_example.h" |
@@ -298,7 +303,8 @@ ha_example::ha_example(handlerton *hton, TABLE_SHARE *table_arg) |
298 | 303 | */ |
299 | 304 |
|
300 | 305 | static const char *ha_example_exts[] = { |
301 | | - NullS |
| 306 | + ".html", |
| 307 | + NullS |
302 | 308 | }; |
303 | 309 |
|
304 | 310 | const char **ha_example::bas_ext() const |
@@ -1016,19 +1022,25 @@ ha_rows ha_example::records_in_range(uint inx, key_range *min_key, |
1016 | 1022 | ha_create_table() in handle.cc |
1017 | 1023 | */ |
1018 | 1024 |
|
1019 | | -int ha_example::create(const char *name, TABLE *table_arg, |
1020 | | - HA_CREATE_INFO *create_info) |
| 1025 | +int ha_example::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info) |
1021 | 1026 | { |
1022 | | - DBUG_ENTER("ha_example::create"); |
| 1027 | + DBUG_ENTER("ha_example::create"); |
1023 | 1028 |
|
1024 | | - String file_name; |
1025 | | - file_name.append("foo"); |
1026 | | - file_name.append("bar"); |
1027 | | - file_name.append("baz"); |
| 1029 | + String file_name; |
| 1030 | + file_name.append(name); |
| 1031 | + file_name.append(*bas_ext()); |
1028 | 1032 |
|
1029 | | - DBUG_PRINT("ha_example", ("filename is '%s'", file_name.c_ptr())); |
| 1033 | + DBUG_PRINT("ha_example", ("filename is '%s'", file_name.c_ptr())); |
1030 | 1034 |
|
1031 | | - DBUG_RETURN(0); |
| 1035 | + std::ofstream table_file; |
| 1036 | + table_file.open(file_name.c_ptr()); |
| 1037 | + assert(table_file.is_open()); |
| 1038 | + |
| 1039 | + table_file << "<h1>Contents of " << table_arg->s->table_name.str << "</h1>\n"; |
| 1040 | + |
| 1041 | + table_file.close(); |
| 1042 | + |
| 1043 | + DBUG_RETURN(0); |
1032 | 1044 | } |
1033 | 1045 |
|
1034 | 1046 |
|
|
0 commit comments