diff options
| author | Emil Williams | 2025-08-17 10:17:22 +0000 |
|---|---|---|
| committer | Emil Williams | 2025-08-17 10:17:22 +0000 |
| commit | df656cbdeb67adc91560f3abd4e41c770285b3d3 (patch) | |
| tree | 4a21d7cd8dbef1df8cc7f0af0591f9fb277ebf96 | |
| parent | bb90c030df92787343d710ce96e126119270febf (diff) | |
| download | gorillanest-df656cbdeb67adc91560f3abd4e41c770285b3d3.tar.xz gorillanest-df656cbdeb67adc91560f3abd4e41c770285b3d3.tar.zst | |
Testshit And Renaming Of Db To Suffix With .Sqlite
| -rw-r--r-- | .gitignore | 2 | ||||
| -rwxr-xr-x | gorillanest | 12 |
2 files changed, 11 insertions, 3 deletions
@@ -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; |
