Difference between revisions of "Jk-voting-force voting exist"

From AOLserver Wiki
Jump to navigation Jump to search
(imported from WiKit id 77)
(No difference)

Revision as of 19:38, 15 January 2002

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\
               );"
   }
}