Commit Graph

403 Commits

Author SHA1 Message Date
Michael Bayne 259da94d3f Wrapped some long lines, nixed unwanted blankness. 2009-04-29 17:01:03 +00:00
Par Winzell 273b0b8fd0 Handle ByteEnums. Not actually tested. 2009-04-29 16:22:37 +00:00
Par Winzell 27b108b0c4 Overrides, from David Hoover (belatedly): 'Also nukes trailing whitespace, foreaches a couple loops and varags one thing that leapt out at me while i was skimming it.' 2009-04-29 16:17:39 +00:00
Michael Bayne 95212f57e2 Added as(). 2009-04-28 06:27:04 +00:00
Michael Bayne 825b15d5f7 Driver wants 'varchar' not 'character varying'. For future reference, these
mappings seem to be in appendix B of the JDBC specification.
2009-04-27 22:48:14 +00:00
Michael Bayne cbde87c6a2 Detect our type based on the first element of the array rather than the type of
the array which may be Comparable[] or Object[] and therefore not informative.
2009-04-27 22:42:23 +00:00
Par Winzell 5a1dfdc306 I should be shot for writing this code originally. I can hardly think of a place where the exception is more important to see. 2009-04-27 21:58:31 +00:00
Par Winzell 262ef317ad Remove confusing and pointless incrementing. 2009-04-27 21:21:50 +00:00
Michael Bayne 9bb640f334 Detect our JDBC major version when starting Depot. If we are using JDBC4 then
use JDBC4's array support when doing In() clauses for Postgres.
2009-04-27 19:45:07 +00:00
Michael Bayne d2e1ea6eda We need the connection during the binding step for Postgres array machinations. 2009-04-27 18:06:55 +00:00
Michael Bayne 1468275c18 Patch from Charlie to update to Google Collect rc1. 2009-04-24 23:19:18 +00:00
Michael Bayne ae2f7316f6 Oops. Can't do that. 2009-04-17 22:58:39 +00:00
Michael Bayne 02d782e7e5 Allow 1.6 source but continue to target 1.5 bytecode. 2009-04-17 22:50:54 +00:00
Michael Bayne 76c8d59c56 Let's have the exception here as well so that we know where to fix. 2009-04-14 16:17:30 +00:00
Par Winzell 093387b603 Oops. We can't use Java 1.6 stuff in Depot (yet). Thanks Mr. Hoover. 2009-04-13 18:15:36 +00:00
Par Winzell 44789e36ee Pointer equality between Doubles does not seem like a good idea. 2009-04-13 17:28:37 +00:00
Par Winzell d860091612 Forgot the main evaluator class in the previous commit. Hee. 2009-04-13 17:27:51 +00:00
Par Winzell 859b357d7b Give Depot the ability to evaluate SQL expressions without contacting the database. This code is not yet tied into anything, but possible applications, in increasing order of amazingness:
*) We do not currently invalidate cached keysets even when we know for a fact that the associated records have changed (and exactly how they've changed). By storing along with each cached keyset the query datastructure that was used to fetch the keys, we can use the SQLExpression evaluator to do a secondary invalidation sweep over the records when they're requested and make sure they still match the WHERE clause of the original query. If they don't, we toss'em from the cached keyset. This basically means we can trust our cached keysets much more and increase the amount of time we keep them around in the cache.

 *) Extending the first idea, we can do more than lazily invalidate parts of cached collections. We can, in fact, automatically adjust every relevant cached collection each time a record is deleted, inserted or modified. In theory, we could guarantee perpetual veracity of all cached collection queries. It's not a given that this is in every way a good idea, but it's a very interesting one to investigate.

As part of this change, ExpressionVisitor methods have to return a value. Slightly less elegant, but of greater general utility.
2009-04-13 17:19:01 +00:00
Par Winzell b8ac3750eb The MultiKey is a lot of complicated code to optimize an obscure situation. I know it's obscure because there's not a single use of this class anywhere that I can find. 2009-04-13 15:56:00 +00:00
Par Winzell 03ca344984 Don't freak out on empty In()'s, just scold the developer. 2009-04-10 18:11:13 +00:00
Par Winzell a4dc9860de Fix index creation for MySQL. 2009-04-08 18:52:08 +00:00
Par Winzell 9df2415678 There was never a good reason to do the SQL parameter binding as a second ExpressionVisitor recursion, and duplicating the logic structures for each visitor was getting increasingly cumbersome. Just encapsulate the binding actions and list'em up as we generate the SQL, then just iterate over them simple-like in the second pass. This permanently gets rid of anything BindVisitorish. 2009-04-01 05:48:11 +00:00
Par Winzell b2bd4b51f7 Oops. We were not taking the size of the matched-against column into account at all. That's not intuitive. The more precise the match, the higher we want to rank it. 2009-03-29 19:55:24 +00:00
Par Winzell 34599bc760 Adapt Depot's full-text search capabilities for PostgreSQL 8.3. This is a fairly minimal change, excepting support for associating FullTextIndex configurations with PostgreSQL search configurations. The legacy stuff to support 8.2 is unlikely to last long. 2009-03-26 20:14:45 +00:00
Andrzej Kapolka 51e43b6545 Fix bug that was adding extra commas for non-required computed
columns.
2009-03-25 00:11:55 +00:00
Michael Bayne 398164f2df Changed some Thread.dumpStack() calls into stack traces properly logged via the
logging system.
2009-03-24 18:49:03 +00:00
Par Winzell e62608a69f Let's make sure the overriding subclasses have something to override. Java 6 hid this from me. 2009-03-18 19:21:56 +00:00
Par Winzell fa7d2c0a7f 1) Broaden FullText to include ranking abilities along with matching, 2) Implement CASE WHEN ELSE END, 3) Let the people do 1 + 2 + 3 rathern 1 + (2 + 3), and so forth. 2009-03-18 19:01:20 +00:00
Michael Bayne 830e830100 Nixed these two updatePartial() convenience methods because they are
dangerous. The "key" (which identifies the rows you want to change) was
[ColumnExp, Comparable, ...] and the data that you would be changing was
[ColumnExp, Object]. So if you happened to pass a comparable object as the
first value you wanted to change, say:

