Re: MySQL Question
Re: MySQL Question
- Subject: Re: MySQL Question
- From: Steve Suranie <email@hidden>
- Date: Wed, 27 Jul 2005 14:22:25 -0400
<sheepish grin>
typical, I send a help request and ten seconds later I figure it out, the
syntax should be INSERT INTO itemstatus (id) VALUES (67) - no single quotes.
Doh!
</sheepish grin>
On 7/27/05 2:19 PM, "Steve Suranie" <email@hidden> wrote:
> Hi all
>
> I've been toying with this script, the basis of which I got from the Yarra
> Valley Software AppleScript mysql interface freeware. All works fine when
> reading from the database but when trying to create a new record I get an
> error message saying I have a MySQL syntax error. Here's the script:
>
> ==============================
>
> set mySQLList to {"/usr/local/mysql/bin/", "/Library/MySQL/bin/"}
>
> repeat with i from 1 to the count of mySQLList
> try
> set theResult to do shell script (item i of mySQLList) & "mysql -V"
> set gPathToMySQL to (item i of mySQLList)
> set haveFound to true
> exit repeat
> end try
> end repeat
>
> set gmySQLCommand to gPathToMySQL & "mysql"
>
>
> set theHost to "10.1.1.###"
> set theUser to "mysqladmin"
> set thePassword to "******"
> set thePort to "3306"
> set theDatabase to "storeStatus"
> set theTable to "itemStatus"
>
> set theLoginString to " -h " & theHost & " -u " & theUser & " --password="
> & thePassword
> set dataBaseString to " -D " & "'" & theDatabase & "'"
> set theCommand to gmySQLCommand & theLoginString & dataBaseString & " -e \""
> & "SELECT * FROM itemstatus" & "\""
> set theResult to ""
>
> --display dialog theCommand
> try
> set theResult to do shell script theCommand
> on error errMsg
> display dialog errMsg
> end try
> return theResult
>
> ============================
>
> running it as such returns all the records, I can also do a WHERE x = "y"
> AND x2 = "y2" and get the right results. But when I change the SQL command
> to INSERT INTO itemstatus ('id') VALUES ('67') I get the syntax error. Any
> help would be appreciated.
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Applescript-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden