Commit Graph

25 Commits

Author SHA1 Message Date
Michael Bayne 709a6ce203 Unused import patrol. 2008-09-05 22:43:06 +00:00
Michael Bayne 4c41561f0f PrimaryKeySet -> KeySet. 2008-09-05 22:16:55 +00:00
Michael Bayne 84622e56c7 Formalized the two-phase "get primary keys that match an arbitrary query, then
load or modify the rows that match those keys" pattern so that we can almost
always just magically do the right thing with regard to the cache. Added a
version of deleteAll() that makes use of this.

Also nixed a bunch of checked exception tomfoolery which was almost entirely
unnecessary and now with DatabaseException is completely unnecessary.

A few things remain to be done:

- PrimaryKeySet tries to be "smart" if its passed 0 keys and use
LiteralExp("false") but that causes things to freak out because Depot then
doesn't know what primary class it's dealing with. I'm probably going to make
All and None expressions that match all and none of the records in a table
respectively.

- deleteAll() doesn't currently split its keys into chunks small enough to be
digestible by the database if we match more than 32,768 rows. I'll see if I
can't abstract out that code from FindAllQuery so that we can easily use it
everywhere. It would be cool to handle that a a lower level and allow the
WhereClause to say that it needs to be run in phases, but that would probably
complicate the crap out of the low-level code.

- I need to create PrimaryKey to go between Key and PrimaryKeySet so that we
can avoid duplicating the primary key columns thousands of times in a large
PrimaryKeySet.
2008-09-05 19:39:08 +00:00
Michael Bayne 67bdfda3fe Changed Depot to throw a RuntimeException on unexpected database error instead
of a checked exception. Invariably, we don't do anything with our
PersistenceExceptions except let them percolate all the way to the top and then
log a warning. We can probably automate the process of logging a warning with
useful information and save ourselves the trouble of doing it manually
everywhere.
2008-09-03 16:10:06 +00:00
Michael Bayne 2fd131c0d2 Any collection of anything that extends QueryClause is generally all we need. 2008-09-03 00:55:07 +00:00
Michael Bayne beef018b03 Nixed unused import. 2008-08-25 18:16:35 +00:00
Michael Bayne 43e1a38703 Let's go all the way up to Short.MAX_VALUE. 2008-08-25 16:27:43 +00:00
Michael Bayne d54c633401 Don't try to use an IN() clause with more than 16738 entries. 2008-08-25 15:57:43 +00:00
Michael Bayne 8f2cf98c17 Le metric crapload of generics cleanup. 2008-07-30 13:53:24 +00:00
Ray Greenwell 8f1b3ad8b0 2008-07-15 00:03:10 +00:00
Michael Bayne 4eb7d9ecd3 Pass -Dcom.samskivert.jdbc.depot.debug=true to have Depot log queries before
they are executed.
2008-04-23 23:29:07 +00:00
Par Winzell 13121249cb The query is in no way guaranteed to uniquely keyed rows, so let's stuff the result into a Set. We should probably add the 'unique' modifier to the actual query, but that requires a bit more cross-dialect-and-version research than I'm willing to give it just now. 2008-04-06 14:57:14 +00:00
Michael Bayne 951b201064 Support taking a List as well as a varargs array. There are no doubt other
places where this could be done.
2007-11-26 21:50:54 +00:00
Par Winzell 8fbdf7470d So while the JRE is happy to serialize arrays, EHCache is reluctant to do so in at least one place (presumably an explicit Serializable test). Let's switch to an ArrayList until further notice. 2007-11-11 20:29:38 +00:00
Par Winzell 45a03ed42d Let's note what we're doing here. 2007-08-27 16:22:46 +00:00
Par Winzell 8081e7bfad Fall back to the simple case: a query on a concrete record without overrides can be stripped of all JOINs and external WHERE clauses in the second pass. 2007-08-27 16:11:26 +00:00
Par Winzell 8e9279c242 We can't replace the original WHERE clause while keeping the original JOINs. Unfortunately, figuring out precisely which JOINs may be safely deleted seems rather complicated. For now, trust the database to do the right thing when our second-pass query is identical to the first one, except with an additional WHERE condition that restricts the primary key columns according to the results of the first pass. 2007-08-24 16:22:27 +00:00
Michael Bayne b24786facd More useful debug information. 2007-08-24 01:13:27 +00:00
Michael Bayne cd6410ad7d Let's not stick a fork in things if we don't have to. This is rendering Whirled
inoperable right now, but just returning what we got would be perfectly fine.
2007-08-24 01:07:45 +00:00
Par Winzell be3649908b Replace insane implementation with one that does not rely on the database to magically know in which order we want results returned. 2007-08-22 20:30:20 +00:00
Par Winzell 5191c6d967 Break a much gentler FieldDefinition out of FieldOverride. The former *must* be supplied for any computed field; the latter must *only* be supplied for fields that would otherwise reference concrete columns. This lets us be more intelligent about what we expand where. Also bring back the old semi-conservative selection criterion for two-pass cache-happy collection queries; it gets simply too hairy when parts of an object's primary key comes from a separate table. 2007-08-21 23:11:14 +00:00
Michael Bayne 3628ec528d Zell patch to factor caching code into pluggable CacheAdapter class. Allows us
to disable caching and/or replace it with less industrial strength system
during development.
2007-07-26 19:07:20 +00:00
Michael Bayne 9f544c9174 El Giganto Depot database dialects support from Zell. PostgresSQL here we
come. Automatic schema migration is currently disabled and remains to be
dialectified.
2007-07-25 20:53:40 +00:00
Michael Bayne f0bae6ff8d Header updates. 2007-07-13 00:20:09 +00:00
Michael Bayne 083cb788d8 Another Zell Depot patch:
- refactoring query construction;
- modified collection lookup to first look up the matching primary keys, then
check the cache for hits then look up the remainder from the database;
- other small renamery and cleanup.
2007-07-12 20:02:54 +00:00