Not strictly wxwidgets questions, but I need help if allowed...
I made my first simple class in C++ for "reusable" handling of common situations with sqlite.
Code: Select all
#ifndef SQLITEPP_H
#define SQLITEPP_H
#include <stdio.h>
#include "sqlite3.h"
class clssqlite
{
public:
int set_collation(sqlite3 *handle, char* setcollation);
int table_present(sqlite3 *handle, char* tablename);
int table_drop(sqlite3 *handle, char* tablename);
struct mystruct
{
char one[10];
int two;
float three;
} __attribute__((__packed__));
};
#endif // SQLITEPP_H
Code: Select all
clssqlite c_sql;
char* database = (char*)"m_test.db";
char* src_table = (char*)"mytable";
if (dropdb) c_sql.table_drop(db, src_table);
if (!c_sql.table_present(db, src_table))
{
// make table...
... etc...
Code: Select all
c_sql.mystruct ms;
ms.three = 3.14;
strcpy(ms.one, "my try");
And this one:
Code: Select all
#if defined(linux)
wxCSConv cconv852(wxT("ibm852"));
#else
wxCSConv cconv852(wxFONTENCODING_CP852);
#endif
I try to put it in above header but I get message "cconv852 declared more than once".
I also didn't forget to include <wx/strconv.h> for that.