1# 2# Gramps - a GTK+/GNOME based genealogy program 3# 4# Copyright (C) 2004-2007 Donald N. Allingham 5# Copyright (C) 2011 Tim G L Lyons 6# 7# This program is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 2 of the License, or 10# (at your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with this program; if not, write to the Free Software 19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20# 21 22""" 23Declare constants used by database modules 24""" 25 26#------------------------------------------------------------------------- 27# 28# constants 29# 30#------------------------------------------------------------------------- 31__all__ = ( 'DBPAGE', 'DBMODE', 'DBCACHE', 'DBLOCKS', 'DBOBJECTS', 'DBUNDO', 32 'DBEXT', 'DBMODE_R', 'DBMODE_W', 'DBUNDOFN', 'DBLOCKFN', 33 'DBRECOVFN','BDBVERSFN', 'DBLOGNAME', 'SCHVERSFN', 'PCKVERSFN', 34 'DBBACKEND', 35 'PERSON_KEY', 'FAMILY_KEY', 'SOURCE_KEY', 'CITATION_KEY', 36 'EVENT_KEY', 'MEDIA_KEY', 'PLACE_KEY', 'REPOSITORY_KEY', 37 'NOTE_KEY', 'REFERENCE_KEY', 'TAG_KEY', 38 'TXNADD', 'TXNUPD', 'TXNDEL', 39 "CLASS_TO_KEY_MAP", "KEY_TO_CLASS_MAP", "KEY_TO_NAME_MAP" 40 ) 41 42DBEXT = ".db" # File extension to be used for database files 43DBUNDOFN = "undo.db" # File name of 'undo' database 44DBLOCKFN = "lock" # File name of lock file 45DBRECOVFN = "need_recover" # File name of recovery file 46BDBVERSFN = "bdbversion.txt"# File name of Berkeley DB version file 47DBBACKEND = "database.txt" # File name of Database backend file 48SCHVERSFN = "schemaversion.txt"# File name of schema version file 49PCKVERSFN = "pickleupgrade.txt" # Indicator that pickle has been upgrade t Python3 50DBLOGNAME = ".Db" # Name of logger 51DBMODE_R = "r" # Read-only access 52DBMODE_W = "w" # Full Read/Write access 53DBPAGE = 16384 # Size of the pages used to hold items in the database 54DBMODE = 0o666 # Unix mode for database creation 55DBCACHE = 0x4000000 # Size of the shared memory buffer pool 56DBLOCKS = 100000 # Maximum number of locks supported 57DBOBJECTS = 100000 # Maximum number of simultaneously locked objects 58DBUNDO = 1000 # Maximum size of undo buffer 59ARRAYSIZE = 1000 # The arraysize for a SQL cursor 60 61PERSON_KEY = 0 62FAMILY_KEY = 1 63SOURCE_KEY = 2 64EVENT_KEY = 3 65MEDIA_KEY = 4 66PLACE_KEY = 5 67REPOSITORY_KEY = 6 68REFERENCE_KEY = 7 69NOTE_KEY = 8 70TAG_KEY = 9 71CITATION_KEY = 10 72 73TXNADD, TXNUPD, TXNDEL = 0, 1, 2 74 75CLASS_TO_KEY_MAP = {"Person": PERSON_KEY, 76 "Family": FAMILY_KEY, 77 "Source": SOURCE_KEY, 78 "Citation": CITATION_KEY, 79 "Event": EVENT_KEY, 80 "Media": MEDIA_KEY, 81 "Place": PLACE_KEY, 82 "Repository": REPOSITORY_KEY, 83 "Note" : NOTE_KEY, 84 "Tag": TAG_KEY} 85 86KEY_TO_CLASS_MAP = {PERSON_KEY: "Person", 87 FAMILY_KEY: "Family", 88 SOURCE_KEY: "Source", 89 CITATION_KEY: "Citation", 90 EVENT_KEY: "Event", 91 MEDIA_KEY: "Media", 92 PLACE_KEY: "Place", 93 REPOSITORY_KEY: "Repository", 94 NOTE_KEY: "Note", 95 TAG_KEY: "Tag"} 96 97KEY_TO_NAME_MAP = {PERSON_KEY: 'person', 98 FAMILY_KEY: 'family', 99 EVENT_KEY: 'event', 100 SOURCE_KEY: 'source', 101 CITATION_KEY: 'citation', 102 PLACE_KEY: 'place', 103 MEDIA_KEY: 'media', 104 REPOSITORY_KEY: 'repository', 105 #REFERENCE_KEY: 'reference', 106 NOTE_KEY: 'note', 107 TAG_KEY: 'tag'} 108