• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [REQ] Applescript, do shell script e mysql
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [REQ] Applescript, do shell script e mysql


  • Subject: Re: [REQ] Applescript, do shell script e mysql
  • From: Marco Trotta <email@hidden>
  • Date: Fri, 4 Aug 2006 13:14:00 +0200

hi cris,

Giovedì, 3 agosto 2006 ore 10:53:05 -0700, hai scritto:
 >It certainly looks like an encoding mis-match, but I'm not sure
 >exactly what's going on.  "do shell script" always transcodes the
 >script you give it into UTF-8, so if mysql is also set to use UTF-8,
 >then I'd think it would work, but obviously it doesn't.  Go read
 ><http://developer.apple.com/technotes/tn2002/tn2065.html
 > >, in particular the "non-ASCII text" question, and see if that sheds
 >any light on the matter.  A few random guesses:
 >
 >- Are there any other commands getting involved?  One of them may be
 >the problem.

No i'm using InsertDataIntoTableRaw
This is the code inside

on InsertDataIntoTableRaw(userName, usersPassword, theHost, theDataBase,
insertOptions, tableName, theInsertCommand)
	set finalResult to "Error: mysql not found, have you installed it?"
	if gmySQLCommand is equal to missing value then
		if SetLocationOfmySQL() is equal to false then
			return finalResult
		end if
	end if
	set logInString to CreateLogInString(userName, usersPassword, theHost)
	set dataBaseString to ""
	if theDataBase is not equal to "" then
		set dataBaseString to " -D " & "'" & theDataBase & "'"
	end if
	set theCommand to gmySQLCommand & logInString & dataBaseString & "
-e \"INSERT"
	if insertOptions is not equal to "" then
		set theCommand to theCommand & " " & insertOptions
	end if
	set theCommand to theCommand & " INTO " & "\\`" & tableName & "\\`"
& " " & theInsertCommand & "\""
	-- display dialog theCommand
	set theResult to ""
	try
		set theResult to do shell script theCommand
	on error
		set theResult to RedoMySQLCommand(theCommand)
	end try
	return theResult
end InsertDataIntoTableRaw


that producing a terminal's line command like this

/usr/local/mysql/bin/mysql -u [] --password=[] -D [] -e "INSERT INTO \`[]\`
VALUES ('');"



 >- Is the wrong value getting stored in the database?  How do you
 >know?  If you're getting the results back using "do shell script",
 >then the problem may be with the output from mysql, not the input.

the output is the same with
CocoaMysql and phpMyAdmin

MT
 _______________________________________________
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

References: 
 >[REQ] Applescript, do shell script e mysql (From: Marco Trotta <email@hidden>)
 >Re: [REQ] Applescript, do shell script e mysql (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Re: Warnings from Terminal and problems running an AppleScript with osascript
  • Next by Date: Problem with scripting ARD
  • Previous by thread: Re: [REQ] Applescript, do shell script e mysql
  • Next by thread: select text of document 1 in TextEdit?
  • Index(es):
    • Date
    • Thread