#!/bin/sh
#    This file is part of the KDE project
#   Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
#
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public
#   License as published by the Free Software Foundation; either
#   version 2 of the License, or (at your option) any later version.

# migration from sqlite2 to sqlite3
# usage: ksqlite2to3 <sqlite2-db-file>

temp=`basename $0``mktemp -q XXXXXX 2> /dev/null  || date +%y%m%d%H%M2`
dir=`dirname $1`
ksqlite2 "$1" .quit 2> /dev/null || exit 1
pwd
ksqlite2 -verbose-dump "$1" .dump | ksqlite "$dir/$temp"
if test $? -eq 1 ; then
	rm -f "$dir/$temp"
	exit 2
fi
mv "$dir/$temp" "$1" 2> /dev/null || exit 3

