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
242176c1
Commit
242176c1
authored
Jan 09, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(SQLite): добавил использование sqlite3_busy_timeout();
parent
49b07fcd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
SQLiteInterface.cc
extensions/DBServer-SQLite/SQLiteInterface.cc
+8
-0
SQLiteInterface.h
extensions/DBServer-SQLite/SQLiteInterface.h
+2
-2
create_db.sh
extensions/DBServer-SQLite/create_db.sh
+3
-0
No files found.
extensions/DBServer-SQLite/SQLiteInterface.cc
View file @
242176c1
...
...
@@ -74,6 +74,7 @@ bool SQLiteInterface::connect( const string dbfile, bool create )
return
false
;
}
setOperationTimeout
(
opTimeout
);
connected
=
true
;
return
true
;
}
...
...
@@ -89,6 +90,13 @@ bool SQLiteInterface::close()
return
true
;
}
// -----------------------------------------------------------------------------------------
void
SQLiteInterface
::
setOperationTimeout
(
timeout_t
msec
)
{
opTimeout
=
msec
;
if
(
db
)
sqlite3_busy_timeout
(
db
,
opTimeout
);
}
// -----------------------------------------------------------------------------------------
bool
SQLiteInterface
::
insert
(
const
string
q
)
{
if
(
!
db
)
...
...
extensions/DBServer-SQLite/SQLiteInterface.h
View file @
242176c1
...
...
@@ -33,11 +33,11 @@
// ----------------------------------------------------------------------------
class
SQLiteResult
;
// ----------------------------------------------------------------------------
// Памятка:
// Включение режима для журнала - "вести в памяти" (чтобы поберечь CompactFlash)
// PRAGMA journal_mode = MEMORY
//
// ----------------------------------------------------------------------------
class
SQLiteInterface
{
public
:
...
...
@@ -50,7 +50,7 @@ class SQLiteInterface
bool
isConnection
();
bool
ping
();
// проверка доступности БД
inline
void
setOperationTimeout
(
timeout_t
msec
){
opTimeout
=
msec
;
}
void
setOperationTimeout
(
timeout_t
msec
);
inline
timeout_t
getOperationTimeout
(){
return
opTimeout
;
}
inline
void
setOperationCheckPause
(
timeout_t
msec
){
opCheckPause
=
msec
;
}
...
...
extensions/DBServer-SQLite/create_db.sh
View file @
242176c1
...
...
@@ -5,6 +5,9 @@ dbname=test.db
[
-n
"
$1
"
]
&&
dbname
=
"
$1
"
sqlite3
$dbname
<<
"_EOF_"
PRAGMA
foreign_keys
=
ON
;
DROP TABLE IF EXISTS main_history
;
CREATE TABLE main_history
(
id
INTEGER PRIMARY KEY AUTOINCREMENT,
...
...
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