Hello !

I often use that common scheme to parametrize my queries.

#!/bin/bash

#check parameters most commonly (only number of parameters)

if [ $# !=NUMBER_OF_PARAMETERS_NEEDED ];
        then echo "Too few parameters";exit 1;
fi

# these are queries in my "transactional" procedure
# $1...$N are shell positional parameters and simultaneously are parameters of
# quieries

QUERY1="SELECT ... $1....$2....FROM... WHERE $3...." 
QUERY2="INSERT .... $N....."
...
QUERYN="..."

# now proceed queries

/usr/bin/mysql -u USER -p -B database -e "$QUERY1;$QUERY2;....;$QUERYN"

the quotation marks after -e are required.

I hope this help.

Goodbye.
Dannis.

On Wed, Dec 05, 2001 at 09:50:47AM -0500, Gurhan Ozen wrote:
>   Hello everyone..
>  I know that you can write the sql scripts into a text file and redirect it
> to the mysql from command line.. Is there any way to add shell/system
> commands to automate process? PArticularly, I am looking for a way to echo
> files and put them in a blob column.
>   I am also wondering if there is any way to run system commands and shell
> scripts from the mysql> prompt (like we do in most Unix programs by using !

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to