About 80% done with SQL dump
svn: r11399
This commit is contained in:
parent
34501fa964
commit
36411622b1
@ -48,10 +48,15 @@ def makeDB(db):
|
|||||||
db.query("""drop table media;""")
|
db.query("""drop table media;""")
|
||||||
db.query("""drop table names;""")
|
db.query("""drop table names;""")
|
||||||
db.query("""drop table link;""")
|
db.query("""drop table link;""")
|
||||||
|
db.query("""drop table markup;""")
|
||||||
|
db.query("""drop table event_ref;""")
|
||||||
|
db.query("""drop table source_ref;""")
|
||||||
|
db.query("""drop table lds;""")
|
||||||
|
db.query("""drop table media_ref;""")
|
||||||
|
|
||||||
db.query("""CREATE TABLE notes (
|
db.query("""CREATE TABLE notes (
|
||||||
handle TEXT,
|
handle CHARACTER(25),
|
||||||
gid TEXT,
|
gid CHARACTER(25),
|
||||||
text TEXT,
|
text TEXT,
|
||||||
format TEXT,
|
format TEXT,
|
||||||
note_type1 INTEGER,
|
note_type1 INTEGER,
|
||||||
@ -77,24 +82,25 @@ def makeDB(db):
|
|||||||
call TEXT);""")
|
call TEXT);""")
|
||||||
|
|
||||||
db.query("""CREATE TABLE dates (
|
db.query("""CREATE TABLE dates (
|
||||||
calendar TEXT,
|
type CHARACTER(10),
|
||||||
modifier TEXT,
|
calendar INTEGER,
|
||||||
quality TEXT,
|
modifier INTEGER,
|
||||||
|
quality INTEGER,
|
||||||
day1 INTEGER,
|
day1 INTEGER,
|
||||||
month1 INTEGER,
|
month1 INTEGER,
|
||||||
year1 INTEGER,
|
year1 INTEGER,
|
||||||
flag1 BOOLEAN,
|
slash1 BOOLEAN,
|
||||||
day2 INTEGER,
|
day2 INTEGER,
|
||||||
month2 INTEGER,
|
month2 INTEGER,
|
||||||
year2 INTEGER,
|
year2 INTEGER,
|
||||||
flag2 BOOLEAN,
|
slash2 BOOLEAN,
|
||||||
text TEXT,
|
text TEXT,
|
||||||
sortval LONG,
|
sortval INTEGER,
|
||||||
newyear INTEGER);""")
|
newyear INTEGER);""")
|
||||||
|
|
||||||
db.query("""CREATE TABLE people (
|
db.query("""CREATE TABLE people (
|
||||||
handle TEXT,
|
handle CHARACTER(25),
|
||||||
gramps_id TEXT,
|
gid CHARACTER(25),
|
||||||
gender CHAR(1),
|
gender CHAR(1),
|
||||||
death_ref_index TEXT,
|
death_ref_index TEXT,
|
||||||
birth_ref_index TEXT,
|
birth_ref_index TEXT,
|
||||||
@ -104,10 +110,10 @@ def makeDB(db):
|
|||||||
private BOOLEAN);""")
|
private BOOLEAN);""")
|
||||||
|
|
||||||
db.query("""CREATE TABLE family (
|
db.query("""CREATE TABLE family (
|
||||||
handle TEXT,
|
handle CHARACTER(25),
|
||||||
gramps_id TEXT,
|
gid CHARACTER(25),
|
||||||
father_handle TEXT,
|
father_handle CHARACTER(25),
|
||||||
mother_handle TEXT,
|
mother_handle CHARACTER(25),
|
||||||
the_type0 TEXT,
|
the_type0 TEXT,
|
||||||
the_type1 TEXT,
|
the_type1 TEXT,
|
||||||
change TEXT,
|
change TEXT,
|
||||||
@ -116,8 +122,8 @@ def makeDB(db):
|
|||||||
private BOOLEAN);""")
|
private BOOLEAN);""")
|
||||||
|
|
||||||
db.query("""CREATE TABLE places (
|
db.query("""CREATE TABLE places (
|
||||||
handle TEXT,
|
handle CHARACTER(25),
|
||||||
gramps_id TEXT,
|
gid CHARACTER(25),
|
||||||
title TEXT,
|
title TEXT,
|
||||||
long FLOAT,
|
long FLOAT,
|
||||||
lat FLOAT,
|
lat FLOAT,
|
||||||
@ -127,8 +133,8 @@ def makeDB(db):
|
|||||||
private BOOLEAN);""")
|
private BOOLEAN);""")
|
||||||
|
|
||||||
db.query("""CREATE TABLE events (
|
db.query("""CREATE TABLE events (
|
||||||
handle TEXT,
|
handle CHARACTER(25),
|
||||||
gramps_id TEXT,
|
gid CHARACTER(25),
|
||||||
the_type0 TEXT,
|
the_type0 TEXT,
|
||||||
the_type1 TEXT,
|
the_type1 TEXT,
|
||||||
description TEXT,
|
description TEXT,
|
||||||
@ -138,8 +144,8 @@ def makeDB(db):
|
|||||||
private BOOLEAN);""")
|
private BOOLEAN);""")
|
||||||
|
|
||||||
db.query("""CREATE TABLE sources (
|
db.query("""CREATE TABLE sources (
|
||||||
handle TEXT,
|
handle CHARACTER(25),
|
||||||
gramps_id TEXT,
|
gid CHARACTER(25),
|
||||||
title TEXT,
|
title TEXT,
|
||||||
author TEXT,
|
author TEXT,
|
||||||
pubinfo TEXT,
|
pubinfo TEXT,
|
||||||
@ -150,8 +156,8 @@ def makeDB(db):
|
|||||||
private BOOLEAN);""")
|
private BOOLEAN);""")
|
||||||
|
|
||||||
db.query("""CREATE TABLE media (
|
db.query("""CREATE TABLE media (
|
||||||
handle TEXT,
|
handle CHARACTER(25),
|
||||||
gramps_id TEXT,
|
gid CHARACTER(25),
|
||||||
path TEXT,
|
path TEXT,
|
||||||
mime TEXT,
|
mime TEXT,
|
||||||
desc TEXT,
|
desc TEXT,
|
||||||
@ -161,8 +167,8 @@ def makeDB(db):
|
|||||||
private BOOLEAN);""")
|
private BOOLEAN);""")
|
||||||
|
|
||||||
db.query("""CREATE TABLE repository (
|
db.query("""CREATE TABLE repository (
|
||||||
handle TEXT,
|
handle CHARACTER(25),
|
||||||
gramps_id TEXT,
|
gid CHARACTER(25),
|
||||||
the_type0 TEXT,
|
the_type0 TEXT,
|
||||||
the_type1 TEXT,
|
the_type1 TEXT,
|
||||||
name TEXT,
|
name TEXT,
|
||||||
@ -172,11 +178,47 @@ def makeDB(db):
|
|||||||
private BOOLEAN);""")
|
private BOOLEAN);""")
|
||||||
|
|
||||||
db.query("""CREATE TABLE link (
|
db.query("""CREATE TABLE link (
|
||||||
from_type TEXT,
|
from_type CHARACTER(10),
|
||||||
from_handle TEXT,
|
from_handle CHARACTER(25),
|
||||||
to_type TEXT,
|
to_type CHARACTER(10),
|
||||||
to_handle TEXT);""")
|
to_handle CHARACTER(25));""")
|
||||||
|
|
||||||
|
db.query("""CREATE TABLE markup (
|
||||||
|
handle CHARACTER(25),
|
||||||
|
markup0 INTEGER,
|
||||||
|
markup1 TEXT,
|
||||||
|
value TEXT,
|
||||||
|
start_stop_list TEXT);""")
|
||||||
|
|
||||||
|
db.query("""CREATE TABLE event_ref (
|
||||||
|
handle CHARACTER(25),
|
||||||
|
ref CHARACTER(25),
|
||||||
|
role0 INTEGER,
|
||||||
|
role1 TEXT,
|
||||||
|
private BOOLEAN);""")
|
||||||
|
|
||||||
|
db.query("""CREATE TABLE source_ref (
|
||||||
|
handle CHARACTER(25),
|
||||||
|
ref CHARACTER(25),
|
||||||
|
confidence INTEGER,
|
||||||
|
page CHARACTER(25),
|
||||||
|
private BOOLEAN);""")
|
||||||
|
|
||||||
|
db.query("""CREATE TABLE lds (
|
||||||
|
handle CHARACTER(25),
|
||||||
|
type CHARACTER(10),
|
||||||
|
place TEXT,
|
||||||
|
famc CHARACTER(25),
|
||||||
|
temple TEXT,
|
||||||
|
status TEXT,
|
||||||
|
private BOOLEAN);""")
|
||||||
|
|
||||||
|
db.query("""CREATE TABLE media_ref (
|
||||||
|
handle CHARACTER(25),
|
||||||
|
ref CHARACTER(25),
|
||||||
|
role0 INTEGER,
|
||||||
|
role1 TEXT,
|
||||||
|
private BOOLEAN);""")
|
||||||
|
|
||||||
class Database:
|
class Database:
|
||||||
"""
|
"""
|
||||||
@ -209,11 +251,63 @@ class Database:
|
|||||||
self.cursor.close()
|
self.cursor.close()
|
||||||
self.db.close()
|
self.db.close()
|
||||||
|
|
||||||
def export_source(db, handle, gramps_id, title, author, pubinfo, abbrev, change,
|
def export_event_ref(db, handle, ref, role, private):
|
||||||
|
db.query("""insert INTO event_ref (
|
||||||
|
handle,
|
||||||
|
ref,
|
||||||
|
role0,
|
||||||
|
role1,
|
||||||
|
private) VALUES (?,?,?,?,?);""",
|
||||||
|
handle,
|
||||||
|
ref,
|
||||||
|
role[0],
|
||||||
|
role[1],
|
||||||
|
private)
|
||||||
|
|
||||||
|
def export_markup(db, handle, markup_code0, markup_code1, value,
|
||||||
|
start_stop_list):
|
||||||
|
db.query("""INSERT INTO markup (
|
||||||
|
handle,
|
||||||
|
markup0,
|
||||||
|
markup1,
|
||||||
|
value,
|
||||||
|
start_stop_list) VALUES (?,?,?,?,?);""",
|
||||||
|
handle, markup_code0, markup_code1, value,
|
||||||
|
start_stop_list)
|
||||||
|
|
||||||
|
def export_lds(db, handle, type, place, famc, temple, status, private):
|
||||||
|
db.query("""INSERT into lds (handle, type, place, famc, temple, status, private)
|
||||||
|
VALUES (?,?,?,?,?,?,?);""",
|
||||||
|
handle, type, place, famc, temple, status, private)
|
||||||
|
|
||||||
|
def export_media_ref(db, handle, ref, role, private):
|
||||||
|
db.query("""INSERT into media_ref (
|
||||||
|
handle,
|
||||||
|
ref,
|
||||||
|
role0,
|
||||||
|
role1,
|
||||||
|
private) VALUES (?,?,?,?,?);""",
|
||||||
|
handle, ref, role[0], role[1], private)
|
||||||
|
|
||||||
|
def export_source_ref(db, handle, ref, private, confidence, page):
|
||||||
|
db.query("""INSERT into source_ref (
|
||||||
|
handle,
|
||||||
|
ref,
|
||||||
|
confidence,
|
||||||
|
page,
|
||||||
|
private
|
||||||
|
) VALUES (?,?,?,?,?);""",
|
||||||
|
handle,
|
||||||
|
ref,
|
||||||
|
confidence,
|
||||||
|
page,
|
||||||
|
private)
|
||||||
|
|
||||||
|
def export_source(db, handle, gid, title, author, pubinfo, abbrev, change,
|
||||||
marker0, marker1, private):
|
marker0, marker1, private):
|
||||||
db.query("""INSERT into sources (
|
db.query("""INSERT into sources (
|
||||||
handle,
|
handle,
|
||||||
gramps_id,
|
gid,
|
||||||
title,
|
title,
|
||||||
author,
|
author,
|
||||||
pubinfo,
|
pubinfo,
|
||||||
@ -224,7 +318,7 @@ def export_source(db, handle, gramps_id, title, author, pubinfo, abbrev, change,
|
|||||||
private
|
private
|
||||||
) VALUES (?,?,?,?,?,?,?,?,?,?);""",
|
) VALUES (?,?,?,?,?,?,?,?,?,?);""",
|
||||||
handle,
|
handle,
|
||||||
gramps_id,
|
gid,
|
||||||
title,
|
title,
|
||||||
author,
|
author,
|
||||||
pubinfo,
|
pubinfo,
|
||||||
@ -234,7 +328,7 @@ def export_source(db, handle, gramps_id, title, author, pubinfo, abbrev, change,
|
|||||||
marker1,
|
marker1,
|
||||||
private)
|
private)
|
||||||
|
|
||||||
def export_note(db, handle, gramps_id, text, format, note_type0,
|
def export_note(db, handle, gid, text, format, note_type0,
|
||||||
note_type1, change, marker0, marker1, private):
|
note_type1, change, marker0, marker1, private):
|
||||||
db.query("""INSERT into notes (handle,
|
db.query("""INSERT into notes (handle,
|
||||||
gid,
|
gid,
|
||||||
@ -247,7 +341,7 @@ def export_note(db, handle, gramps_id, text, format, note_type0,
|
|||||||
marker1,
|
marker1,
|
||||||
private) values (?, ?, ?, ?, ?,
|
private) values (?, ?, ?, ?, ?,
|
||||||
?, ?, ?, ?, ?);""",
|
?, ?, ?, ?, ?);""",
|
||||||
handle, gramps_id, text, format, note_type0,
|
handle, gid, text, format, note_type0,
|
||||||
note_type1, change, marker0, marker1, private)
|
note_type1, change, marker0, marker1, private)
|
||||||
|
|
||||||
def export_name(db, handle, data):
|
def export_name(db, handle, data):
|
||||||
@ -276,51 +370,76 @@ def export_name(db, handle, data):
|
|||||||
private, first_name, surname, suffix, title,
|
private, first_name, surname, suffix, title,
|
||||||
name_type[0], name_type[1], prefix, patronymic, group_as,
|
name_type[0], name_type[1], prefix, patronymic, group_as,
|
||||||
sort_as, display_as, call)
|
sort_as, display_as, call)
|
||||||
export_date(db, handle, date)
|
|
||||||
for source_handle in source_list:
|
|
||||||
# (None, False, ['afce5e5edf9578a8382'], 2, 'afce5e5edf4471ab79d', '')
|
|
||||||
#db.query("""insert into link (from_type, from_handle, to_type, to_handle) values (?, ?, ?, ?)""",
|
|
||||||
# "names", handle, "sources", source_handle)
|
|
||||||
print "names", "to", "sources", source_handle
|
|
||||||
for note_handle in note_list:
|
|
||||||
db.query("""insert into link (from_type, from_handle, to_type, to_handle) values (?, ?, ?, ?)""",
|
|
||||||
"names", handle, "notes", note_handle)
|
|
||||||
|
|
||||||
def export_date(db, handle, data):
|
export_date(db, "name", handle, date)
|
||||||
|
export_list(db, "names", handle, "notes", note_list)
|
||||||
|
# Event Sources
|
||||||
|
for source in source_list:
|
||||||
|
(date, private, note_list, confidence, ref, page) = source
|
||||||
|
export_source_ref(db, handle, ref, private, confidence, page)
|
||||||
|
export_date(db, "source_ref", ref, date)
|
||||||
|
export_list(db, "source_ref", ref, "note", note_list)
|
||||||
|
|
||||||
|
def export_date(db, date_type, handle, data):
|
||||||
if data:
|
if data:
|
||||||
(calendar, modifier, quality, dateval, text, sortval, newyear) = data
|
(calendar, modifier, quality, dateval, text, sortval, newyear) = data
|
||||||
if len(dateval) == 4:
|
if len(dateval) == 4:
|
||||||
day1, month1, year1, flag1 = dateval
|
day1, month1, year1, slash1 = dateval
|
||||||
day2, month2, year2, flag2 = 0, 0, 0, 0
|
day2, month2, year2, slash2 = 0, 0, 0, 0
|
||||||
elif len(dateval) == 8:
|
elif len(dateval) == 8:
|
||||||
day1, month1, year1, flag1, day2, month2, year2, flag2 = dateval
|
day1, month1, year1, slash1, day2, month2, year2, slash2 = dateval
|
||||||
else:
|
else:
|
||||||
raise ("ERROR:", dateval)
|
raise ("ERROR:", dateval)
|
||||||
db.query("""INSERT INTO dates (
|
db.query("""INSERT INTO dates (
|
||||||
|
type,
|
||||||
calendar,
|
calendar,
|
||||||
modifier,
|
modifier,
|
||||||
quality,
|
quality,
|
||||||
day1,
|
day1,
|
||||||
month1,
|
month1,
|
||||||
year1,
|
year1,
|
||||||
flag1,
|
slash1,
|
||||||
day2,
|
day2,
|
||||||
month2,
|
month2,
|
||||||
year2,
|
year2,
|
||||||
flag2,
|
slash2,
|
||||||
text,
|
text,
|
||||||
sortval,
|
sortval,
|
||||||
newyear) VALUES (?, ?, ?, ?, ?, ?, ?,
|
newyear) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
|
||||||
?, ?, ?, ?, ?, ?, ?);""",
|
?, ?, ?, ?, ?, ?, ?);""",
|
||||||
calendar, modifier, quality,
|
date_type, calendar, modifier, quality,
|
||||||
day1, month1, year1, flag1,
|
day1, month1, year1, slash1,
|
||||||
day2, month2, year2, flag2,
|
day2, month2, year2, slash2,
|
||||||
text, sortval, newyear)
|
text, sortval, newyear)
|
||||||
|
|
||||||
|
def export_attribute_list(db, from_type, from_handle, attribute_list):
|
||||||
|
for attribute in attribute_list:
|
||||||
|
(private, source_list, note_list, the_type, value) = attribute
|
||||||
|
# (False, [], [], (6, u''), u'30x-xx-708x')
|
||||||
|
print "attribute:", the_type, value, private
|
||||||
|
export_list(db, "attribute", from_handle, "note", note_list)
|
||||||
|
# Event Sources
|
||||||
|
for source in source_list:
|
||||||
|
(date, private, note_list, confidence, ref, page) = source
|
||||||
|
export_source_ref(db, from_handle, ref, private, confidence, page)
|
||||||
|
export_date(db, "source_ref", ref, date)
|
||||||
|
export_list(db, "source_ref", ref, "note", note_list)
|
||||||
|
|
||||||
|
|
||||||
def export_list(db, from_type, from_handle, to_type, handle_list):
|
def export_list(db, from_type, from_handle, to_type, handle_list):
|
||||||
for handle in handle_list:
|
for to_handle in handle_list:
|
||||||
print from_type, "to", to_type, ":", handle
|
if type(to_handle) == type(""):
|
||||||
|
export_link(db, from_type, from_handle, to_type, to_handle)
|
||||||
|
else:
|
||||||
|
print from_type, from_handle, "->", to_type, to_handle
|
||||||
|
|
||||||
|
def export_link(db, from_type, from_handle, to_type, to_handle):
|
||||||
|
db.query("""insert into link (
|
||||||
|
from_type,
|
||||||
|
from_handle,
|
||||||
|
to_type,
|
||||||
|
to_handle) values (?, ?, ?, ?)""",
|
||||||
|
from_type, from_handle, to_type, to_handle)
|
||||||
|
|
||||||
def exportData(database, filename, option_box=None, callback=None):
|
def exportData(database, filename, option_box=None, callback=None):
|
||||||
if not callable(callback):
|
if not callable(callback):
|
||||||
@ -344,13 +463,15 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
for note_handle in database.note_map.keys():
|
for note_handle in database.note_map.keys():
|
||||||
note = database.note_map[note_handle]
|
note = database.note_map[note_handle]
|
||||||
(handle, gramps_id, styled_text, format, note_type,
|
(handle, gid, styled_text, format, note_type,
|
||||||
change, marker, private) = note
|
change, marker, private) = note
|
||||||
text, text_list = styled_text
|
text, markup_list = styled_text
|
||||||
export_note(db, handle, gramps_id, text, format, note_type[0],
|
export_note(db, handle, gid, text, format, note_type[0],
|
||||||
note_type[1], change, marker[0], marker[1], private)
|
note_type[1], change, marker[0], marker[1], private)
|
||||||
for text_handle in text_list:
|
for markup in markup_list:
|
||||||
print "text handle:", text_handle
|
markup_code, value, start_stop_list = markup
|
||||||
|
export_markup(db, handle, markup_code[0], markup_code[1], value,
|
||||||
|
str(start_stop_list))
|
||||||
count += 1
|
count += 1
|
||||||
callback(100 * count/total)
|
callback(100 * count/total)
|
||||||
|
|
||||||
@ -359,14 +480,14 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
for event_handle in database.event_map.keys():
|
for event_handle in database.event_map.keys():
|
||||||
event = database.event_map[event_handle]
|
event = database.event_map[event_handle]
|
||||||
(handle, gramps_id, the_type, date, description, place,
|
(handle, gid, the_type, date, description, place,
|
||||||
source_list, note_list, media_list, attribute_list,
|
source_list, note_list, media_list, attribute_list,
|
||||||
change, marker, private) = event
|
change, marker, private) = event
|
||||||
export_date(db, event_handle, date)
|
export_date(db, "event", event_handle, date)
|
||||||
|
|
||||||
db.query("""INSERT INTO events (
|
db.query("""INSERT INTO events (
|
||||||
handle,
|
handle,
|
||||||
gramps_id,
|
gid,
|
||||||
the_type0,
|
the_type0,
|
||||||
the_type1,
|
the_type1,
|
||||||
description,
|
description,
|
||||||
@ -375,7 +496,7 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
marker1,
|
marker1,
|
||||||
private) VALUES (?,?,?,?,?,?,?,?,?);""",
|
private) VALUES (?,?,?,?,?,?,?,?,?);""",
|
||||||
handle,
|
handle,
|
||||||
gramps_id,
|
gid,
|
||||||
the_type[0],
|
the_type[0],
|
||||||
the_type[1],
|
the_type[1],
|
||||||
description,
|
description,
|
||||||
@ -384,13 +505,24 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
marker[1],
|
marker[1],
|
||||||
private)
|
private)
|
||||||
|
|
||||||
# place
|
if place:
|
||||||
#export_list(db, "event", event_handle, "source", source_list)
|
export_link(db, "event", handle, "place", place)
|
||||||
# (None, False, [handles], 2, 'afce5e5932061715801', '')
|
export_list(db, "event", handle, "note", note_list)
|
||||||
export_list(db, "event", event_handle, "note", note_list) # handles
|
export_attribute_list(db, "event", handle, attribute_list)
|
||||||
export_list(db, "event", event_handle, "media", media_list)
|
|
||||||
export_list(db, "event", event_handle, "attribute", attribute_list)
|
# Event Media list
|
||||||
export_list(db, "event", event_handle, "text", text_list)
|
for media in media_list:
|
||||||
|
(private, source_list, note_list,attribute_list,ref,rect) = media
|
||||||
|
export_media_ref(db, handle, ref, role, private)
|
||||||
|
export_list(db, "media", ref, "note", note_list)
|
||||||
|
export_attribute_list(db, "media", ref, attribute_list)
|
||||||
|
|
||||||
|
# Event Sources
|
||||||
|
for source in source_list:
|
||||||
|
(date, private, note_list, confidence, ref, page) = source
|
||||||
|
export_source_ref(db, handle, ref, private, confidence, page)
|
||||||
|
export_date(db, "source_ref", ref, date)
|
||||||
|
export_list(db, "source_ref", ref, "note", note_list)
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
callback(100 * count/total)
|
callback(100 * count/total)
|
||||||
@ -401,7 +533,7 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
for person_handle in database.person_map.keys():
|
for person_handle in database.person_map.keys():
|
||||||
person = database.person_map[person_handle]
|
person = database.person_map[person_handle]
|
||||||
(handle, # 0
|
(handle, # 0
|
||||||
gramps_id, # 1
|
gid, # 1
|
||||||
gender, # 2
|
gender, # 2
|
||||||
primary_name, # 3
|
primary_name, # 3
|
||||||
alternate_names, # 4
|
alternate_names, # 4
|
||||||
@ -425,7 +557,7 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
|
|
||||||
db.query("""INSERT INTO people (
|
db.query("""INSERT INTO people (
|
||||||
handle,
|
handle,
|
||||||
gramps_id,
|
gid,
|
||||||
gender,
|
gender,
|
||||||
death_ref_index,
|
death_ref_index,
|
||||||
birth_ref_index,
|
birth_ref_index,
|
||||||
@ -434,7 +566,7 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
marker1,
|
marker1,
|
||||||
private) values (?, ?, ?, ?, ?, ?, ?, ?, ?);""",
|
private) values (?, ?, ?, ?, ?, ?, ?, ?, ?);""",
|
||||||
handle,
|
handle,
|
||||||
gramps_id,
|
gid,
|
||||||
gender,
|
gender,
|
||||||
death_ref_index,
|
death_ref_index,
|
||||||
birth_ref_index,
|
birth_ref_index,
|
||||||
@ -443,55 +575,71 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
marker[1],
|
marker[1],
|
||||||
private)
|
private)
|
||||||
|
|
||||||
# TODO:
|
export_list(db, "people", handle, "note", pnote_list)
|
||||||
export_list(db, "people", handle, "event_ref", event_ref_list)
|
export_attribute_list(db, "people", handle, attribute_list)
|
||||||
# (False, [], [], 'afce5e5f70c71376c22', (1, u''))
|
|
||||||
|
# Event Reference information
|
||||||
|
for event_ref in event_ref_list:
|
||||||
|
(private, note_list, attribute_list, ref, role) = event_ref
|
||||||
|
export_event_ref(db, handle, ref, role, private)
|
||||||
|
|
||||||
|
export_list(db, "event_ref", ref, "note", note_list)
|
||||||
|
export_attribute_list(db, "event_ref", ref, attribute_list)
|
||||||
|
|
||||||
export_list(db, "people", handle, "family", family_list) # handles
|
export_list(db, "people", handle, "family", family_list) # handles
|
||||||
export_list(db, "people", handle, "parent_family", parent_family_list) # handles
|
export_list(db, "people", handle, "parent_family", parent_family_list) # handles
|
||||||
export_list(db, "people", handle, "media", media_list)
|
|
||||||
export_list(db, "people", handle, "attribute", attribute_list)
|
|
||||||
export_list(db, "people", handle, "url", urls)
|
|
||||||
export_list(db, "people", handle, "note", pnote_list) # handles
|
export_list(db, "people", handle, "note", pnote_list) # handles
|
||||||
|
export_list(db, "people", handle, "url", urls)
|
||||||
export_list(db, "people", handle, "person_ref", person_ref_list)
|
export_list(db, "people", handle, "person_ref", person_ref_list)
|
||||||
|
|
||||||
|
for media in media_list:
|
||||||
|
(private, source_list, note_list,attribute_list,ref,rect) = media
|
||||||
|
export_media_ref(db, handle, ref, role, private)
|
||||||
|
export_list(db, "event_ref", ref, "note", note_list)
|
||||||
|
export_attribute_list(db, "event_ref", ref, attribute_list)
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Address
|
# Address
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
for address in address_list:
|
for address in address_list:
|
||||||
(private, asource_list, anote_list, date, location) = address
|
(private, asource_list, anote_list, date, location) = address
|
||||||
(street, city, county, state, country, postal, phone) = location
|
(street, city, county, state, country, postal, phone) = location
|
||||||
print "address:", private, street, city, county, state, \
|
addr_handle = "ADDRHANDLE" # FIXME
|
||||||
country, postal, phone
|
print "address:", private
|
||||||
print "location:", street, city, county, state, country, postal, phone
|
print "location:", street, city, county, state, country, postal, phone
|
||||||
export_date(db, handle, date)
|
export_date(db, "address", addr_handle, date)
|
||||||
|
export_list(db, "source_ref", addr_handle, "note", anote_list)
|
||||||
# Address Sources
|
# Address Sources
|
||||||
for source in asource_list:
|
for source in asource_list:
|
||||||
# (None, False, [], 2, 'afce5e599d414695da9', '')
|
(date, private, note_list, confidence, ref, page) = source
|
||||||
print "address", "source", source
|
export_source_ref(db, addr_handle, ref, private, confidence, page)
|
||||||
|
export_date(db, "source_ref", ref, date)
|
||||||
|
export_list(db, "source_ref", ref, "note", note_list)
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# LDS ord
|
# LDS ord
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
for ldsord in lds_ord_list:
|
for ldsord in lds_ord_list:
|
||||||
# ([(None, False, [], 2, 'afce5e6189b0e06b649', '')], [], None, 0, '', None, '', 0, False)
|
|
||||||
(lsource_list, lnote_list, date, type, place,
|
(lsource_list, lnote_list, date, type, place,
|
||||||
famc, temple, status, lprivate) = ldsord
|
famc, temple, status, lprivate) = ldsord
|
||||||
print "ldsord:", type, place, famc, temple, status, lprivate
|
lds_handle = "LDSHANDLE" # FIXME: use db-generated handle?
|
||||||
export_date(db, handle, date)
|
export_lds(db, lds_handle, type, place, famc, temple, status, lprivate)
|
||||||
export_list(db, "lds", "LDSHANDLE", "note", lnote_list)
|
export_date(db, "lds", lds_handle, date)
|
||||||
|
export_list(db, "lds", lds_handle, "note", lnote_list)
|
||||||
for source in lsource_list:
|
for source in lsource_list:
|
||||||
# (None, False, [], 2, 'afce5e599d414695da9', '')
|
(date, private, note_list, confidence, ref, page) = source
|
||||||
print "lds", "source", source
|
export_source_ref(db, lds_handle, ref, private, confidence, page)
|
||||||
|
export_date(db, "source_ref", ref, date)
|
||||||
|
export_list(db, "source_ref", ref, "note", note_list)
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Source
|
# Source
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
for source in psource_list:
|
for source in psource_list:
|
||||||
# (None, False, [], 2, 'afce5e599d414695da9', '')
|
(date, private, note_list, confidence, ref, page) = source
|
||||||
print "people", "source", source
|
export_source_ref(db, handle, ref, private, confidence, page)
|
||||||
|
export_date(db, "source_ref", ref, date)
|
||||||
|
export_list(db, "source_ref", ref, "note", note_list)
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Names
|
# Names
|
||||||
@ -506,14 +654,14 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
for family_handle in database.family_map.keys():
|
for family_handle in database.family_map.keys():
|
||||||
family = database.family_map[family_handle]
|
family = database.family_map[family_handle]
|
||||||
(handle, gramps_id, father_handle, mother_handle,
|
(handle, gid, father_handle, mother_handle,
|
||||||
child_ref_list, the_type, event_ref_list, media_list,
|
child_ref_list, the_type, event_ref_list, media_list,
|
||||||
attribute_list, lds_seal_list, source_list, note_list,
|
attribute_list, lds_seal_list, source_list, note_list,
|
||||||
change, marker, private) = family
|
change, marker, private) = family
|
||||||
# father_handle and/or mother_handle can be None
|
# father_handle and/or mother_handle can be None
|
||||||
db.query("""INSERT INTO family (
|
db.query("""INSERT INTO family (
|
||||||
handle,
|
handle,
|
||||||
gramps_id,
|
gid,
|
||||||
father_handle,
|
father_handle,
|
||||||
mother_handle,
|
mother_handle,
|
||||||
the_type0,
|
the_type0,
|
||||||
@ -522,18 +670,53 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
marker0,
|
marker0,
|
||||||
marker1,
|
marker1,
|
||||||
private) values (?,?,?,?,?,?,?,?,?,?);""",
|
private) values (?,?,?,?,?,?,?,?,?,?);""",
|
||||||
handle, gramps_id, father_handle, mother_handle,
|
handle, gid, father_handle, mother_handle,
|
||||||
the_type[0], the_type[1], change, marker[0], marker[1],
|
the_type[0], the_type[1], change, marker[0], marker[1],
|
||||||
private)
|
private)
|
||||||
#TODO: lists
|
#TODO: lists
|
||||||
|
|
||||||
|
export_list(db, "family", handle, "note", pnote_list)
|
||||||
|
export_attribute_list(db, "family", handle, attribute_list)
|
||||||
|
|
||||||
|
# Event Reference information
|
||||||
|
for event_ref in event_ref_list:
|
||||||
|
(private, note_list, attribute_list, ref, role) = event_ref
|
||||||
|
export_event_ref(db, handle, ref, role, private)
|
||||||
|
|
||||||
|
export_list(db, "event_ref", ref, "note", note_list)
|
||||||
|
export_attribute_list(db, "event_ref", ref, attribute_list)
|
||||||
|
|
||||||
|
# -------------------------------------
|
||||||
|
# LDS
|
||||||
|
# -------------------------------------
|
||||||
for ldsord in lds_seal_list:
|
for ldsord in lds_seal_list:
|
||||||
(lsource_list, lnote_list, date, type, place,
|
(lsource_list, lnote_list, date, type, place,
|
||||||
famc, temple, status, lprivate) = ldsord
|
famc, temple, status, lprivate) = ldsord
|
||||||
print "ldsord:", type, place, famc, temple, status, lprivate
|
lds_handle = "LDSHANDLE" # FIXME: use db-generated handle?
|
||||||
export_date(db, handle, date)
|
export_lds(db, lds_handle, type, place, famc, temple, status, lprivate)
|
||||||
|
export_date(db, "lds", lds_handle, date)
|
||||||
|
export_list(db, "lds", lds_handle, "note", lnote_list)
|
||||||
|
for source in lsource_list:
|
||||||
|
(date, private, note_list, confidence, ref, page) = source
|
||||||
|
export_source_ref(db, lds_handle, ref, private, confidence, page)
|
||||||
|
export_date(db, "source_ref", ref, date)
|
||||||
|
export_list(db, "source_ref", ref, "note", note_list)
|
||||||
|
|
||||||
|
# -------------------------------------
|
||||||
|
# Source
|
||||||
|
# -------------------------------------
|
||||||
|
for source in source_list:
|
||||||
|
(date, private, note_list, confidence, ref, page) = source
|
||||||
|
export_source_ref(db, handle, ref, private, confidence, page)
|
||||||
|
export_date(db, "source_ref", ref, date)
|
||||||
|
export_list(db, "source_ref", ref, "note", note_list)
|
||||||
|
|
||||||
|
for media in media_list:
|
||||||
|
(private, source_list, note_list,attribute_list,ref,rect) = media
|
||||||
|
export_media_ref(db, handle, ref, role, private)
|
||||||
|
export_list(db, "event_ref", ref, "note", note_list)
|
||||||
|
export_attribute_list(db, "event_ref", ref, attribute_list)
|
||||||
|
|
||||||
#TODO: lists
|
|
||||||
count += 1
|
count += 1
|
||||||
callback(100 * count/total)
|
callback(100 * count/total)
|
||||||
|
|
||||||
@ -543,12 +726,12 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
for repository_handle in database.repository_map.keys():
|
for repository_handle in database.repository_map.keys():
|
||||||
repository = database.repository_map[repository_handle]
|
repository = database.repository_map[repository_handle]
|
||||||
# address
|
# address
|
||||||
(handle, gramps_id, the_type, name, note_list,
|
(handle, gid, the_type, name, note_list,
|
||||||
address_list, urls, change, marker, private) = repository
|
address_list, urls, change, marker, private) = repository
|
||||||
|
|
||||||
db.query("""INSERT INTO repository (
|
db.query("""INSERT INTO repository (
|
||||||
handle,
|
handle,
|
||||||
gramps_id,
|
gid,
|
||||||
the_type0,
|
the_type0,
|
||||||
the_type1,
|
the_type1,
|
||||||
name,
|
name,
|
||||||
@ -556,15 +739,23 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
marker0,
|
marker0,
|
||||||
marker1,
|
marker1,
|
||||||
private) VALUES (?,?,?,?,?,?,?,?,?);""",
|
private) VALUES (?,?,?,?,?,?,?,?,?);""",
|
||||||
handle, gramps_id, the_type[0], the_type[1],
|
handle, gid, the_type[0], the_type[1],
|
||||||
name, change, marker[0], marker[1], private)
|
name, change, marker[0], marker[1], private)
|
||||||
#TODO: lists
|
|
||||||
|
|
||||||
for address in address_list:
|
for address in address_list:
|
||||||
(private, asource_list, anote_list, date, location) = address
|
(private, asource_list, anote_list, date, location) = address
|
||||||
print "address:", private, location
|
(street, city, county, state, country, postal, phone) = location
|
||||||
export_date(db, handle, date)
|
addr_handle = "ADDRHANDLE"
|
||||||
#TODO: lists
|
print "address:", private
|
||||||
|
print "location:", street, city, county, state, country, postal, phone
|
||||||
|
export_date(db, "address", addr_handle, date)
|
||||||
|
export_list(db, "address", addr_handle, "note", anote_list)
|
||||||
|
# Source
|
||||||
|
for source in asource_list:
|
||||||
|
(date, private, note_list, confidence, ref, page) = source
|
||||||
|
export_source_ref(db, addr_handle, ref, private, confidence, page)
|
||||||
|
export_date(db, "source_ref", ref, date)
|
||||||
|
export_list(db, "source_ref", ref, "note", note_list)
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
callback(100 * count/total)
|
callback(100 * count/total)
|
||||||
@ -574,7 +765,7 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
for place_handle in database.place_map.keys():
|
for place_handle in database.place_map.keys():
|
||||||
repository = database.place_map[place_handle]
|
repository = database.place_map[place_handle]
|
||||||
(handle, gramps_id, title, long, lat,
|
(handle, gid, title, long, lat,
|
||||||
main_loc, alt_location_list,
|
main_loc, alt_location_list,
|
||||||
urls,
|
urls,
|
||||||
medias,
|
medias,
|
||||||
@ -584,7 +775,7 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
|
|
||||||
db.query("""INSERT INTO places (
|
db.query("""INSERT INTO places (
|
||||||
handle,
|
handle,
|
||||||
gramps_id,
|
gid,
|
||||||
title,
|
title,
|
||||||
long,
|
long,
|
||||||
lat,
|
lat,
|
||||||
@ -592,7 +783,7 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
marker0,
|
marker0,
|
||||||
marker1,
|
marker1,
|
||||||
private) values (?,?,?,?,?,?,?,?,?);""",
|
private) values (?,?,?,?,?,?,?,?,?);""",
|
||||||
handle, gramps_id, title, long, lat,
|
handle, gid, title, long, lat,
|
||||||
change, marker[0], marker[1], private)
|
change, marker[0], marker[1], private)
|
||||||
|
|
||||||
# TODO: alt_location_list, urls, medias, sources, notes
|
# TODO: alt_location_list, urls, medias, sources, notes
|
||||||
@ -605,7 +796,7 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
for source_handle in database.source_map.keys():
|
for source_handle in database.source_map.keys():
|
||||||
source = database.source_map[source_handle]
|
source = database.source_map[source_handle]
|
||||||
(handle, gramps_id, title,
|
(handle, gid, title,
|
||||||
author, pubinfo,
|
author, pubinfo,
|
||||||
notes,
|
notes,
|
||||||
media_list,
|
media_list,
|
||||||
@ -613,10 +804,9 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
change, datamap,
|
change, datamap,
|
||||||
reporef_list,
|
reporef_list,
|
||||||
marker, private) = source
|
marker, private) = source
|
||||||
export_source(db, handle, gramps_id, title, author, pubinfo, abbrev, change,
|
export_source(db, handle, gid, title, author, pubinfo, abbrev, change,
|
||||||
marker[0], marker[1], private)
|
marker[0], marker[1], private)
|
||||||
for note_handle in notes:
|
export_list(db, "source", handle, "note", note_list)
|
||||||
print "NOTE:", note_handle
|
|
||||||
|
|
||||||
# TODO: notes, media_list
|
# TODO: notes, media_list
|
||||||
# reporef_list, data_map
|
# reporef_list, data_map
|
||||||
@ -629,7 +819,7 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
for media_handle in database.media_map.keys():
|
for media_handle in database.media_map.keys():
|
||||||
media = database.media_map[media_handle]
|
media = database.media_map[media_handle]
|
||||||
(handle, gramps_id, path, mime, desc,
|
(handle, gid, path, mime, desc,
|
||||||
attrib_list,
|
attrib_list,
|
||||||
source_list,
|
source_list,
|
||||||
note_list,
|
note_list,
|
||||||
@ -640,7 +830,7 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
|
|
||||||
db.query("""INSERT INTO media (
|
db.query("""INSERT INTO media (
|
||||||
handle,
|
handle,
|
||||||
gramps_id,
|
gid,
|
||||||
path,
|
path,
|
||||||
mime,
|
mime,
|
||||||
desc,
|
desc,
|
||||||
@ -648,10 +838,11 @@ def exportData(database, filename, option_box=None, callback=None):
|
|||||||
marker0,
|
marker0,
|
||||||
marker1,
|
marker1,
|
||||||
private) VALUES (?,?,?,?,?,?,?,?,?);""",
|
private) VALUES (?,?,?,?,?,?,?,?,?);""",
|
||||||
handle, gramps_id, path, mime, desc,
|
handle, gid, path, mime, desc,
|
||||||
change, marker[0], marker[1], private)
|
change, marker[0], marker[1], private)
|
||||||
|
|
||||||
export_date(db, handle, date)
|
export_date(db, "media", handle, date)
|
||||||
|
export_list(db, "media", handle, "note", note_list)
|
||||||
count += 1
|
count += 1
|
||||||
callback(100 * count/total)
|
callback(100 * count/total)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user