Associating a RealDB with an App (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Subject: Re: Keyboard.AsyncKeydown sorrows
Next thread: StringShape Problem


[OT] more Carbon shared library tales   -   Hadley, Joshua
  Associating a RealDB with an App   -   iUNI Technologies Corp.
   Re: Associating a RealDB with an App   -   Corey Redlien
    Re: Associating a RealDB with an App   -   iUNI Technologies Corp.

Associating a RealDB with an App
Date: 13.12.02 06:31 (Thu, 12 Dec 2002 21:31:38 -0800)
From: iUNI Technologies Corp.
Hi,

An application I am working on creates several RealDB's which are used
exclusively with this application. These RealDB files can be copied by
the user, backed up or shared with others using the same application.

I wish for the RealDB files, as the exist in a folder, to be associated
with my application, much the same way I make a custom file associated
with a creator code and icon.

Is this possible?

When my application creates a Realdatabase file it is created with the
Realdatabase creator code (and icon if RB is installed on the users
system??). Would I just change the creator code to that of my
application after the database has been written? How would I associate
its icon with my application?

Thanks guys.

Ian

---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:<email address removed>>

Subscribe to the digest:
<mailto:<email address removed>>

Re: Associating a RealDB with an App
Date: 13.12.02 14:11 (Fri, 13 Dec 2002 08:11:56 -0500)
From: Corey Redlien
I've had some luck with this code to create a database with the correct
associations, as well as have an icon (different than the RB) attached.
Don¹t' forget to change the application settings, as well as setup a file
type that you wish to use... (I used application/red with creator and type
as REDD... You can change to whatever you wish.. These are not registered
with apple). My experience is that you have to do a build and run from the
system before your icons/associations show up in the finder, I could be
wrong, though.

Dim dbfi as folderitem
Dim db as database

dbFI = GetSaveFolderItem( "application/red", "New File.red" )
if dbFI <> NIL then
db = NewREALDatabase(dbFI)
db.SQLExecute "CREATE TABLE TEST( id varchar)"
db.SQLExecute "INSERT INTO TEST (id) VALUES ('hello world')"
msgbox "created database " + dbFI.Name + " and created a table"
db.Close
dbFI.MacCreator = "REDD"
dbFI.MacType = "REDD"
end

- Corey

p.s. Credit goes to gordon who originally gave this to me.

On 12/13/02 12:31 AM, "iUNI Technologies Corp." <<email address removed>> wrote:

> Hi,
>
> An application I am working on creates several RealDB's which are used
> exclusively with this application. These RealDB files can be copied by
> the user, backed up or shared with others using the same application.
>
> I wish for the RealDB files, as the exist in a folder, to be associated
> with my application, much the same way I make a custom file associated
> with a creator code and icon.
>
> Is this possible?
>
> When my application creates a Realdatabase file it is created with the
> Realdatabase creator code (and icon if RB is installed on the users
> system??). Would I just change the creator code to that of my
> application after the database has been written? How would I associate
> its icon with my application?
>
> Thanks guys.
>
> Ian
>
>
> ---
> A searchable archive of this list is available at:
> <http://dbserver.realsoftware.com/KBDB/search.php>
>
> Unsubscribe:
> <mailto:<email address removed>>
>
> Subscribe to the digest:
> <mailto:<email address removed>>
>

---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:<email address removed>>

Subscribe to the digest:
<mailto:<email address removed>>

Re: Associating a RealDB with an App
Date: 13.12.02 19:09 (Fri, 13 Dec 2002 10:09:23 -0800)
From: iUNI Technologies Corp.
Hi Corey,

> My experience is that you have to do a build and run from the
> system before your icons/associations show up in the finder, I could be
> wrong, though.

I have experienced this also, and this seems to work.

Thanks very much for the code example. I am going to give it a try!

Cheers,

Ian

On Friday, December 13, 2002, at 05:11 AM, Corey Redlien wrote:

> I've had some luck with this code to create a database with the correct
> associations, as well as have an icon (different than the RB) attached.
> Don’t' forget to change the application settings, as well as setup a
> file
> type that you wish to use... (I used application/red with creator and
> type
> as REDD... You can change to whatever you wish.. These are not
> registered
> with apple). My experience is that you have to do a build and run
> from the
> system before your icons/associations show up in the finder, I could be
> wrong, though.
>
> Dim dbfi as folderitem
> Dim db as database
>
> dbFI = GetSaveFolderItem( "application/red", "New File.red" )
> if dbFI <> NIL then
> db = NewREALDatabase(dbFI)
> db.SQLExecute "CREATE TABLE TEST( id varchar)"
> db.SQLExecute "INSERT INTO TEST (id) VALUES ('hello world')"
> msgbox "created database " + dbFI.Name + " and created a table"
> db.Close
> dbFI.MacCreator = "REDD"
> dbFI.MacType = "REDD"
> end
>
> - Corey
>
> p.s. Credit goes to gordon who originally gave this to me.
>
> On 12/13/02 12:31 AM, "iUNI Technologies Corp." <<email address removed>>
> wrote:
>
>> Hi,
>>
>> An application I am working on creates several RealDB's which are used
>> exclusively with this application. These RealDB files can be copied by
>> the user, backed up or shared with others using the same application.
>>
>> I wish for the RealDB files, as the exist in a folder, to be
>> associated
>> with my application, much the same way I make a custom file associated
>> with a creator code and icon.
>>
>> Is this possible?
>>
>> When my application creates a Realdatabase file it is created with the
>> Realdatabase creator code (and icon if RB is installed on the users
>> system??). Would I just change the creator code to that of my
>> application after the database has been written? How would I associate
>> its icon with my application?
>>
>> Thanks guys.
>>
>> Ian
>>
>> ---
>> A searchable archive of this list is available at:
>> <http://dbserver.realsoftware.com/KBDB/search.php>
>>
>> Unsubscribe:
>> <mailto:<email address removed>>
>> Subscribe to the digest:
>> <mailto:<email address removed>>
> ---
> A searchable archive of this list is available at:
> <http://dbserver.realsoftware.com/KBDB/search.php>
> Unsubscribe:
> <mailto:<email address removed>>
> Subscribe to the digest:
> <mailto:<email address removed>>

---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:<email address removed>>

Subscribe to the digest:
<mailto:<email address removed>>