Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sbkpay
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhenfei.zhang
sbkpay
Commits
d0285615
Commit
d0285615
authored
Sep 15, 2017
by
李定达
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修改数据库操作
parent
d49be36a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
18 deletions
+16
-18
sbkpay/DataProcess/fmp_database.cpp
+3
-9
sbkpay/DataProcess/rollback.cpp
+10
-6
sbkpay/main.cpp
+2
-2
sbkpay/sbkpay.pro.user
+1
-1
No files found.
sbkpay/DataProcess/fmp_database.cpp
View file @
d0285615
...
...
@@ -80,10 +80,7 @@ bool FMPDataBase::insert(QString table, QVariantHash data)
QStringList
columnnamelist
;
QStringList
columnvaluelist
;
if
(
!
getSql
(
table
,
data
,
columnnamelist
,
columnvaluelist
))
{
return
false
;
}
getSql
(
table
,
data
,
columnnamelist
,
columnvaluelist
);
QSqlQuery
query
(
_db
);
...
...
@@ -110,10 +107,7 @@ bool FMPDataBase::update(QString table, QVariantHash data, QString condition)
QString
sql
;
if
(
!
getSql
(
table
,
data
,
sql
))
{
return
false
;
}
getSql
(
table
,
data
,
sql
);
QSqlQuery
query
(
_db
);
...
...
@@ -209,7 +203,7 @@ bool FMPDataBase::getSql(QString table, QVariantHash data, QStringList& columnna
if
(
columnnamelist
.
size
()
==
0
)
return
fals
e
;
return
tru
e
;
return
true
;
}
...
...
sbkpay/DataProcess/rollback.cpp
View file @
d0285615
...
...
@@ -78,8 +78,10 @@ void RollBack::RollWiteQuery(QSqlDatabase &_db, QSqlQuery &query)
if
(
FMNetWork
::
HttpPost
(
url
,
array
,
data
,
"application/json;charset=utf-8"
,
"application/json"
,
error
,
12
))
{
QString
sql
=
QString
(
"delete from orderlist where orderid='%1'"
).
arg
(
parnetid
);
QLOG_ERROR
()
<<
sql
;
query
.
exec
(
sql
);
QLOG_INFO
()
<<
sql
;
if
(
!
query
.
exec
(
sql
))
QLOG_ERROR
()
<<
query
.
lastError
()
<<
query
.
lastError
().
text
();
}
QLOG_WARN
()
<<
"rollback resulte "
<<
QThread
::
currentThreadId
()
<<
":"
<<
array
;
...
...
@@ -92,10 +94,6 @@ void RollBack::run()
QString
path
;
ToolS
::
GetPath
(
path
);
QSqlDatabase
_db
=
QSqlDatabase
::
addDatabase
(
"QSQLITE"
,
QString
(
"backup"
));
_db
.
setDatabaseName
(
path
+
DB_ORDER
);
_db
.
open
();
while
(
!
isInterruptionRequested
())
{
int
timeout
=
QSettings
(
path
+
"
\\
"
+
USERCONFIG_NAME
,
QSettings
::
IniFormat
).
value
(
VALUE_TIMEOUT
).
toInt
();
...
...
@@ -105,6 +103,10 @@ void RollBack::run()
do
{
QSqlDatabase
_db
=
QSqlDatabase
::
addDatabase
(
"QSQLITE"
,
QString
(
"backup"
));
_db
.
setDatabaseName
(
path
+
DB_ORDER
);
_db
.
open
();
QSqlQuery
query
(
_db
);
QLOG_WARN
()
<<
"find sql : "
<<
"select * from orderlist"
;
...
...
@@ -117,6 +119,8 @@ void RollBack::run()
RollWiteQuery
(
_db
,
query
);
_db
.
close
();
}
while
(
0
);
QEventLoop
loop
;
...
...
sbkpay/main.cpp
View file @
d0285615
...
...
@@ -53,8 +53,8 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/
/* 配置输出定向器 */
QsLogging
::
DestinationPtr
fileDestination
(
QsLogging
::
DestinationFactory
::
MakeFileDestination
(
str
,
QsLogging
::
EnableLogRotation
,
QsLogging
::
MaxSizeBytes
(
1024
*
1024
),
QsLogging
::
MaxOldLogCount
(
5
)));
QsLogging
::
EnableLogRotation
,
QsLogging
::
MaxSizeBytes
(
2
*
1024
*
1024
),
QsLogging
::
MaxOldLogCount
(
20
)));
logger
.
addDestination
(
fileDestination
);
QsLogging
::
DestinationPtr
consleDest
(
QsLogging
::
DestinationFactory
::
MakeDebugOutputDestination
());
...
...
sbkpay/sbkpay.pro.user
View file @
d0285615
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2017-09-1
2T19:05:05
. -->
<!-- Written by QtCreator 3.5.1, 2017-09-1
4T11:59:12
. -->
<qtcreator>
<data>
<variable>
EnvironmentId
</variable>
...
...
zhenfei.zhang
@zhenfei.zhang
mentioned in commit
08b78a0f
Jan 03, 2018
mentioned in commit
08b78a0f
mentioned in commit 08b78a0fc24d6231b84fc5441e44178d00182031
Toggle commit list
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