-
Notifications
You must be signed in to change notification settings - Fork 0
/
connection.cpp
40 lines (31 loc) · 1021 Bytes
/
connection.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
ZHSC
connection.cpp
v 0.0.1
2003/06/23
Copyright (C) 2003 Cavendish
cavendish@qiliang.net
http://www.qiliang.net/software/zhsc.html
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
#include <qsqldatabase.h>
#include "connection.h"
bool createConnections()
{
QSqlDatabase *defaultDB = QSqlDatabase::addDatabase( DB_ZHSC_DRIVER );
defaultDB->setDatabaseName( DB_ZHSC_DBNAME );
defaultDB->setUserName( DB_ZHSC_USER );
defaultDB->setPassword( DB_ZHSC_PASSWD );
defaultDB->setHostName( DB_ZHSC_HOST );
if ( ! defaultDB->open() )
{
qWarning( "Failed to open ZHSC database: " +
defaultDB->lastError().driverText() );
qWarning( defaultDB->lastError().databaseText() );
return FALSE;
}
return TRUE;
}