全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド ページ
database.h
1 #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_DATABASE_H
2 #define BZS_DB_PROTOCOL_TDAP_CLIENT_DATABASE_H
3 /* =================================================================
4  Copyright (C) 2000-2013 BizStation Corp All rights reserved.
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19  02111-1307, USA.
20  ================================================================= */
21 #include "nsDatabase.h"
22 
23 namespace bzs
24 {
25 namespace db
26 {
27 namespace protocol
28 {
29 namespace tdap
30 {
31 namespace client
32 {
33 
34 class database;
35 class table;
36 class dbdef;
37 
38 #if (defined(__BORLANDC__) && !defined(__APPLE__) && !defined(__clang__))
39 typedef bool __stdcall (*deleteRecordFn)(database* db, table* tb, bool inkey);
40 typedef short __stdcall (*schemaMgrFn)(database* db);
41 typedef void __stdcall (*copyDataFn)(database* db, int recordCount, int count,
42  bool& cancel);
43 #else
44 /** @cond INTERNAL */
45 /** Callback function on a record was deleted. */
46 typedef bool(__STDCALL* deleteRecordFn)(database* db, table* tb, bool inkey);
47 /** @endcond */
48 
49 /** Callback function on a database is opening by database::open operation.
50  This is use for change a table schema and table data at before database
51  */
52 typedef short(__STDCALL* schemaMgrFn)(database* db);
53 
54 /** Callback function on a record was copied by convert table operation. */
55 typedef void(__STDCALL* copyDataFn)(database* db, int recordCount, int count,
56  bool& cancel);
57 #endif
58 
59 class DLLLIB database : public nsdatabase
60 {
61  struct dbimple* m_impl;
62 
63  void setDir(const _TCHAR* directory);
64  virtual table* createTableObject();
65 
66 protected:
67  database& operator=(const database&);
68  database();
69  virtual ~database();
70  void setLockReadOnly(bool v);
71  virtual void doClose();
72  virtual void doOpen(const _TCHAR* uri, short type, short mode,
73  const _TCHAR* username);
74 
75  virtual bool onOpenAfter() { return true; };
76 
77  virtual bool onTableOpened(table* tb, short fileNum, short mode,
78  bool isCreated)
79  {
80  return true;
81  };
82  virtual char* getContinuousList(int option);
83  virtual void onCopyDataInternal(table* tb, int recordCount, int count,
84  bool& cancel);
85  virtual void doConvertTable(short tableIndex, bool turbo,
86  const _TCHAR* ownerName);
87  virtual bool doReopenDatabaseSchema();
88 
89 public:
90  virtual void release();
91  dbdef* dbDef() const;
92  const _TCHAR* rootDir() const;
93  void setRootDir(const _TCHAR* directory);
94  void* optionalData() const;
95  void setOptionalData(void* v);
96  bool tableReadOnly() const;
97  void setTableReadOnly(bool value);
98  const deleteRecordFn onDeleteRecord() const;
99  void setOnDeleteRecord(const deleteRecordFn v);
100  const copyDataFn onCopyData() const;
101  void setOnCopyData(const copyDataFn v);
102  bool open(const _TCHAR* uri, short schemaType = 0, short mode = -2,
103  const _TCHAR* dir = NULL, const _TCHAR* ownerName = NULL);
104  table* openTable(short fileNum, short mode = TD_OPEN_NORMAL,
105  bool autoCreate = true, const _TCHAR* ownerName = NULL,
106  const _TCHAR* uri = NULL);
107  table* openTable(const _TCHAR* tableName, short mode = 0,
108  bool autoCreate = true, const _TCHAR* ownerName = NULL,
109  const _TCHAR* uri = NULL);
110  database* clone();
111  bool createTable(short fileNum, const _TCHAR* uri = NULL);
112  void create(const _TCHAR* uri, short type = TYPE_SCHEMA_BDF);
113  void drop();
114  void dropTable(const _TCHAR* tableName);
115  void close(bool withDropDefaultSchema = false);
116  short aclReload();
117  short continuous(char_td op = TD_BACKUP_START, bool inclideRepfile = false);
118  short assignSchemaData(dbdef* src);
119  short copyTableData(table* dest, table* src, bool turbo, int offset = 0,
120  short keyNum = -1, int maxSkip = -1);
121  void convertTable(short tableIndex, bool turbo,
122  const _TCHAR* ownerName = NULL);
123  bool existsTableFile(short tableIndex, const _TCHAR* ownerName = NULL);
124  _TCHAR* getTableUri(_TCHAR* buf, short fileNum);
125  void getBtrVersion(btrVersions* versions);
126  bool isOpened() const;
127  char_td mode() const;
128 
129  virtual int defaultAutoIncSpace() const { return 0; };
130  static database* create();
131  /* For C++ direct only. don't use by wrapper class for COM or SWIG
132  This method is ignore refarence count of nsdatabse.
133  */
134  static void destroy(database* db);
135 };
136 
137 } // namespace client
138 } // namespace tdap
139 } // namespace protocol
140 } // namespace db
141 } // namespace bzs
142 
143 #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_DATABASE_H
const _TCHAR * protocol(const _TCHAR *uri)
Definition: uri.h:42
データベースアクセス基本クラス (nocopyable)
Definition: nsDatabase.h:55
virtual bool onOpenAfter()
Definition: database.h:75
void(__STDCALL * copyDataFn)(database *db, int recordCount, int count, bool &cancel)
Definition: database.h:55
バージョン配列構造体
Definition: tdapSchema.h:806
テーブルスキーマ管理クラス (nocopyable noncreatable)
Definition: dbDef.h:46
テーブルアクセスクラス (nocopyable)
Definition: table.h:89
void dropTable(Database_Ptr db, const _TCHAR *name)
Definition: trdboostapi.h:926
グルーピング レコード数カウンター
Definition: groupQuery.h:229
table_ptr openTable(Database_Ptr db, const _TCHAR *name, short mode=TD_OPEN_NORMAL, bool autoCreate=true, const _TCHAR *ownerName=NULL, const _TCHAR *uri=NULL)
Definition: trdboostapi.h:894
virtual int defaultAutoIncSpace() const
Definition: database.h:129
データベースアクセスクラス
Definition: database.h:59
void convertTable(Database_Ptr db, short tableid, copyDataFn func=NULL)
Definition: trdboostapi.h:935
typedef short(__STDCALL *schemaMgrFn)(database *db)
virtual bool onTableOpened(table *tb, short fileNum, short mode, bool isCreated)
Definition: database.h:77

Transactd SDK 2015年09月08日(火) 19時13分35秒 doxygen