So there is something wrong with what is
> returned. Neither "0" or "count(*) 0" seem to work. So, does anyone have an
> idea as to what I need to put in for the comparison?
>
>
> Mike
>
> > From: gerald_clark <[EMAIL PROTECTED]>
> > Date:
Okay, the lack of locking was driving me crazy. Here's my
version:
#!/usr/bin/sh
MYSQL="mysql -v test"
ethernet_address=$1
cat <
To: "gerald_clark" <[EMAIL PROTECTED]>
Cc: "MySql List" <[EMAIL PROTECTED]>
Sent: Tuesday, February 10, 2004 10:5
ES
($ethernet_address);"
else
echo "UPDATE hardware_assets SET operating_system='10.3.3';"
fi
Where cetechnology is the database. All the variables are set.
When I run this, it starts the mysql client application, with the mysql>
prompt. Nothing is inserted or updated in
idea as to what I need to put in for the comparison?
Mike
> From: gerald_clark <[EMAIL PROTECTED]>
> Date: Mon, 09 Feb 2004 14:28:27 -0600
> To: Mike Tuller <[EMAIL PROTECTED]>
> Cc: MySql List <[EMAIL PROTECTED]>
> Subject: Re: There has to be a way to do this
&
mysql>
>>prompt. Nothing is inserted or updated in the database though.
>>
>>This is the same problem I had when I tried to do it this way, but I am not
>>knowledgeable in shell scripting yet to know what I am doing wrong.
>>
>>
>>
>>
>>> From: ger
>This is the same problem I had when I tried to do it this way, but I am not
>knowledgeable in shell scripting yet to know what I am doing wrong.
>
>
>
>
>> From: gerald_clark <[EMAIL PROTECTED]>
>> Date: Mon, 09 Feb 2004 11:11:24 -0600
>> To: Mike Tuller &
d had only
the line for RESULT=, and then did echo $RESULT. It returns nothing. Not a 0
or a 1, nothing.
> From: gerald_clark <[EMAIL PROTECTED]>
> Date: Mon, 09 Feb 2004 14:28:27 -0600
> To: Mike Tuller <[EMAIL PROTECTED]>
> Cc: MySql List <[EMAIL PROTECTED]>
> Su
ation, with the mysql>
prompt. Nothing is inserted or updated in the database though.
This is the same problem I had when I tried to do it this way, but I am not
knowledgeable in shell scripting yet to know what I am doing wrong.
From: gerald_clark <[EMAIL PROTECTED]>
Date:
Mike Tuller <[EMAIL PROTECTED]> wrote on 09/02/2004 16:53:00:
> I have posted this question a few times, and have not seen the answer
that I
> need.
>
> I have a shell script, that gathers information from systems, and I want
> that info to be entered into a database. I want it to check fir
t; Date: Mon, 09 Feb 2004 11:11:24 -0600
> To: Mike Tuller <[EMAIL PROTECTED]>
> Cc: MySql List <[EMAIL PROTECTED]>
> Subject: Re: There has to be a way to do this
>
> IF works on the selections not on the query.
> Select IF(lastname='clark','Correct
If you are always updating the entire row you could delete the record
(ignoring failures) and then insert the record. Not efficient but it
would work.
If you are able to trap errors in your shell script and there is a
unique index on the ethernet_address field then you can do this:
Update Record
IF works on the selections not on the query.
Select IF(lastname='clark','Correct',''Incorrect'), firstname from
namefile;
You need to do the checking in your script.
For example in bash:
RESULT=`echo "select count(*) from manefile where lastname='clark'" |
mysql database`
if [ "$RESULT" = "0" ]
You could create a User defined Function that contains this logic. At the
present time, an UDF needs to be coded in C.
Depending on how your `users` interface with the application, you could
write a C/C++ or java command line interface as well.
>> Original Message <<<
13 matches
Mail list logo