Debian Codegraph @

DatabaseExplorer/MySqlDbAdapter.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : MySqlDbAdapter.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #ifndef MYSQLDBADAPTER_H
27 #define MYSQLDBADAPTER_H
28
29 #ifdef DBL_USE_MYSQL
30 #include <wx/dblayer/include/MysqlDatabaseLayer.h>
31 #endif
32
33 #include <wx/dblayer/include/DatabaseLayer.h>
34 #include <wx/dynarray.h>
35 #include "IDbAdapter.h" // Base class: IDbAdapter
36 #include "IDbType.h"
37 #include "MySqlType.h"
38
39 class MySqlDbAdapter : public IDbAdapter {
40
41 public:
42 MySqlDbAdapter();
43 MySqlDbAdapter(const wxString& serverName, const wxString& userName, const wxString& password);
44 ~MySqlDbAdapter();
45
46 virtual bool GetColumns(Table* pTab);
47 virtual void GetDatabases(DbConnection* dbCon);
48 virtual void GetTables(Database* db, bool includeViews);
49 virtual void GetViews(Database* db);
50
51 virtual IDbAdapter* Clone();
52
53 virtual bool CanConnect();
54 virtual bool IsConnected();
55 virtual void CloseConnection();
56 virtual DatabaseLayerPtr GetDatabaseLayer(const wxString& dbName);
57
58 virtual wxString GetUseDb(const wxString& dbName);
59 virtual wxString GetDefaultSelect(const wxString& dbName, const wxString& tableName);
60 virtual wxString GetDefaultSelect(const wxString& cols, const wxString& dbName, const wxString& tableName);
61 virtual wxString GetCreateTableSql(Table* tab, bool dropTable);
62 virtual wxString GetCreateViewSql(View* view, bool dropView);
63 virtual wxString GetAlterTableConstraintSql(Table* tab);
64 virtual wxString GetCreateDatabaseSql(const wxString& dbName);
65 virtual wxString GetDropTableSql(Table* pTab);
66 virtual wxString GetDropViewSql(View* pView);
67 virtual wxString GetDropDatabaseSql(Database* pDb);
68 virtual IDbType* GetDbTypeByName(const wxString& typeName);
69
70 virtual wxArrayString* GetDbTypes();
71
72
73 virtual IDbType* GetDbTypeByUniversalName(IDbType::UNIVERSAL_TYPE type);
74 virtual void ConvertTable(Table* pTab);
75 virtual IDbType* ConvertType(IDbType* pType);
76
77
78 protected:
79
80 IDbType* parseTypeString(const wxString& typeString);
81
82 wxString m_serverName;
83 wxString m_userName;
84 wxString m_password;
85
86 DatabaseLayer* m_pDbLayer;
87 };
88
89 #endif // MYSQLDBADAPTER_H