view create_urllog_db.tcl @ 60:ce327469582c

quotedb: Add "update" sub-command for modifying/updating recently added quotes.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 08 Sep 2011 22:16:54 +0300
parents dccd6c47f9cd
children 7b03971c6d28
line wrap: on
line source

#!/usr/bin/tclsh
# TCL script for creating (empty) URLLog 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]]/util_convert.tcl

### Check commandline arguments
if {$argc < 1} {
	puts "Creates tables for URLLog target SQLite3 file"
	puts "Usage: $argv0 <output_sqlite3_db_file> \[-drop\]"
	puts ""
	puts "-drop option will drop any existing URLLog tables."
	exit 0
}

set db_drop 0
set db_output [lindex $argv 0]
if {$argc >= 2 && [lindex $argv 1] == "-drop"} {
	set db_drop 1
}

### Open database
open_db $db_output

if {$db_drop} {
	puts "WARNING! Dropping old tables URLLog requested!"
	puts "All data in those tables will be permanently lost!"

	if {![confirm_yesno "Proceed"]} {
		puts "Aborting procedure."
		dbh close
		exit 0
	}

	drop_table "urls"
}

create_table_urls

dbh close

puts "DONE."