Mercurial > hg > egg-tcls
view create_quotedb.tcl @ 567:601ef87a1c42
weather: Cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 21 Jul 2020 18:26:28 +0300 |
parents | 1255d524a919 |
children |
line wrap: on
line source
#!/usr/bin/tclsh # TCL script for creating (empty) QuoteDB SQLite3 database # # Written by Matti 'ccr' Hamalainen <ccr@tnsp.org> # (C) Copyright 2011 Tecnic Software productions (TNSP) # package require sqlite3 source [file dirname [info script]]/utillib.tcl set db_create_desc "Creates tables for QuoteDB in target SQLite3 file" set db_table_list {quotedb} proc db_create_table { dbh utable } { utl_create_table_or_fail dbh "$utable" "id INTEGER PRIMARY KEY AUTOINCREMENT, utime INT, utext VARCHAR(2048), user VARCHAR(32), host VARCHAR(256), chan VARCHAR(32)" utl_create_table_or_fail dbh "${utable}_votes" "id INTEGER PRIMARY KEY AUTOINCREMENT, user VARCHAR(32), urlid INTEGER, vote INTEGER" } proc db_drop_table { dbh utable } { utl_drop_table dbh "$utable" utl_drop_table dbh "${utable}_votes" } proc db_get_table_list { utable } { return [list "$utable" "${utable}_votes"] } source [file dirname [info script]]/utilcreate.tcl