全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 ページ
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_dimpl;
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  void moveById(short id);
57  bool validLen(uchar_td FieldType, uint_td FieldLen);
58  bool isPassKey(uchar_td FieldType);
59  void openDdf(const _TCHAR* dir, short Mode, const _TCHAR* OwnerName);
60  void createDDF(const _TCHAR* fullpath);
61  void saveDDF(short tableIndex, short opration, bool forPsqlDdf = true);
62  ushort_td getDDFNewTableIndex();
63  ushort_td getDDFNewFieldIndex();
64  void doOpen(const _TCHAR* uri, char_td mode = 0,
65  const _TCHAR* ownername = NULL);
66  void doClose();
67  keylen_td writeKeyData();
68  void writeRecordData(){};
69  void onReadAfter(){};
70  void drop();
71  inline nstable* table() { return this; }
72  inline fielddef_t_my& convert(fielddef_t_my& fd_my,
73  const fielddef_t_pv& fd_pv);
74  void tableDefCopy(tabledef* dest, const tabledef* src, size_t size);
75 
76  ~dbdef();
77  dbdef(nsdatabase* pbe, short defType, short mode);
78  void create(const _TCHAR* uri);
79  void autoMakeSchema(bool noUseNullkey);
80  bool testTablePtr(tabledef* td);
81  tabledef* initReadAfter(short tableIndex, const tabledef* data, uint_td datalen);
82  void* getBufferPtr(uint_td& size);
83  bool setDefaultImage(short tableIndex, const uchar_td* p, ushort_td size);
84  bool addSchemaImage(const tabledef* p, ushort_td size, short& tableIndex);
85  void allocDatabuffer();
86 public:
87  using nstable::addref;
88  using nstable::release;
89  using nstable::refCount;
90  short tableCount() const;
91  void* relateData() const;
92  short openMode() const;
93  tabledef* tableDefs(int index);
94  tabledef** tableDefPtr(int index);
95  void setVersion(int v);
96  int version() const;
97 
98  inline short_td stat() const { return m_stat; }
99  short validateTableDef(short tableIndex);
100  void updateTableDef(short tableIndex, bool forPsqlDdf = true);
101  fielddef* insertField(short tableIndex, short insertIndex);
102  void deleteField(short tableIndex, short deleteIndex);
103  keydef* insertKey(short tableIndex, short insertIndex);
104  void deleteKey(short tableIndex, short deleteIndex);
105  void insertTable(tabledef* tableDef);
106  void deleteTable(short tableIndex);
107  void renumberTable(short oldIndex, short newIndex);
108  short tableNumByName(const _TCHAR* tableName);
109  void getFileSpec(fileSpec* fs, short tableIndex);
110  short findKeynumByFieldNum(short tableIndex, short index);
111  short fieldNumByViewNum(short tableIndex, short index);
112  short fieldNumByName(short tableIndex, const _TCHAR* name);
113  void* allocRelateData(int size);
114  uint_td fieldValidLength(eFieldQuery query, uchar_td fieldType);
115  void pushBackup(short tableIndex);
116  bool compAsBackup(short tableIndex);
117  void popBackup(short tableIndex);
118  void synchronizeSeverSchema(short tableIndex);
119 
120  inline short_td tdapErr(HWND hWnd, _TCHAR* retbuf = NULL)
121  {
122  return nstable::tdapErr(hWnd, retbuf);
123  }
124 
125  inline _TCHAR* statMsg(_TCHAR* retbuf)
126  {
127  nstable::tdapErr(0, retbuf);
128  return retbuf;
129  }
130 
131  void reopen(char_td mode = TD_OPEN_READONLY);
132  using nstable::setStat;
133  using nstable::mode;
134 };
135 
136 } // namespace client
137 } // namespace tdap
138 } // namespace protocol
139 } // namespace db
140 } // namespace bzs
141 #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_DBDEF_H
keydef * insertKey(dbdef *def, short tableid, short insertIndex)
Definition: trdboostapi.h:1055
short_td tdapErr(HWND hWnd, _TCHAR *retbuf=NULL)
Definition: nsTable.h:190
eFieldQuery
Definition: dbDef.h:38
void insertTable(dbdef *def, short id, const _TCHAR *name, unsigned short charsetIndex)
Definition: trdboostapi.h:1001
void updateTableDef(dbdef *def, short tableid)
Definition: trdboostapi.h:1084
fielddef * insertField(dbdef *def, short tableid, short fieldNum, const _TCHAR *name, uchar_td type, ushort_td len)
Definition: trdboostapi.h:1033
short_td tdapErr(HWND hWnd, _TCHAR *retbuf=NULL)
Definition: dbDef.h:120
フィールド定義構造体
Definition: tdapSchema.h:419
fielddef_t< MYSQL_FDNAME_SIZE > fielddef_t_my
Definition: tdapSchema.h:412
short_td stat() const
Definition: dbDef.h:98
テーブルスキーマ管理クラス (nocopyable noncreatable)
Definition: dbDef.h:46
void setStat(short_td v)
Definition: nsTable.h:169
テーブルアクセスの基本クラス (abstruct nocopyable)
Definition: nsTable.h:45
void deleteField(dbdef *def, short tableid, short fieldNum)
Definition: trdboostapi.h:1048
キー定義構造体
Definition: tdapSchema.h:178
void deleteKey(dbdef *def, short tableid, short keynum)
Definition: trdboostapi.h:1064
読み取り用クエリー
Definition: table.h:491
fielddef_t< PERVASIVE_FDNAME_SIZE > fielddef_t_pv
Definition: tdapSchema.h:413
void renumberTable(dbdef *def, short id, short newid)
Definition: trdboostapi.h:1025
データベースアクセスクラス
Definition: database.h:59
void deleteTable(dbdef *def, short id)
Definition: trdboostapi.h:1016
_TCHAR * statMsg(_TCHAR *retbuf)
Definition: dbDef.h:125
void synchronizeSeverSchema(dbdef *def, short tableid)
Definition: trdboostapi.h:1097
void validateTableDef(dbdef *def, short tableid)
Definition: trdboostapi.h:1071
create tableで使用するファイル定義構造体
Definition: tdapSchema.h:142
テーブル定義構造体
Definition: tdapSchema.h:1051

Transactd SDK 2018年07月31日(火) 19時40分20秒 doxygen