[Lazarus] Cairo header update

Marco van de Voort marcov at stack.nl
Wed Apr 30 18:26:11 CEST 2008


And you didn't write it in Pascal because.... ?

Joost

Op woensdag 30-04-2008 om 11:28 uur [tijdzone +0200], schreef Graeme
Geldenhuys:
> Hi,
> 
> I created a script (Unix/Linux only at the moment) called 'mkdb' for use 
> with our application deployment. We use the Firebird RDBMS and thought 
> this might come in handy for others as well.
> 
> It creates a Firebird database, creates the tables. Optionally it 
> creates Views, applies table rights and inserts default data. All 
> database information is read from sql script files: create.sql, 
> views.sql, rights.sql, defaults.sql
> 
> The script (mkdb) also takes three optional parameters:
>    - database location
>    - database username
>    - database password
> 
> 
> I hope someone finds this useful. :)
> 
> 
> Regards,
>    - Graeme -
> 
> 
> _______________________________________________________
> fpGUI - a cross-platform GUI toolkit using Free Pascal
> http://opensoft.homeip.net/fpgui/
> 
> 
> platte tekst document bijlage (mkdb)
> #!/bin/sh
> #
> # Script to create a Firebird database, apply permissions and 
> # to fill it with data.
> #
> # The script accepts optional arguments: 
> #    - A database to connect to. (default is setup below)
> #    - Database username (default 'SYSDBA')
> #    - Database password (default 'masterkey')
> #
> # The script looks for the following sql scrip files and executes them
> #    - create.sql    (mandatory)
> #    - views.sql     (optional)
> #    - rights.sql    (optional)
> #    - defaults.sql  (optional)
> #
> 
> 
> # Collect the database
> database="localhost:/home/graemeg/programming/data/m2empty.fdb"
> #database=192.168.0.1:M2
> if [ -n "$1" ]; then
>   database=$1
> fi
> 
> # Database login information
> user=SYSDBA
> if [ -n "$2" ]; then
>   user=$2
> fi
> passwd=masterkey
> if [ -n "$3" ]; then
>   passwd=$3
> fi
> 
> # Choose one of the following:
> ISQL="isql -q -d $database -u $user -p $passwd"
> #ISQL="/opt/firebird/bin/isql -q -d $database -u $user -p $passwd"
> 
> 
> ##############################################################
> #
> #   You shouldn't need to edit after this.
> #
> 
> echo -n "Creating the database $database ..."
> ${ISQL} << EOF
> set sql dialect 3;
> CREATE DATABASE "$database";
> commit;
> EOF
> if [ ! $? = 0 ]; then
>   echo "Failed."
> else
>   echo "Done."
> fi
> 
> echo -n "Creating the tables in database ..."
> ${ISQL} << EOF
> connect '$database' user '$user' password '$passwd';
> input create.sql;
> commit;
> EOF
> if [ ! $? = 0 ]; then
>   echo "Failed."
> else
>   echo "Done."
> fi
> 
> if [ -e ./views.sql ]; then
> 	echo -n "Creating the views in database ..."
> 	${ISQL} << EOF
> 	connect '$database' user '$user' password '$passwd';
> 	input views.sql;
> 	commit;
> EOF
> 	if [ ! $? = 0 ]; then
> 		echo "Failed."
> 	else
> 		echo "Done."
> 	fi
> fi
> 
> if [ -e ./rights.sql ]; then
> 	echo -n "Applying table permissions ..."
> 	${ISQL} << EOF
> 	connect '$database' user '$user' password '$passwd';
> 	input rights.sql;
> 	commit;
> EOF
> 	if [ ! $? = 0 ]; then
> 		echo "Failed."
> 	else
> 		echo "Done."
> 	fi
> fi
> 
> if [ -e ./defaults.sql ]; then
> 	echo -n "Inserting default data ..."
> 	${ISQL} << EOF
> 	connect '$database' user '$user' password '$passwd';
> 	input defaults.sql;
> 	commit;
> EOF
> 	if [ ! $? = 0 ]; then
> 		echo "Failed."
> 	else
> 		echo "Done."
> 	fi
> fi
> 
> 
> # END
> 
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
-- 




More information about the Lazarus mailing list