Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Peter Shkenev
gajim
Commits
5989b495
Commit
5989b495
authored
19 years ago
by
nkour
Browse files
Options
Downloads
Patches
Plain Diff
do not fail in windoz part 2
parent
d8b732ad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/migrate_logs_to_dot9_db.py
+11
-8
11 additions, 8 deletions
scripts/migrate_logs_to_dot9_db.py
with
11 additions
and
8 deletions
scripts/migrate_logs_to_dot9_db.py
+
11
−
8
View file @
5989b495
...
...
@@ -4,12 +4,15 @@
from
pysqlite2
import
dbapi2
as
sqlite
PATH_TO_LOGS_BASE_DIR
=
os
.
path
.
expanduser
(
'
~/.gajim/logs
'
)
if
os
.
name
==
'
nt
'
:
PATH_TO_LOGS_BASE_DIR
=
os
.
environ
[
'
appdata
'
]
+
'
/Gajim/Logs
'
PATH_TO_DB
=
os
.
path
.
expanduser
(
'
~/.gajim/logs.db
'
)
# database is called logs.db
else
:
PATH_TO_LOGS_BASE_DIR
=
os
.
path
.
expanduser
(
'
~/.gajim/logs
'
)
PATH_TO_DB
=
os
.
path
.
expanduser
(
'
~/.gajim/logs.db
'
)
# database is called logs.db
# jid we already put in DB
jid_in
=
[]
path_to_db
=
os
.
path
.
expanduser
(
'
~/.gajim/logs.db
'
)
# database is called logs.db
con
=
sqlite
.
connect
(
path_to_db
)
jids_already_in
=
[]
# jid we already put in DB
con
=
sqlite
.
connect
(
PATH_TO_DB
)
cur
=
con
.
cursor
()
# create the tables
# type can be 'gc', 'gcstatus', 'recv', 'sent', 'status'
...
...
@@ -83,10 +86,10 @@ def visit(arg, dirname, filenames):
jid
=
get_jid
(
dirname
,
filename
)
print
'
Processing
'
,
jid
# jid is already in the DB, don't create the table, just get his jid_id
if
jid
in
jid_in
:
if
jid
in
jid
s_already
_in
:
cur
.
execute
(
'
SELECT jid_id FROM jids WHERE jid=
"
%s
"'
%
jid
)
else
:
jid_in
.
append
(
jid
)
jid
s_already
_in
.
append
(
jid
)
cur
.
execute
(
'
INSERT INTO jids (jid) VALUES (?)
'
,
(
jid
,))
con
.
commit
()
...
...
@@ -146,7 +149,7 @@ def visit(arg, dirname, filenames):
# after huge import create the indices (they are slow on massive insert)
cur
.
executescript
(
'''
CREATE UNIQUE INDEX
JID_I
ndex ON jids (jid);
CREATE UNIQUE INDEX
jids_already_i
ndex ON jids (jid);
CREATE INDEX JID_ID_Index ON logs (jid_id);
'''
)
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