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
1537ead3
Commit
1537ead3
authored
Apr 10, 2020
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor fixes add added some comments
parent
f40c4b0c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
6 deletions
+15
-6
MySQLInterface.h
extensions/DBServer-MySQL/MySQLInterface.h
+1
-0
PostgreSQLInterface.cc
extensions/DBServer-PostgreSQL/PostgreSQLInterface.cc
+9
-5
PostgreSQLInterface.h
extensions/DBServer-PostgreSQL/PostgreSQLInterface.h
+2
-1
SQLiteInterface.cc
extensions/DBServer-SQLite/SQLiteInterface.cc
+3
-0
No files found.
extensions/DBServer-MySQL/MySQLInterface.h
View file @
1537ead3
...
...
@@ -33,6 +33,7 @@
namespace
uniset
{
// ----------------------------------------------------------------------------
// no thread safety
class
MySQLInterface
:
public
DBNetInterface
{
...
...
extensions/DBServer-PostgreSQL/PostgreSQLInterface.cc
View file @
1537ead3
...
...
@@ -16,7 +16,8 @@
// --------------------------------------------------------------------------
#include <sstream>
#include <cstdio>
#include <UniSetTypes.h>
#include "UniSetTypes.h"
#include "unisetstd.h"
#include "PostgreSQLInterface.h"
// --------------------------------------------------------------------------
using
namespace
std
;
...
...
@@ -52,7 +53,7 @@ bool PostgreSQLInterface::ping() const
try
{
// pqxx doesn't work with unique_ptr (
nontransaction
n
(
*
(
db
.
get
()));
n
.
exec
(
"select 1;"
);
return
true
;
...
...
@@ -89,7 +90,7 @@ bool PostgreSQLInterface::nconnect(const string& host, const string& user, const
try
{
db
=
make_shared
<
pqxx
::
connection
>
(
std
::
move
(
conninfo
.
str
())
);
db
=
unisetstd
::
make_unique
<
pqxx
::
connection
>
(
std
::
move
(
conninfo
.
str
())
);
return
db
->
is_open
();
}
catch
(
const
std
::
exception
&
e
)
...
...
@@ -122,10 +123,11 @@ bool PostgreSQLInterface::copy( const std::string& tblname, const std::vector<st
try
{
// pqxx doesn't work with unique_ptr
work
w
(
*
(
db
.
get
())
);
tablewriter
t
(
w
,
tblname
,
cols
.
begin
(),
cols
.
end
());
t
.
reserve
(
data
.
size
());
// size() не дорогая операция для list?
t
.
reserve
(
data
.
size
());
for
(
const
auto
&
d
:
data
)
t
.
push_back
(
d
.
begin
(),
d
.
end
());
...
...
@@ -153,6 +155,7 @@ bool PostgreSQLInterface::insert( const string& q )
try
{
// pqxx doesn't work with unique_ptr
work
w
(
*
(
db
.
get
())
);
lastQ
=
q
;
w
.
exec
(
q
);
...
...
@@ -180,6 +183,7 @@ bool PostgreSQLInterface::insertAndSaveRowid( const string& q )
try
{
// pqxx doesn't work with unique_ptr
work
w
(
*
(
db
.
get
())
);
lastQ
=
q
;
pqxx
::
result
res
=
w
.
exec
(
qplus
);
...
...
@@ -203,7 +207,7 @@ DBResult PostgreSQLInterface::query( const string& q )
try
{
// pqxx doesn't work with unique_ptr
nontransaction
n
(
*
(
db
.
get
()));
lastQ
=
q
;
/* Execute SQL query */
...
...
extensions/DBServer-PostgreSQL/PostgreSQLInterface.h
View file @
1537ead3
...
...
@@ -29,6 +29,7 @@
namespace
uniset
{
// ----------------------------------------------------------------------------
// No thread safety!
class
PostgreSQLInterface
:
public
DBNetInterface
{
...
...
@@ -70,7 +71,7 @@ namespace uniset
private
:
DBResult
makeResult
(
const
pqxx
::
result
&
res
);
std
::
shared
_ptr
<
pqxx
::
connection
>
db
;
std
::
unique
_ptr
<
pqxx
::
connection
>
db
;
std
::
string
lastQ
;
std
::
string
lastE
;
double
last_inserted_id
;
...
...
extensions/DBServer-SQLite/SQLiteInterface.cc
View file @
1537ead3
...
...
@@ -82,6 +82,9 @@ bool SQLiteInterface::connect( const string& dbfile, bool create, int extra_sqli
// if( !create && !uniset::file_exist(dbfile) )
// return false;
if
(
db
&&
ping
()
)
return
true
;
int
flags
=
create
?
0
:
SQLITE_OPEN_READWRITE
;
if
(
extra_sqlite_flags
)
...
...
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