updatePartial(FooRecord.class, FooRecord.FOO_ID, 5, FooRecord.BAR_ID, 6,
              FooRecord.BAZ, "biffle")

the compiler would think you wanted to use FOO_ID and BAR_ID as a key rather
than FOO_ID as a key and BAR_ID as something to be updated. Either way, it's
not clear what you want, so it should go. Now you have to create a Key():

updatePartial(new Key<FooRecord>(FooRecord.clsas, FooRecord.FOO_ID, 5,
                                 FooRecord.BAR_ID, 6),
              FooRecord.BAZ, "biffle")

or

updatePartial(new Key<FooRecord>(FooRecord.clsas, FooRecord.FOO_ID, 5),
              FooRecord.BAR_ID, 6, FooRecord.BAZ, "biffle")

None of our code was doing this anyway. We were already using Key everywhere or
the (Class, Comparable) method for records with a single column as primary key.
2009-03-10 23:30:36 +00:00
Michael Bayne a9dc596d3e Javadoc fixes, make deleteAll() do the right thing if you pass a KeySet into
the WhereClause-only version.
2009-03-03 23:40:55 +00:00
Par Winzell bb510ca506 Allow for distinguishing long-term caching from brief caching. For example, a public list of high scores may well lag 5 minutes behind database updates, whereas responses in a forum thread should perhaps never be more than 10 seconds out of date. The exact numbers are up to to the ehcache.xml configuration. 2009-02-06 16:09:10 +00:00
Michael Bayne ce03952b3c Javadoc fix, unused import nix. 2009-02-03 01:46:29 +00:00
Par Winzell db3dd861f4 Lose the spammy debug logging, collect some histogram information instead. These are not currently hooked up to Depot's Stat mechanism. 2009-02-02 18:14:26 +00:00
Par Winzell 3b65bc9b01 The 50 ms warning triggers every couple of thousand stores for a relatively large cache, usually with times in the 60-70 ms range which is certainly acceptable as long as they're that rare. Let's bump it to 100 ms since we're still on guard for gremlins. 2009-01-29 16:38:52 +00:00
Par Winzell efb2799167 Let's accept ColumnExp's or Strings for field identifiers and handle SQLExpression field values too. 2009-01-28 18:32:42 +00:00
Par Winzell 495399fc66 A little more information in our paranoid logging. 2009-01-28 05:54:23 +00:00
Par Winzell 4cab181df0 We'll use a ConcurrentHashMap for the bin, and then the enumerator will make a copy of it for returning. 2009-01-26 22:20:48 +00:00
Par Winzell 5a93e48e4d Oops. Let's actually wire these guys up... 2009-01-25 00:16:09 +00:00
Par Winzell bbcf7c8607 Don't try to build the old EHCacheAdapter either, if we don't have ehcache. 2009-01-24 23:26:46 +00:00
Par Winzell 9119cc9313 Update the test too. 2009-01-24 23:11:46 +00:00
Par Winzell 9e41b41994 Bring back the old EHCacheAdapter for transitional use until we can figure out what's up with the new one. Also, the enumeration API changed again. 2009-01-24 22:54:03 +00:00
Par Winzell 918405ec02 While investigating problems, add much paranoid profiling. Also let's do an explicit keyset copy during enumeration rather than the fancy concurrent hashmaps and iterable mappings. Finally, let's fully synchronize the other maps we're using. 2009-01-24 18:53:42 +00:00
Par Winzell db33c89b66 Get rid of some awful debug bits. 2009-01-23 19:51:12 +00:00
Par Winzell fc52b277a3 The CacheAdapter interface has changed:
* No more CacheBins, operations happen directly on the adapter.
 * Each cache write must supply a CacheCategory value that identifies its type. Current values are RECORD, KEYSET and RESULT. We will probably need a MISC or USER or something along those lines, too.

The EHCache adapter has been entirely rewritten:
 * Each CacheCategory maps to one EHCache, which means there are only a very few EHCaches, and we know what they are. We expect these to be declared in ehcache.xml rather than programmatically generated as before.
 * Elements inside each EHCache are indexed by (cacheId, elementKey) tuples.

The main purpose of this refactor is to sort all Records into a single EHCache, which we can then make really, really large, and then let the LRU mechanism sort out what should be in memory and what shouldn't. The previous implementation would make no ram allocation distinction between busy records and ones rarely read.
2009-01-23 16:12:11 +00:00
Par Winzell 07d848a3a0 Oops, we need to replicate what Depot does elsewhere to construct a database-unique identifier for the index. 2009-01-23 15:17:51 +00:00
Par Winzell c654606a2d Add a convenience migration for dropping indexes. 2009-01-23 15:05:08 +00:00
Par Winzell 0569f8f8ff The buildIndex() magic expects an array of colums, not a list. 2009-01-22 16:43:21 +00:00
Par Winzell 7dbc58d426 Function and Literal expressions can be non-deterministic but in most cases they are safe, and giving them proper toString()'s will help caching quite a bit. 2009-01-21 21:39:48 +00:00
Par Winzell 017d9242ac Better log message. 2009-01-12 15:13:34 +00:00
Par Winzell 062a8efcac Let the EHCache adapter be a little more configurable. 2009-01-10 01:47:11 +00:00