Commit Graph

431 Commits

Author SHA1 Message Date
Michael Bayne b029dfd6cd Javadoc and import cleanup. 2009-06-10 17:20:31 +00:00
Par Winzell fce2c05f9b So, milli/nano is 1E6, not 1E3, thanks Ray. 2009-06-03 18:49:45 +00:00
Michael Bayne bde9404ca5 Oh Java, I do wish that Map.get() took K not Object. 2009-05-29 23:43:50 +00:00
Michael Bayne 83a4149cbf Fix array indexing booches. 2009-05-29 23:15:04 +00:00
Michael Bayne 79c6f364fa Javadoc and variable naming improvements. 2009-05-29 22:24:58 +00:00
Michael Bayne a8da0d960f Those need to be Object because they could be (probably are in fact)
SQLExpression instances.
2009-05-29 22:16:37 +00:00
Michael Bayne c46741cbe2 Let's make the varargs version of updatePartial a little safer by requiring a
typed (ColumnExp, Comparable) as our first pair of arguments and only let you
get jiggy after that.
2009-05-29 22:14:19 +00:00
Michael Bayne 3062afe1b5 updateLiteral -> updatePartial. It's all partial updates now and you can either
pass in a map or use the varargs methods.
2009-05-29 21:54:12 +00:00
Michael Bayne 962a9cfb5a No String[]. Use ColumnExp[] all the way down. Now that things are getting
tidier, it's a shame that ColumnExp is named as it is because really it's a
FieldExp as it represents the name of the Java object field, not the actual
name of the column which may be something different (if you use
@Column(name="foo")). Maybe next time.
2009-05-29 21:40:17 +00:00
Michael Bayne 08122cda8b Nixed a bit more unneeded parameterized typing. 2009-05-29 21:04:26 +00:00
Michael Bayne cc961d14e2 Consolidated some duplicated update-related code in DepotMarshaller, nixed some
unneeded type parameterization.
2009-05-29 21:00:33 +00:00
Michael Bayne 04d7fedb92 Boop boop. Final methods with Comparable<?> nixed. The javadocs for
DepotRepository are looking positively svelt and comprehensible.
2009-05-29 19:12:44 +00:00
Michael Bayne 2b847056bf More strictness. Have to use a key to load individual records. Again this is
just as succinct, but type safer:

load(FooRecord.class, fooId) vs load(FooRecord.getKey(fooId))
2009-05-29 18:36:25 +00:00
Michael Bayne f052bba59d Nix obsolete cache documentation. The enum is pretty self documenting. 2009-05-29 00:13:07 +00:00
Michael Bayne 4b6dc9f5c7 Nix a bunch of untyped methods in favor of just a version that takes Key. It's
only one character more to type FooRecord.getKey(someId) than to type
FooRecord.class, someId and with the new Key.newKey() methods, you can also
create ad hoc keys briefly when needed.
2009-05-29 00:11:53 +00:00
Michael Bayne 1b6c3752df Helpy helper functions! 2009-05-28 22:55:23 +00:00
Michael Bayne bde87ac0e6 Added support for intervals which would almost be exactly the same except that
Postgres insists that you quote: interval '7 day' and MySQL insists that you
not quote: interval 7 day. Frawesome!
2009-05-28 22:53:30 +00:00
Michael Bayne 965cd7fd60 Unused import nixy. 2009-05-28 21:29:58 +00:00
Michael Bayne 5f6e4f80b4 We were one variation short. 2009-05-28 21:29:51 +00:00
Michael Bayne ed6eaae7b7 This is going to break everything, but I couldn't stand our operator inner
classes any more, so I promoted them all to standalone classes.
2009-05-27 23:30:19 +00:00
Michael Bayne 601b9eaba1 Sanity checking makes for more sanity. 2009-05-27 22:26:47 +00:00
Michael Bayne c8e5a3b413 Covariance here makes it easier to use ImmutableMap. 2009-05-27 17:35:04 +00:00
Michael Bayne a765645307 We don't really need to hear stats on shutdown. 2009-05-19 06:01:50 +00:00
Michael Bayne 636e2d7046 Factored out metadata handling into separate class. Modified repository
initialization to not hit the database at all in the up-to-date case (after a
single query to load the versions of all known records). This is about six
hundred fewer queries than we were doing on Whirled at server startup. To be
fair, they were pretty fast queries. :)
2009-05-19 05:30:47 +00:00
Michael Bayne 8b202f530e More fluency. 2009-05-11 19:30:25 +00:00
Michael Bayne dec7482c1b Using Timestamp as a primary key? omg cray-z. 2009-05-01 16:48:38 +00:00
Par Winzell 78c5a458de Get rid of one trailing space. :) 2009-04-29 18:56:05 +00:00
Par Winzell f8480b1f5b Update the copyright year. 2009-04-29 18:41:10 +00:00
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