Jk-voting-force voting exist
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\
);"
}
}