Jk-voting-force voting exist

From AOLserver Wiki
Revision as of 19:38, 15 January 2002 by WikiSysop (talk | contribs) (imported from WiKit id 77)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

proc force_voting_exist {dbhandle} {

   #postgres specific
   ns_log Notice "Checking to see if table voting exists"
   if {[[ns_db 0or1row $dbhandle \

"select * from pg_tables where tablename = 'voting_topics'"]] == ""} {

       ns_db exec $dbhandle "create table voting_topics (\
               topic_identifier serial,\
               subject          text,\
               author           varchar(20)\
               );"
   }
   if {ns_db 0or1row $dbhandle "select * from pg_tables where tablename = 'voting_detail'" == ""} {
       ns_db exec $dbhandle "create table voting_detail (\
               option_identifier serial,\
               option           text,\
               author           varchar(20),\
               votes            integer,\
               voters           text,\
               topic_identifier integer\
               );"
   }
}