kexi

connectiondata.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 Jaroslaw Staniek <js@iidea.pl>
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 KEXIDB_CONNECTION_DATA_H
21#define KEXIDB_CONNECTION_DATA_H
22
23#include <kexidb/kexidb_export.h>
24
25#include <tqobject.h>
26#include <tqstring.h>
27#include <tqptrlist.h>
28
29namespace KexiDB {
30
38class ConnectionDataBase
39{
40 public:
41 ConnectionDataBase();
42
49 TQString caption;
50
54 TQString description;
55
63 int id;
64
76 TQString driverName;
77
83 TQString hostName;
84
90 unsigned short int port;
91
103
111
118 TQString password;
119
128
133 TQString userName;
134
135 protected:
142 TQString m_fileName;
143
149 TQString m_dbPath;
150
156 TQString m_dbFileName;
157};
158
160
162class KEXI_DB_EXPORT ConnectionData : public TQObject, public ConnectionDataBase
163{
164 public:
165 typedef TQPtrList<ConnectionData> List;
166 typedef TQPtrListIterator<ConnectionData> ListIterator;
167
168 ConnectionData();
169
170 ConnectionData(const ConnectionData&);
171
172 ~ConnectionData();
173
174 ConnectionData& operator=(const ConnectionData& cd);
175
183 void setFileName( const TQString& fn );
184
192 TQString fileName() const { return m_fileName; }
193
199 TQString dbPath() const { return m_dbPath; }
200
206 TQString dbFileName() const { return m_dbFileName; }
207
221 TQString serverInfoString(bool addUser = true) const;
222
228 uint formatVersion;
229
230 protected:
231 class Private;
232 Private *priv;
233
234 friend class Connection;
235};
236
237} //namespace KexiDB
238
239#endif
bool savePassword
True if password should be saved to a file for the connection.
int id
Used for identifying a single piece of data in a set.
TQString caption
The caption of the connection.
TQString localSocketFileName
Name of local (named) socket file.
TQString description
The additional description for the connection.
TQString m_fileName
The filename for file-based databases.
TQString m_dbFileName
Filename of the database file.
TQString userName
Username used for the connection.
TQString password
Password used for the connection.
TQString driverName
the name of the driver that should be used to create a connection
unsigned short int port
Port used for the remote connection.
TQString hostName
Host name used for the remote connection.
TQString m_dbPath
Absolute path to the database file.
bool useLocalSocketFile
True if local socket file should be used instead of TCP/IP port.
void setFileName(const TQString &fn)
Set the filename used by the connection.
TQString fileName() const
Get the filename used by the connection.
TQString dbFileName() const
The file name (without path) of the database file.
TQString dbPath() const
The directory the database file is in.
Provides database connection, allowing queries and data modification.
Definition connection.h:62
High-level database connectivity library with database backend drivers.