energie_obsah.contents now permitted NULL to show just the title image
[www.energie.vellum.cz.git] / obsah_init.pl
index d2ded01..1f7be33 100755 (executable)
@@ -37,7 +37,7 @@ eval { &db_do("drop table $tb_obsah") };
                ."month tinyint not null,"
                ."month_last tinyint not null,"
                ."sequential smallint not null,"
-               ."contents text not null"
+               ."contents text null"
                .")");
 
 &db_do("alter table $tb_obsah add unique (year,month)");
@@ -66,7 +66,8 @@ sub flush_month
        $_=$contents;
        return if !defined $_;
        if (!$_) {
-               print("Empty contents".&where()."!\n");
+               # Permitted to show just the title image
+               #print("Empty contents".&where()."!\n");
                }
        else {
                tr/ \t\n/  \n/s;
@@ -76,7 +77,7 @@ sub flush_month
                tr/\002//d;
                $_=substr($_,1);
                }
-       $insert_tb_obsah->execute($year,$month,$month_last,$sequential,$_) or die "SQL insert failure: $!";
+       $insert_tb_obsah->execute($year,$month,$month_last,$sequential,($_ || undef())) or die "SQL insert failure: $!";
        undef $year,$month;
        undef $contents;
        undef $first;