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
2db954f9
Commit
2db954f9
authored
Nov 01, 2017
by
Vinogradov Aleksei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PostgreSQLInterface: Добавил возможность прервать запрос
parent
b8c2e0ae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
PostgreSQLInterface.cc
extensions/DBServer-PostgreSQL/PostgreSQLInterface.cc
+11
-1
PostgreSQLInterface.h
extensions/DBServer-PostgreSQL/PostgreSQLInterface.h
+1
-0
DBInterface.h
include/DBInterface.h
+1
-0
No files found.
extensions/DBServer-PostgreSQL/PostgreSQLInterface.cc
View file @
2db954f9
...
...
@@ -129,6 +129,7 @@ bool PostgreSQLInterface::insert( const string& q )
try
{
work
w
(
*
(
db
.
get
())
);
lastQ
=
q
;
w
.
exec
(
q
);
w
.
commit
();
return
true
;
...
...
@@ -155,6 +156,7 @@ bool PostgreSQLInterface::insertAndSaveRowid( const string& q )
try
{
work
w
(
*
(
db
.
get
())
);
lastQ
=
q
;
pqxx
::
result
res
=
w
.
exec
(
qplus
);
w
.
commit
();
save_inserted_id
(
res
);
...
...
@@ -176,8 +178,9 @@ DBResult PostgreSQLInterface::query( const string& q )
try
{
nontransaction
n
(
*
(
db
.
get
()));
lastQ
=
q
;
/* Execute SQL query */
result
res
(
n
.
exec
(
q
)
);
return
makeResult
(
res
);
...
...
@@ -190,6 +193,13 @@ DBResult PostgreSQLInterface::query( const string& q )
return
DBResult
();
}
// -----------------------------------------------------------------------------------------
void
PostgreSQLInterface
::
cancel
()
{
if
(
!
db
)
return
;
db
->
cancel_query
();
}
// -----------------------------------------------------------------------------------------
const
string
PostgreSQLInterface
::
error
()
{
return
lastE
;
...
...
extensions/DBServer-PostgreSQL/PostgreSQLInterface.h
View file @
2db954f9
...
...
@@ -45,6 +45,7 @@ namespace uniset
virtual
bool
ping
()
const
override
;
virtual
DBResult
query
(
const
std
::
string
&
q
)
override
;
virtual
void
cancel
()
override
;
virtual
const
std
::
string
lastQuery
()
override
;
virtual
bool
insert
(
const
std
::
string
&
q
)
override
;
...
...
include/DBInterface.h
View file @
2db954f9
...
...
@@ -26,6 +26,7 @@ namespace uniset
virtual
bool
ping
()
const
=
0
;
// проверка доступности БД
virtual
DBResult
query
(
const
std
::
string
&
q
)
=
0
;
virtual
void
cancel
(){};
// попытка отменить текущий запрос
virtual
const
std
::
string
lastQuery
()
=
0
;
virtual
bool
insert
(
const
std
::
string
&
q
)
=
0
;
virtual
double
insert_id
()
=
0
;
...
...
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