• 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: SQL database and applescript?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SQL database and applescript?


  • Subject: Re: SQL database and applescript?
  • From: bryan <email@hidden>
  • Date: Sun, 31 Mar 2002 09:13:14 -0500

I have only seen scriptable applications which allow SQL
queries from inside AppleScript.
MacSQL is the best I've seen of this genre.
5 star scriptability.
You can actually send direct SQL Queries to your SQL
servers from commands imbedded in your AppleScripts.

You can even generate SQL code on the fly within your
script and execute it directly from within the script.

For example, I used the following (abridged version)
to read records from a Filemaker DB and insert them
into an SQL DB; (and yes I think it's easier than using
ODBC.) [nota bene: <opt-L> is a line wrap command]

The only important part is the very last command:

------------------------
tell application "FileMaker Pro"
activate
tell last record of database <opt-L>
"Apex Study Processing Copy_DrKM" of document 1
set my_data_list to {cell "Log_Status", <opt-L>
cell "Acct_Num", cell "Dictation_ID", <opt-L>
cell "Exam", cell "Facility", cell "Last_Name", <opt-L>
cell "First_Name", cell "Date_of_Exam", <opt-L>
cell "Ref_Physician", cell "Modality", <opt-L>
cell "Exam_Status", cell "Soc_Sec_Num", <opt-L>
cell "History", cell "Additional_Notes"}
end tell
end tell

set my_data_list_as_string to stringify(my_data_list)
--data massaging happens here to coerce the data list to
--the appropriate string, it's not important to the concept

set my_sql_string to <opt-L>
"INSERT INTO reports ( status, client_id, <opt-L>
patient_id, study_text, facility, last_name, <opt-L>
first_name, date_of_service, referring_physician, <opt-L>
modality, priority, custom_1, custom_2, <opt-L>
custom_3 ) VALUES " & my_data_list_as_string

tell application "MacSQL"
tell session of document 1 to do query my_sql_string
end tell
------------------------

I am totally jazzed by this,
...but then
I don't get out much.

Bryan Kaufman


Giuliano Gavazzi wrote:

> At 12:37 am +0100 2002/03/31, Goran Ehn wrote:
> >Is it possible to send an sql statement from applescript and
> >retrieve information from an sql database? I think I've seen this
> >question before but I cannot find any information about this, has
> >anyone done any work like this? Any help is appreciated.
>
> I don't know if an OSAX already exists to do so, but since I have
> experience with scriptable database clients (I support most databases
> supported by OpenLink ODBC, but I once tested with the Merant ODBC
> suite and it worked too) I might be convinced to write an OSAX if
> enough persuasion is applied...
>
> Giuliano
> --
> H U M P H
> || |||
> software
>
> Java & C++ Server/Client/Human Interface applications on MacOS - MacOS X
> http://www.humph.com/
> _______________________________________________
> applescript-users mailing list | email@hidden
> Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
> Do not post admin requests to the list. They will be ignored.

[demime 0.98b removed an attachment of type text/x-vcard which had a name of bryan.vcf]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: SQL database and applescript? (From: Giuliano Gavazzi <email@hidden>)

  • Prev by Date: every process doesn´t work here
  • Next by Date: Re: every process doesn´t work here
  • Previous by thread: Re: SQL database and applescript?
  • Next by thread: Re: SQL database and applescript?
  • Index(es):
    • Date
    • Thread