view create_quotedb.tcl @ 698:6ba9f961e463 default tip

quotedb: Bump version and copyright.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 18 Sep 2023 11:38:41 +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