• 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: Can I force a reload of a database's JDBC info?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I force a reload of a database's JDBC info?


  • Subject: Re: Can I force a reload of a database's JDBC info?
  • From: Chuck Hill <email@hidden>
  • Date: Sat, 05 Mar 2016 02:10:23 +0000
  • Thread-topic: Can I force a reload of a database's JDBC info?

That seems safe enough given when you are doing it but is slightly to somewhat more odious than the PlugIn subclass.



From: Paul Hoadley <email@hidden>
Date: Friday, March 4, 2016 at 5:43 PM
To: Chuck Hill <email@hidden>
Cc: WebObjects Development <email@hidden>
Subject: Re: Can I force a reload of a database's JDBC info?

Hi Chuck,

I’ve also seen your post about subclassing JDBCPlugIn, which I’ll try shortly, but...

On 4 Mar 2016, at 5:31 pm, Paul Hoadley <email@hidden> wrote:

On 4 Mar 2016, at 4:59 pm, Chuck Hill <email@hidden> wrote:

Ah, right, protected, I was going to mention that and got distracted.  :-)  You will need to find a way to get it it to use a subclass of JDBCAdaptor.   Wonder does this with ERXJDBCAdaptor.

Here’s another potential hack. I know what the keypath ‘jdbc2Info.typeInfo.citext’ should look like in the connection dictionary, because I can see it in there if I CREATE EXTENSION manually ahead of time. Can I just pre-emptively stick that in the connection dictionary at runtime if it’s not there? By which I mean I’ll try that—where and how would I do it? It doesn’t have to be in the migration.

As far as I can tell, this works. This is in a migration’s upgrade() method, after I CREATE EXTENSION and ALTER TABLE:

// Get the model
EOModel model = ERXModelGroup.defaultGroup().modelNamed("Ident");
// Get jdbc2Info dictionary from connectionDictionary
NSMutableDictionary<String, Object> overrides = ((NSDictionary<String, Object>) model
.connectionDictionary().valueForKey("jdbc2Info"))
.mutableClone();
// Build the value we want for the typeInfo.citext key
NSDictionary<String, Object> citext = NSPropertyListSerialization
.dictionaryForString("{defaultJDBCType = (\"OTHER\"); createParams = \"0\"; maxScale = \"0\"; minScale = \"0\"; isNullable = \"T\"; isSearchable = \"T\"; precision = \"0\"; }");
// Add the citext entry to overrides
overrides.takeValueForKeyPath(citext, "typeInfo.citext");
// Apply the overrides
EODatabaseContext.forceConnectionWithModel(model, overrides, editingContext);

Any comments on the safety/desirability of this approach, or where it sits on the scale of awful hacks?

Next up, PlugIn subclass.


-- 
Paul Hoadley
http://logicsquad.net/



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Can I force a reload of a database's JDBC info? (From: Paul Hoadley <email@hidden>)
 >Re: Can I force a reload of a database's JDBC info? (From: Chuck Hill <email@hidden>)
 >Re: Can I force a reload of a database's JDBC info? (From: Paul Hoadley <email@hidden>)
 >Re: Can I force a reload of a database's JDBC info? (From: Chuck Hill <email@hidden>)
 >Re: Can I force a reload of a database's JDBC info? (From: Paul Hoadley <email@hidden>)
 >Re: Can I force a reload of a database's JDBC info? (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Can I force a reload of a database's JDBC info?
  • Next by Date: Re: Can I force a reload of a database's JDBC info?
  • Previous by thread: Re: Can I force a reload of a database's JDBC info?
  • Next by thread: Re: SQL Server plugin framework
  • Index(es):
    • Date
    • Thread