• 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: Changing EOModel login on the fly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing EOModel login on the fly?


  • Subject: Re: Changing EOModel login on the fly?
  • From: Simon Stapleton <email@hidden>
  • Date: Fri, 16 Apr 2004 09:37:19 +0200

Greg Hulands wrote:
On another note, is it possible to get the EOModel to generate the
database tables on the fly, this would be like EOModeller's ability to
generate the sql and then execute it on the database. I am just asking
this for turnkey style solutions where the user wouldn't have
EOModeller on there system to open the model and execute the sql.

There's several ways of doing this.

The first one is to package your app with a script that creates the database ;-)

The second is to use EOSynchronizationFactory, which is what EOModeler uses to generate its SQL. In the case of a 'supported'[1] database, you simply do the following (typed from memory, don't rely on it)

EOAdaptor adaptor = EOAdaptor.adaptorWithModel(myModel);
EOSynchronizationFactory myFactory = new EOSynchronizationFactory(adaptor);


... and then create the various bits of SQL using EOSynchronizationFactory's methods.

Or, more simply, you could try:

NSDictionary adminDict;
// Set up adminDict to have the various rights for creating the database
EOAdaptor adaptor = EOAdaptor.adaptorWithModel(myModel);
adaptor.createDatabaseWithAdministrativeConnectionDictionary(adminDict);

IMO, using a script bundled with the app installer is likely to be more useful. With that you can allow for a lot more than just 'the database doesn't exist' - you can deal with 'it exists but is in a previous format and needs backing up, the schema changing, and then restoring again'

Simon

[1] i.e. Those supported by WO 'out of the box'. For unsupported databases, you will need a plugin that not only deals with the key generation stuff, but that also does the synchronization bits as well. At least in the case of the hexdreams postgresql plugin, this code is only included in the EOModeler plugin part, not the runtime part. So you may need to hack on your plugins as well.

--
PGP Key Id : 0x50D0698D
--
If the answer isn't obvious, the question is a distraction. Go find an easier question.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.



  • Prev by Date: Frameworks and DisplayGroups
  • Next by Date: Re: Postgresql problem
  • Previous by thread: Re: Changing EOModel login on the fly?
  • Next by thread: EditingContext question
  • Index(es):
    • Date
    • Thread