KDb

KDbGlobal.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 2003-2015 Jarosław Staniek <staniek@kde.org>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KDBGLOBAL_H
21#define KDBGLOBAL_H
22
23#include "kdb_version.h"
24
25#include <QString>
26
27/*! @file KDbGlobal.h
28 Global public definitions
29*/
30
31/**
32 * @brief Make a number from the major, minor and release number of a KDb version
33 *
34 * This function can be used for preprocessing when KDB_IS_VERSION is not
35 * appropriate.
36 */
37#define KDB_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c))
38
39/**
40 * @brief Check if the KDb version matches a certain version or is higher
41 *
42 * This macro is typically used to compile conditionally a part of code:
43 * @code
44 * #if KDB_IS_VERSION(3, 1, 0)
45 * // Code for KDb 3.1
46 * #else
47 * // Code for KDb older than 3.1
48 * #endif
49 * @endcode
50 *
51 * @warning Especially during development phases of KDb, be careful
52 * when choosing the version number that you are checking against.
53 * Otherwise you might risk to break the next KDb release.
54 * Therefore be careful that development version have a
55 * version number lower than the released version, so do not check
56 * e.g. for KDb 3.1 with KDB_IS_VERSION(3, 1, 0)
57 * but with the actual version number at a time a needed feature was introduced,
58 * e.g. KDB_IS_VERSION(3, 0, 90) for beta 3.1
59 */
60#define KDB_IS_VERSION(a,b,c) ( KDB_VERSION >= KDB_MAKE_VERSION(a,b,c) )
61
62
63/*! @namespace KDb
64@brief A database connectivity and creation framework
65
66KDb is consisted of a general-purpose C++ Qt library and set of plugins delivering support
67for various database vendors.
68
69@section Framework
70KDbDriverManager
71KDbDriverMetaData
72KDbDriver
73
74Database access
75 - KDbConnection
76 - KDbConnectionData
77 - KDbTransaction
78 - KDbRecordEditBuffer
79 - KDbPreparedStatement
80
81Database structure
82 - Schema
83 - KDbTableSchema
84 - KDbQuerySchema
85 - KDbQuerySchemaParameter
86 - KDbQueryColumnInfo
87 - KDbTableOrQuerySchema
88 - KDbIndexSchema
89 - KDbFieldList
90 - KDbLookupFieldSchema
91 - KDbRelationship
92 - KDbParser
93 - KDbExpression
94
95Data representation
96 - KDbField
97 - KDbRecordData
98 - KDbTableViewData
99 - KDbTableViewColumn
100
101Tools
102 - KDbObject
103 - KDbEscapedString
104 - KDbMessageHandler
105 - KDbProperties
106 - KDbAdmin
107 - KDbAlter
108 - KDbValidator
109 - KDbUtils
110
111@section Drivers
112
113Drivers are loaded as plugins on demand by KDbDriverManager. The IDs, descriptions
114and other details about drivers are given in their metadata by KDbDriverManager::driverMetaData().
115The metadata is accessible without actually loading any driver.
116
117KDb supports two families of databases, file and network-based while providing a single
118uniform API.
119
120Each database driver implements of three main classes KDbDriver, KDbConnection, KDbCursor.
121The driver classes handle database-related specifics such as data types, naming and hide
122them behind a general purpose API. The connection classes act as a proxy between the KDb API
123and the native database. The cursor classes implement cursor functionality specific to
124the native database at record level.
125*/
126namespace KDb
127{
128
129/*! Object types set like table or query. */
131 UnknownObjectType = -1, //!< helper
132 AnyObjectType = 0, //!< helper
133 TableObjectType = 1,
134 QueryObjectType = 2,
135 LastObjectType = 2, //ALWAYS UPDATE THIS
136
137 KDbSystemTableObjectType = 128, //!< helper, not used in storage
138 //!< (allows to select KDb system tables
139 //!< may be or'd with TableObjectType)
140 IndexObjectType = 256 //!< special
142
143//! Escaping type for identifiers.
145 DriverEscaping, //!< Identifiers are escaped by driver
146 KDbEscaping //!< Identifiers are escaped using KDb's generic convention
148
149//! A property of numeric values
151{
152 Signed = 0, //!< Values can be both positive and negative
153 Unsigned = 1 //!< Values can be both non-negative
155
156}
157
158//! Macros for marking future Qt tr() translations.
159#ifndef futureTr
160# define futureTr QString
161# define futureTr2(a,b) QString(b)
162#endif
163
164//! Macros for marking future QT_TR_NOOP translations.
165#ifndef FUTURE_TR_NOOP
166# define FUTURE_TR_NOOP(x) (x)
167#endif
168
169#ifndef WARNING
170#ifdef _MSC_VER
171/* WARNING preprocessor directive
172 Reserved: preprocessor needs two indirections to replace __LINE__ with actual
173 string
174*/
175#define _MSG0(msg) #msg
176/* Preprocessor needs two indirections to replace __LINE__ or __FILE__
177 with actual string. */
178#define _MSG1(msg) _MSG0(msg)
179
180/*! Creates message prolog with the name of the source file and the line
181 number where a preprocessor message has been inserted.
182
183 Example:
184 #pragma KMESSAGE(Your message)
185 Output:
186 C:\MyCode.cpp(111) : Your message
187*/
188# define _MSGLINENO __FILE__ "(" _MSG1(__LINE__) ") : warning: "
189# define KDB_WARNING(msg) message(_MSGLINENO #msg)
190#endif /*_MSC_VER*/
191#endif /*WARNING*/
192
193#endif
A database connectivity and creation framework.
IdentifierEscapingType
Escaping type for identifiers.
Definition KDbGlobal.h:144
@ DriverEscaping
Identifiers are escaped by driver.
Definition KDbGlobal.h:145
@ KDbEscaping
Identifiers are escaped using KDb's generic convention.
Definition KDbGlobal.h:146
Signedness
A property of numeric values.
Definition KDbGlobal.h:151
@ Signed
Values can be both positive and negative.
Definition KDbGlobal.h:152
@ Unsigned
Values can be both non-negative.
Definition KDbGlobal.h:153
ObjectType
Definition KDbGlobal.h:130
@ UnknownObjectType
helper
Definition KDbGlobal.h:131
@ KDbSystemTableObjectType
helper, not used in storage (allows to select KDb system tables may be or'd with TableObjectType)
Definition KDbGlobal.h:137
@ IndexObjectType
special
Definition KDbGlobal.h:140
@ AnyObjectType
helper
Definition KDbGlobal.h:132
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.