Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.db.replay
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.db.replay
Commits
2e5bdc4c
Commit
2e5bdc4c
authored
12 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Use new readonly/no-lock session try constructions
parent
d664cb27
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
xbob/db/replay/create.py
+4
-6
4 additions, 6 deletions
xbob/db/replay/create.py
xbob/db/replay/query.py
+1
-1
1 addition, 1 deletion
xbob/db/replay/query.py
with
5 additions
and
7 deletions
xbob/db/replay/create.py
+
4
−
6
View file @
2e5bdc4c
...
@@ -155,11 +155,9 @@ def define_protocols(session, protodir, verbose):
...
@@ -155,11 +155,9 @@ def define_protocols(session, protodir, verbose):
def
create_tables
(
args
):
def
create_tables
(
args
):
"""
Creates all necessary tables (only to be used at the first time)
"""
"""
Creates all necessary tables (only to be used at the first time)
"""
from
bob.db.utils
import
c
onnection_string
from
bob.db.utils
import
c
reate_engine_try_nolock
from
sqlalchemy
import
create_engine
engine
=
create_engine_try_nolock
(
args
.
type
,
args
.
files
[
0
],
echo
=
(
args
.
verbose
>=
2
))
engine
=
create_engine
(
connection_string
(
args
.
type
,
args
.
files
[
0
]),
echo
=
(
args
.
verbose
>=
2
))
Client
.
metadata
.
create_all
(
engine
)
Client
.
metadata
.
create_all
(
engine
)
RealAccess
.
metadata
.
create_all
(
engine
)
RealAccess
.
metadata
.
create_all
(
engine
)
Attack
.
metadata
.
create_all
(
engine
)
Attack
.
metadata
.
create_all
(
engine
)
...
@@ -171,7 +169,7 @@ def create_tables(args):
...
@@ -171,7 +169,7 @@ def create_tables(args):
def
create
(
args
):
def
create
(
args
):
"""
Creates or re-creates this database
"""
"""
Creates or re-creates this database
"""
from
bob.db.utils
import
session
from
bob.db.utils
import
session
_try_nolock
dbfile
=
args
.
files
[
0
]
dbfile
=
args
.
files
[
0
]
...
@@ -185,7 +183,7 @@ def create(args):
...
@@ -185,7 +183,7 @@ def create(args):
# the real work...
# the real work...
create_tables
(
args
)
create_tables
(
args
)
s
=
session
(
args
.
type
,
args
.
files
[
0
],
echo
=
(
args
.
verbose
>=
2
))
s
=
session
_try_nolock
(
args
.
type
,
args
.
files
[
0
],
echo
=
(
args
.
verbose
>=
2
))
add_clients
(
s
,
args
.
protodir
,
args
.
verbose
)
add_clients
(
s
,
args
.
protodir
,
args
.
verbose
)
add_real_lists
(
s
,
args
.
protodir
,
args
.
verbose
)
add_real_lists
(
s
,
args
.
protodir
,
args
.
verbose
)
add_attack_lists
(
s
,
args
.
protodir
,
args
.
verbose
)
add_attack_lists
(
s
,
args
.
protodir
,
args
.
verbose
)
...
...
This diff is collapsed.
Click to expand it.
xbob/db/replay/query.py
+
1
−
1
View file @
2e5bdc4c
...
@@ -34,7 +34,7 @@ class Database(object):
...
@@ -34,7 +34,7 @@ class Database(object):
self
.
session
=
None
self
.
session
=
None
else
:
else
:
self
.
session
=
utils
.
session
(
INFO
.
type
(),
INFO
.
files
()[
0
]
)
self
.
session
=
utils
.
session
_try_readonly
(
INFO
.
type
(),
SQLITE_FILE
)
def
is_valid
(
self
):
def
is_valid
(
self
):
"""
Returns if a valid session has been opened for reading the database
"""
"""
Returns if a valid session has been opened for reading the database
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment