Skip to content

HOWTO use multiple database files

Jens Heine edited this page Mar 8, 2024 · 1 revision

If you want to store your accounts in multiple different database files, do it like this.

First start p as usual. Then create a new database with the opendatabase command:

[p.db] pshell> opendatabase mary.db
Database does not exist.
Enter password for new database    : 
Confirm password for new database  : 
Creating new p database: "mary.db" ...
Creating new UUID for database: a611e26e-418b-4a0b-b465-83209bb742ce
Creating an UNENCRYPTED database without any password!
Database Name            : 
Database UUID            : a611e26e-418b-4a0b-b465-83209bb742ce
Database Filename        : /home/peter/p/mary.db
Database Created         : 2024-03-08 22:48:50
Database Schema Version  : 8
SQLite Database Version  : 3.37.2
Database Encrypted       : No
Database Size            : 64.0 Kb
Database Last Changed    : 2024-03-08 22:48:50
Accounts (valid/invalid) : 0 (0/0)
Account history entries  : 0
Shell history entries    : 0
Aliases                  : 0
Deleted account UUID's   : 0
Last Merge Database      : 
Last Merge Date          : 
Merge history entries    : 0
Merge history details    : 0
Unmerged changes         : Yes
Note: You have unmerged changes in your local database.
[mary.db] pshell> 

Now you have 2 database files: p.db and mary.db

If you want to switch between them, just execute opendatabase without an argument:

[mary.db] pshell> opendatabase
Which database do you want to access?

1 - mary.db
2 - p.db

Enter number: 2

Enter database password:

The next time when you start the p priogram, you will be asked which database you want to open:

peter@linux:~/p$ ./p 

[p] by Jens Heine <binbash@gmx.net> version: 2024.03.08

Which database do you want to access?

1 - mary.db
2 - p.db

Enter number: 

For more information, have a look at the help:

[mary.db] pshell> help opendatabase

COMMAND
 opendatabase

SYNOPSIS
 opendatabase [<DATABASE_FILENAME>]

DESCRIPTION
 Try to open a p database file with the name DATABASE_FILENAME. If the
 database does not exist, a new one with the filename will be created. If you
 use the command without a database filename and there are multiple database
 files in the current directory, you will be asked to choose one from the
 list.
 With this command you can switch between multiple named p databases.

[mary.db] pshell>
Clone this wiki locally