Check RootsMagic Database Integrity on Opening #pragma #database #integrity #batch

Here are some tricks using a shortcut and a Windows command file (.bat file for old DOS programmers) in conjunction with the command line version of SQLite3. The shortcut, which you can place in your Start menu, on your desktop or wherever it is convenient, calls the batch file and passes the path and name of the RootsMagic database file you want to work on. The batch file calls SQLite3 to open the database file and run the quick integrity check on it. The results are displayed in the command window, SQLite exits and closes the file, and the batch program awaits a keypress so that the user can view the results. On keypress, the batch program calls RootsMagic to start and open the database file.
CheckIntegrityOnOpening.png

The batch or cmd file can be placed anywhere that you think is appropriate as you will point the shortcut to it. You will need to edit the batch file to change the path to sqlite3.exe to wherever you install it.

Download the command line version of sqlite3 from here – look for the ZIP file below the heading Precompiled Binaries For Windows, about 2/3 of the way down the page, beside the line A command-line program for accessing and modifying SQLite databases. As of writing, the version is 3.6.23. Extract the file sqlite3.exe to the folder of your choice and copy its path to replace that in the batch file Any family tree.bat listed under its download link below (.bak extension added due some systems’ security).
Any-family-tree.bat

Any-family-tree.bat.bak

ECHO OFF
REM Any family tree.bat
REM by Tom Holden 2010-05-28
REM Calls sqlite3 to open the RootsMagc database file path and name passed as a parameter
REM  and do the quick integrity check on it.
REM  Waits for user to view result until a key is pressed.
REM  Then launches RootsMagic to open the database.
REM
ECHO ************************************************
ECHO CHECKING INTEGRITY of RootsMagic SQLite database
ECHO %1
ECHO ----------------
"D:Program FilesSQLitesqlite-3_6_22sqlite3.exe" %1 "PRAGMA quick_check;"
ECHO ************************************************
ECHO When ready to open this file in RootsMagic,
PAUSE
"C:Program FilesRootsMagic 4RootsMagic.exe" %1

The shortcut, in this example named Some family tree as seen on the title of the cmd window , has the following properties:

  • Target = “D:MyDocsFamilyTreeHolden-Cudworth_Wilson-WasonAny family tree.bat” “D:MyDocsFamilyTreeRM4EmilEmptyDatabase.rmgc”
  • Start in = leave empty
  • Shortcut key = None (or change it to what you want)
  • Run = Normal window

You will have to set the Target to point to the full paths to “Any family tree.bat” and to your database file. The use of quotation marks is essential if there is a space character in the pathname.

To create a shortcut to the batch file, right-click on it in Windows Explorer and select the corresponding menu item. Then right-click on the shortcut file just created to edit its properties. Then drag and drop it to wherever you want. You can make shortcuts for multiple databases, one per database, the only difference being the pathname for each database file and a unique name for each shortcut if they are altogether in one folder.

In my case, I have named a shortcut to my main database My family tree and placed it in the Windows Start Menu:
CheckIntegrityOnOpeningShortcutStartMenu.png

One of the neat byproducts of starting RootsMagic this way is that one can use relative paths in its Tools > Program Options > Folders settings:
FolderOptionsRelativePaths.png
Provided the folders exist as sub-folders of the one containing the opened database, RM4 will use them. If they do not exist it will default to My Documents folder. Of course, you may want to have some of these folders the same, regardless of where the database file is located; you would enter the conventional, full, absolute path for each of those.

Check RootsMagic Database Integrity Why? How? (if you didn’t get here from there, it’s worth a reading)

Discussions & comments from Wikispaces site


Geraniums

RM 5 questions

Geraniums
10 March 2012 18:40:46

How do I use this query with RootsMagic 5?

If I already have SQLite installed, do I have to get the sqlite-shell-win32-x86-3071000.zip from
http://sqlite.org/download.html ?

Is the following another way to check the database in RM5?

You wrote, “Running a full GEDCOM export of everyone in the database is a more relevant test for corruption. If it does not complete, the database is certainly corrupted.”

That was at this forum discussion: http://forums.rootsmagic.com/index.php?showtopic=8541

Wow, that was 2 years ago and still there’s no RM database integrity check built into the program!


Geraniums

Geraniums
10 March 2012 18:51:14

I just remembered that doing the gedcom test would require that you first go to Lists > Fact Types and change every fact type to “Yes” in the GEDCOM section. That’s a lot of work! But I guess it’s less work than trying to fix a broken database.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.