Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
af549292
Commit
af549292
authored
Jan 15, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'uzum/master'
parents
dd0c90d4
97497a4c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
23 deletions
+37
-23
MySQLInterface.cc
extensions/DBServer-MySQL/MySQLInterface.cc
+9
-7
PostgreSQLInterface.cc
extensions/DBServer-PostgreSQL/PostgreSQLInterface.cc
+9
-7
SQLiteInterface.cc
extensions/DBServer-SQLite/SQLiteInterface.cc
+9
-7
DBInterface.h
include/DBInterface.h
+10
-2
No files found.
extensions/DBServer-MySQL/MySQLInterface.cc
View file @
af549292
...
@@ -40,7 +40,14 @@ MySQLInterface::MySQLInterface():
...
@@ -40,7 +40,14 @@ MySQLInterface::MySQLInterface():
MySQLInterface
::~
MySQLInterface
()
MySQLInterface
::~
MySQLInterface
()
{
{
try
{
close
();
close
();
}
catch
(
...
)
// пропускаем все необработанные исключения, если требуется обработать нужно вызывать close() до деструктора
{
cerr
<<
"MySQLInterface::~MySQLInterface(): an error occured while closing connection!"
<<
endl
;
}
delete
mysql
;
delete
mysql
;
}
}
...
@@ -201,13 +208,8 @@ void MySQLInterface::makeResult(DBResult& dbres, MYSQL_RES* myres, bool finalize
...
@@ -201,13 +208,8 @@ void MySQLInterface::makeResult(DBResult& dbres, MYSQL_RES* myres, bool finalize
mysql_free_result
(
myres
);
mysql_free_result
(
myres
);
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
extern
"C"
DBInterface
*
create_mysqlinterface
()
extern
"C"
std
::
shared_ptr
<
DBInterface
>
create_mysqlinterface
()
{
return
new
MySQLInterface
();
}
// -----------------------------------------------------------------------------------------
extern
"C"
void
destroy_mysqlinterface
(
DBInterface
*
p
)
{
{
delete
p
;
return
std
::
shared_ptr
<
DBInterface
>
(
new
MySQLInterface
(),
DBInterfaceDeleter
())
;
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
extensions/DBServer-PostgreSQL/PostgreSQLInterface.cc
View file @
af549292
...
@@ -19,7 +19,14 @@ PostgreSQLInterface::PostgreSQLInterface():
...
@@ -19,7 +19,14 @@ PostgreSQLInterface::PostgreSQLInterface():
PostgreSQLInterface
::~
PostgreSQLInterface
()
PostgreSQLInterface
::~
PostgreSQLInterface
()
{
{
try
{
close
();
close
();
}
catch
(
...
)
// пропускаем все необработанные исключения, если требуется обработать нужно вызывать close() до деструктора
{
cerr
<<
"MySQLInterface::~MySQLInterface(): an error occured while closing connection!"
<<
endl
;
}
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
...
@@ -167,13 +174,8 @@ void PostgreSQLInterface::makeResult(DBResult& dbres, const pqxx::result& res )
...
@@ -167,13 +174,8 @@ void PostgreSQLInterface::makeResult(DBResult& dbres, const pqxx::result& res )
}
}
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
extern
"C"
DBInterface
*
create_postgresqlinterface
()
extern
"C"
std
::
shared_ptr
<
DBInterface
>
create_postgresqlinterface
()
{
return
new
PostgreSQLInterface
();
}
// -----------------------------------------------------------------------------------------
extern
"C"
void
destroy_postgresqlinterface
(
DBInterface
*
p
)
{
{
delete
p
;
return
std
::
shared_ptr
<
DBInterface
>
(
new
PostgreSQLInterface
(),
DBInterfaceDeleter
())
;
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
extensions/DBServer-SQLite/SQLiteInterface.cc
View file @
af549292
...
@@ -43,7 +43,14 @@ SQLiteInterface::SQLiteInterface():
...
@@ -43,7 +43,14 @@ SQLiteInterface::SQLiteInterface():
SQLiteInterface
::~
SQLiteInterface
()
SQLiteInterface
::~
SQLiteInterface
()
{
{
try
{
close
();
close
();
}
catch
(
...
)
// пропускаем все необработанные исключения, если требуется обработать нужно вызывать close() до деструктора
{
cerr
<<
"MySQLInterface::~MySQLInterface(): an error occured while closing connection!"
<<
endl
;
}
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
...
@@ -261,13 +268,8 @@ void SQLiteInterface::makeResult(DBResult& dbres, sqlite3_stmt* s, bool finalize
...
@@ -261,13 +268,8 @@ void SQLiteInterface::makeResult(DBResult& dbres, sqlite3_stmt* s, bool finalize
sqlite3_finalize
(
s
);
sqlite3_finalize
(
s
);
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
extern
"C"
DBInterface
*
create_sqliteinterface
()
extern
"C"
std
::
shared_ptr
<
DBInterface
>
create_sqliteinterface
()
{
return
new
SQLiteInterface
();
}
// -----------------------------------------------------------------------------------------
extern
"C"
void
destroy_sqliteinterface
(
DBInterface
*
p
)
{
{
delete
p
;
return
std
::
shared_ptr
<
DBInterface
>
(
new
SQLiteInterface
(),
DBInterfaceDeleter
())
;
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
include/DBInterface.h
View file @
af549292
...
@@ -77,9 +77,17 @@ class DBResult
...
@@ -77,9 +77,17 @@ class DBResult
ROW
row_
;
ROW
row_
;
};
};
// ----------------------------------------------------------------------------------
struct
DBInterfaceDeleter
{
void
operator
()(
DBInterface
*
p
)
const
{
try
{
delete
p
;
}
catch
(...)
{}
}
};
// ----------------------------------------------------------------------------------
// the types of the class factories
// the types of the class factories
typedef
DBInterface
*
create_dbinterface_t
();
typedef
std
::
shared_ptr
<
DBInterface
>
create_dbinterface_t
();
typedef
void
destroy_dbinterface_t
(
DBInterface
*
);
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#endif // DBInterface_H_
#endif // DBInterface_H_
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment