全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド ページ
dbDef.h
1 #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_DBDEF_H
2 #define BZS_DB_PROTOCOL_TDAP_CLIENT_DBDEF_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 "nsTable.h"
22 
23 namespace bzs
24 {
25 namespace db
26 {
27 namespace protocol
28 {
29 namespace tdap
30 {
31 namespace client
32 {
33 
34 #define TABLE_NUM_TMP 512
35 
36 /* field size for validation.
37  */
39 {
44 };
45 
46 class DLLLIB dbdef : private nstable
47 {
48  friend class database;
49  struct dbdimple* m_impl;
50  dbdef(const dbdef&);
51  dbdef& operator=(const dbdef&);
52 
53  bool isUsedField(short tableIndex, short deleteIndex);
54  void renumberFieldNum(short tableIndex, short Index, short op);
55  bool resizeAt(short tableIndex, bool key);
56  bool resizeReadBuf(void);
57  void moveById(short id);
58  bool validLen(uchar_td FieldType, uint_td FieldLen);
59  bool isPassKey(uchar_td FieldType);
60  void openDdf(const _TCHAR* dir, short Mode, const _TCHAR* OwnerName);
61  void createDDF(const _TCHAR* fullpath);
62  void saveDDF(short tableIndex, short opration, bool forPsqlDdf = true);
63  ushort_td getDDFNewTableIndex();
64  ushort_td getDDFNewFieldIndex();
65  int totalDefLength(short tableIndex);
66  void setRecordLen(short tableIndex);
67  void setCodePage(tabledef* rd);
68 
69  void doOpen(const _TCHAR* uri, char_td mode = 0,
70  const _TCHAR* ownername = NULL);
71  void doClose();
72  keylen_td writeKeyData();
73  void writeRecordData(){};
74  void onReadAfter(){};
75  void drop();
76  inline nstable* table() { return this; }
77  inline fielddef_t_my& convert(fielddef_t_my& fd_my,
78  const fielddef_t_pv& fd_pv);
79  void tableDefCopy(tabledef* dest, tabledef* src, size_t size);
80 
81  ~dbdef();
82  dbdef(nsdatabase* pbe, short defType);
83  void create(const _TCHAR* uri);
84  void autoMakeSchema();
85  void setDefType(short defType);
86  static keydef* getKeyDef(tabledef* p);
87  static fielddef* getFieldDef(tabledef* p);
88 
89 public:
90  using nstable::addref;
91  using nstable::release;
92  using nstable::refCount;
93  short tableCount() const;
94  void* relateData() const;
95  short openMode() const;
96  tabledef* tableDefs(int index);
97  tabledef** tableDefPtr(int index);
98  void setVersion(int v);
99  int version() const;
100 
101  inline short_td stat() const { return m_stat; }
102  short validateTableDef(short TableIndex);
103  void updateTableDef(short tableIndex, bool forPsqlDdf = true);
104  fielddef* insertField(short tableIndex, short insertIndex);
105  void deleteField(short tableIndex, short deleteIndex);
106  keydef* insertKey(short tableIndex, short insertIndex);
107  void deleteKey(short tableIndex, short deleteIndex);
108  void insertTable(tabledef* tableDef);
109  void deleteTable(short tableIndex);
110  void renumberTable(short oldIndex, short newIndex);
111  short tableNumByName(const _TCHAR* tableName);
112  ushort_td getRecordLen(short tableIndex);
113 
114  void getFileSpec(fileSpec* fs, short tableIndex);
115  short findKeynumByFieldNum(short tableIndex, short index);
116  short fieldNumByViewNum(short tableIndex, short index);
117  short fieldNumByName(short tableIndex, const _TCHAR* name);
118  void* allocRelateData(int size);
119 
120  uint_td fieldValidLength(eFieldQuery query, uchar_td fieldType);
121  void pushBackup(short tableIndex);
122  bool compAsBackup(short tableIndex);
123  void popBackup(short tableIndex);
124 
125  inline short_td tdapErr(HWND hWnd, _TCHAR* retbuf = NULL)
126  {
127  return nstable::tdapErr(hWnd, retbuf);
128  }
129  inline _TCHAR* statMsg(_TCHAR* retbuf)
130  {
131  nstable::tdapErr(0, retbuf);
132  return retbuf;
133  }
134 
135  void reopen(char_td mode = TD_OPEN_READONLY);
136  using nstable::setStat;
137  static ushort_td getFieldPosition(tabledef* tableDef, short fieldNum);
138  static void cacheFieldPos(tabledef* tableDef);
139 
140  using nstable::mode;
141 };
142 
143 } // namespace client
144 } // namespace tdap
145 } // namespace protocol
146 } // namespace db
147 } // namespace bzs
148 #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_DBDEF_H
const _TCHAR * protocol(const _TCHAR *uri)
Definition: uri.h:42
keydef * insertKey(dbdef *def, short tableid, short insertIndex)
Definition: trdboostapi.h:1016
short_td tdapErr(HWND hWnd, _TCHAR *retbuf=NULL)
Definition: nsTable.h:185
eFieldQuery
Definition: dbDef.h:38
void insertTable(dbdef *def, short id, const _TCHAR *name, unsigned short charsetIndex)
Definition: trdboostapi.h:962
void updateTableDef(dbdef *def, short tableid)
Definition: trdboostapi.h:1045
fielddef * insertField(dbdef *def, short tableid, short fieldNum, const _TCHAR *name, uchar_td type, ushort_td len)
Definition: trdboostapi.h:994
short_td tdapErr(HWND hWnd, _TCHAR *retbuf=NULL)
Definition: dbDef.h:125
フィールド定義構造体
Definition: tdapSchema.h:300
fielddef_t< MYSQL_FDNAME_SIZE > fielddef_t_my
Definition: tdapSchema.h:293
short_td stat() const
Definition: dbDef.h:101
テーブルスキーマ管理クラス (nocopyable noncreatable)
Definition: dbDef.h:46
void setStat(short_td v)
Definition: nsTable.h:164
テーブルアクセスの基本クラス (abstruct nocopyable)
Definition: nsTable.h:44
void deleteField(dbdef *def, short tableid, short fieldNum)
Definition: trdboostapi.h:1009
キー定義構造体
Definition: tdapSchema.h:147
void deleteKey(dbdef *def, short tableid, short keynum)
Definition: trdboostapi.h:1025
読み取り用クエリー
Definition: table.h:448
fielddef_t< PERVASIVE_FDNAME_SIZE > fielddef_t_pv
Definition: tdapSchema.h:294
void renumberTable(dbdef *def, short id, short newid)
Definition: trdboostapi.h:986
データベースアクセスクラス
Definition: database.h:59
void deleteTable(dbdef *def, short id)
Definition: trdboostapi.h:977
_TCHAR * statMsg(_TCHAR *retbuf)
Definition: dbDef.h:129
void validateTableDef(dbdef *def, short tableid)
Definition: trdboostapi.h:1032
create tableで使用するファイル定義構造体
Definition: tdapSchema.h:123
テーブル定義構造体
Definition: tdapSchema.h:660

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