diff options
-rwxr-xr-x | escato.pl | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -46,7 +46,8 @@ if ($tg_chat_id eq $tg_id || lc($text) =~ /^\@escatobot/) { } sub show_dumps { - $dbh ||= DBI->connect("DBI:SQLite:dbname=escato.db", { AutoCommit => 0, RaiseError => 1 }); + $dbh ||= DBI->connect("DBI:SQLite:dbname=escato.db", + { AutoCommit => 0, RaiseError => 1 }); my ($sec, $min, $hour) = localtime(); my $out; @@ -120,7 +121,8 @@ sub gen_graph { sub chat_members { my $tg_chat_id = shift; - $dbh ||= DBI->connect("DBI:SQLite:dbname=escato.db", { AutoCommit => 0, RaiseError => 1 }); + $dbh ||= DBI->connect("DBI:SQLite:dbname=escato.db", + { AutoCommit => 0, RaiseError => 1 }); my $sth = $dbh->prepare('SELECT U.id, U.username FROM tg_chat_users CU JOIN tg_users U ON U.id = CU.tg_id WHERE CU.tg_chat_id = ?'); $sth->execute($tg_chat_id); @@ -153,7 +155,8 @@ sub tg_id_dumps { } sub init_schema { - $dbh ||= DBI->connect("DBI:SQLite:dbname=escato.db", { AutoCommit => 0, RaiseError => 1 }); + $dbh ||= DBI->connect("DBI:SQLite:dbname=escato.db", + { AutoCommit => 0, RaiseError => 1 }); $dbh->prepare('CREATE TABLE tg_users ( id INTEGER PRIMARY KEY, username TEXT NOT NULL UNIQUE @@ -177,7 +180,8 @@ sub init_schema { } sub save_dump { - $dbh ||= DBI->connect("DBI:SQLite:dbname=escato.db", { AutoCommit => 0, RaiseError => 1 }); + $dbh ||= DBI->connect("DBI:SQLite:dbname=escato.db", + { AutoCommit => 0, RaiseError => 1 }); $dbh->prepare('INSERT OR REPLACE INTO tg_users VALUES (?, ?)') ->execute($tg_id, $tg_username); $dbh->prepare('INSERT OR IGNORE INTO tg_chats VALUES (?)') |