mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-09-18 18:22:07 +08:00
MDB_DEPRECATED redefined, Constructor MACRO, generate_table_schema changed to not static, date_fmt to ISODate
__attribute__ does not exist in Visual Studio. Therefore replaced wherever it appeared with a macro: Redefines MDB_DEPRECATED to support Visual Studio Define a Constructor MACRO so that __attribute__((constructor/destructor)) behavior is achieved in Visual Studio. Just using generate_table_schema through mdb_print_schema deletes the purpose of a very good tool. generate_table_schemas is a rewrite of generate_table_schema but sends the data to a char* instead of FILE*. There is NO fmemopen() or similar in Visual Studio, so there is NO way to access memory through a FILE* except for first writing to the disk and then reading from the disk in memory. I cannot suggest how to handle the case when td == 0 for the dates. The databases I work with often have just 00:00:00 in the DateTime column which is not consistent with the rest of the column either, but I have to deal with it somehow. Leaving void* where char* is needed as a function parameter returns a compilation error in Visual Studio.
This commit is contained in:
@@ -50,7 +50,13 @@
|
||||
#define MDB_MEMO_OVERHEAD 12
|
||||
#define MDB_BIND_SIZE 16384
|
||||
|
||||
#define MDB_DEPRECATED __attribute__((deprecated))
|
||||
#ifndef _WIN32
|
||||
#define MDB_DEPRECATED(type, func) type __attribute__((deprecated)) func
|
||||
#else
|
||||
#define MDB_DEPRECATED(type, func) __declspec(deprecated) type func
|
||||
#endif
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
|
||||
enum {
|
||||
MDB_PAGE_DB = 0,
|
||||
@@ -437,8 +443,8 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
/* mem.c */
|
||||
extern void MDB_DEPRECATED mdb_init();
|
||||
extern void MDB_DEPRECATED mdb_exit();
|
||||
extern MDB_DEPRECATED(void, mdb_init());
|
||||
extern MDB_DEPRECATED(void, mdb_exit());
|
||||
|
||||
/* file.c */
|
||||
extern ssize_t mdb_read_pg(MdbHandle *mdb, unsigned long pg);
|
||||
@@ -508,14 +514,14 @@ extern int mdb_read_row(MdbTableDef *table, unsigned int row);
|
||||
extern void mdb_buffer_dump(const void *buf, int start, size_t len);
|
||||
|
||||
/* backend.c */
|
||||
extern char* MDB_DEPRECATED mdb_get_coltype_string(MdbBackend *backend, int col_type);
|
||||
extern int MDB_DEPRECATED mdb_coltype_takes_length(MdbBackend *backend, int col_type);
|
||||
extern MDB_DEPRECATED(char*, mdb_get_coltype_string(MdbBackend *backend, int col_type));
|
||||
extern MDB_DEPRECATED(int, mdb_coltype_takes_length(MdbBackend *backend, int col_type));
|
||||
extern const MdbBackendType* mdb_get_colbacktype(const MdbColumn *col);
|
||||
extern const char* mdb_get_colbacktype_string(const MdbColumn *col);
|
||||
extern int mdb_colbacktype_takes_length(const MdbColumn *col);
|
||||
extern void MDB_DEPRECATED mdb_init_backends();
|
||||
extern MDB_DEPRECATED(void, mdb_init_backends());
|
||||
extern void mdb_register_backend(char *backend_name, guint32 capabilities, MdbBackendType *backend_type, MdbBackendType *type_shortdate, MdbBackendType *type_autonum, const char *short_now, const char *long_now, const char *charset_statement, const char *drop_statement, const char *constaint_not_empty_statement, const char *column_comment_statement, const char *table_comment_statement, gchar* (*quote_schema_name)(const gchar*, const gchar*));
|
||||
extern void MDB_DEPRECATED mdb_remove_backends();
|
||||
extern MDB_DEPRECATED(void, mdb_remove_backends());
|
||||
extern int mdb_set_default_backend(MdbHandle *mdb, const char *backend_name);
|
||||
extern void generate_table_schema(FILE *outfile, MdbCatalogEntry *entry, char *dbnamespace, guint32 export_options);
|
||||
extern void generate_table_schemas(char *buf, unsigned int *bi, unsigned int *bsize, MdbCatalogEntry *entry, char *dbnamespace, guint32 export_options);
|
||||
|
Reference in New Issue
Block a user