Commits

Palmer, 2E0EOL  committed e5908f6 Draft

Create the tables from my current password file

  • Participants
  • Parent commits 2189f38

Comments (0)

Files changed (1)

File pwd-importer

 # on an encrypred volume.
 #
 
+use DBI;
+use strict;
+use warnings;
+
 sub main();
+sub mktable($);
+
+sub mktable($)
+{
+	my $dbh = shift;
+	my @table_sql_set = (
+		qq#
+			CREATE TABLE IF NOT EXISTS emailaddr (
+				id INTEGER NOT NULL PRIMARY KEY,
+				email VARCHAR(64) NOT NULL default ''
+			)
+		#,
+		qq#
+			CREATE TABLE IF NOT EXISTS sites (
+				id INTEGER NOT NULL PRIMARY KEY,
+				domain VARCHAR(64) NOT NULL,
+				username CHAR(32) NULL,
+				plainpass VARCHAR(64) NULL,
+				email INTEGER NULL,
+				vm_box INT(3) NULL
+			)
+		#,
+		qq#
+			CREATE TABLE IF NOT EXISTS vm_boxes (
+				id NOT NULL PRIMARY KEY,
+				boxno CHAR(7) NOT NULL default '0000000',
+				pin CHAR(4) NOT NULL default '0000'
+			)
+		#
+	);
+	foreach my $table_sql ( @table_sql_set ) {
+		printf(STDERR "%s\n", $table_sql);
+		$dbh->do($table_sql);
+	}
+}
 
 sub main()
 {
+	my $dbfile = 'passwords.sqlite';
+	my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile","","", {});
+	mktable($dbh);
 	return 0;
 }