From df656cbdeb67adc91560f3abd4e41c770285b3d3 Mon Sep 17 00:00:00 2001 From: Emil Williams Date: Sun, 17 Aug 2025 10:17:22 +0000 Subject: [PATCH] Testshit And Renaming Of Db To Suffix With .Sqlite --- .gitignore | 2 +- gorillanest | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1ca5c6c..f947323 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -*.db +*.sqlite git/* !git/.gitkeep diff --git a/gorillanest b/gorillanest index 1d05460..f67638b 100755 --- a/gorillanest +++ b/gorillanest @@ -35,7 +35,7 @@ sub GN::cache { # cache{'/some/path'} openlog("gorillanest", "ndelay,pid", Sys::Syslog::LOG_DAEMON); try { my $gitroot = 'git'; - my $dbfile = 'gorillanest.db'; + my $dbfile = 'gorillanest.sqlite3'; # my $request = FCGI::Request(); my $template = Template->new({INCLUDE_PATH => 'template'}); @@ -44,7 +44,15 @@ try { AutoCommit => 1, sqlite_see_if_its_a_number => 1, }) or die $DBI::errstr; - $db->do("CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY, name TEXT NOT NULL CHECK(length(name) <= 32), pass TEXT NOT NULL CHECK(length(pass) <= 128 AND length(pass) >= 32))"); + $db->do( +"CREATE TABLE IF NOT EXISTS users ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL CHECK(length(name) <= 32), + pass TEXT NOT NULL CHECK(length(pass) <= 128 + AND length(pass) >= 32), + UNIQUE(name))"); + my $sth = $db->prepare("INSERT INTO users (name, pass) VALUES (?, ?)"); + $sth->execute("test", "PUM6w22pxoGVB03qlgEUVBumYgPL2RTGqegoz8vZf7jpsqRQahC3d2OXOH3qFnvo"); $db->disconnect; # my $head = 0; -- 2.39.5