Commit Graph

515 Commits

Author SHA1 Message Date
Michael Bayne 6a4c14b1eb Some Galileo inspired raw type elimination. 2009-09-14 22:18:09 +00:00
Michael Bayne 95e4e2d7da Javadoc cleanup and improvements. 2009-09-13 03:05:37 +00:00
Michael Bayne d20d518b8e Sometimes specifying the enclosing class is informative and useful other times
(much less frequently) it is too verbose. Here I want to be informed.
2009-09-10 19:01:57 +00:00
Michael Bayne b331be7ed8 While we're fooling around (and since we've been Calendar maniacs lately),
let's name these DateFuncs nicely.
2009-09-10 19:00:16 +00:00
Michael Bayne b49150a0ae Nix the examples. 2009-09-10 18:50:56 +00:00
Michael Bayne 14fffdeb3a Split the functions into multiple files as there are a zillion of them and it's
useful clarification to see MathFuncs.trunc() versus DateFuncs.truncToDay(),
for example.
2009-09-10 18:50:37 +00:00
Par Winzell e37c18ca50 Missed some rather important bits in the last commit. 2009-09-10 16:59:33 +00:00
Par Winzell aa29b143af Depot's caching strategy relies on every clause and all its subexpressions constructing deterministic toString()'s. We do it by requesting that each function implementation returns an identifying string. We could use StringUtil.shortClassName() as things stand now, but I think perhaps MDB wants to get rid of the named classes. 2009-09-10 15:26:54 +00:00
Michael Bayne 8a57bd2461 SQLOperator gets the axe. 2009-09-10 03:44:00 +00:00
Michael Bayne 02cccbc0ea I'm not going all the way down this path today, but now that we've hidden the
implementation of operators and expressions, we can go the whole nine yards and
eliminate the named classes entirely (except in cases where we need them for
multiple dispatch by the visitors). Demonstrated this neatness with And and Or.
2009-09-10 03:41:30 +00:00
Michael Bayne ff250b2edd Extracted BinaryOperator and MultiOperator into top-level classes in
preparation for possibly nixing SQLOperator, which appears to me to be unused
if not unnecessary.
2009-09-10 03:35:03 +00:00
Michael Bayne 03008f6168 This package no longer needed. Want operator to go away too... 2009-09-10 03:24:29 +00:00
Michael Bayne 4d322fb732 Jihad complete, operators hidden behind the impl veil. 2009-09-10 03:22:34 +00:00
Michael Bayne 3c5b35612c We're having an existential crisis. There are two exists() methods. 2009-09-10 03:15:37 +00:00
Michael Bayne ee1ced3f30 Added Ops.exists(). 2009-09-10 03:05:34 +00:00
Michael Bayne 7a350474f5 Added exists() as well as a static add() and mul() for times when it seems
weird to use those fluently. Might also add div() and sub() but I'm currently
wondering why those have varags constructors Div(SQLExpression... values). What
does foo / bar / baz mean exactly? That's a rhetorical question, division is
left associative, but it's still weird and too non-obvious IMO. foo - bar - baz
is also wonky.
2009-09-10 02:56:21 +00:00
Michael Bayne a6c113e490 Added Ops.like(). 2009-09-10 02:38:58 +00:00
Michael Bayne 89a15571ed Another spot where we need to return non-specific types. 2009-09-10 02:23:24 +00:00
Michael Bayne a5face282b Well, OK. We're going to take the pain and break binary compatibility and use
thsi opportunity to move a whole heap of stuff into impl that doesn't really
need to be visible to external parties. We're changing the return value of all
expression creating factory classes to SQLExpression or FluentExp because those
expose all the functionality one might need on the returned values and there's
otherwise no value to be had getting an And() or a LiteralExp() and a downside
of preventing us from replacing the implementation of those expressions without
breaking binary compatibility.

I hemmed a bit about everything in depot.operator. In theory everything there
is available via a combination of Exps and FluentExp but in practice Whirled
uses a ton of those classes directly (whre a ton is defined as 64 imports of
classes in depot.operator). Perhaps I'll go on a cleanup jihad there and then
move all that to impl as well.

The rabbit holes, they always go deep.
2009-09-10 02:18:38 +00:00
Michael Bayne cf49fbbc9a Let's switch these to less specific return types before they end up out in the
wild.
2009-09-10 00:59:15 +00:00
Michael Bayne 0326468e8e These need to return FunctionExp to be binary compatible. Let this be a
reminder why it can be useful not to return the most specific type possible
from a method, but rather a more general supertype that allows us to change the
internals of the method without losing binary compatibility.
2009-09-10 00:52:23 +00:00
Michael Bayne fce9e56aca Provide these as deprecated for a short while to preserve binary compatibility
for Samsara apps.
2009-09-10 00:34:08 +00:00
Par Winzell 47e6f6f552 Now that we have explicit Ln() and Log10(), let's get rid of the hopelessly esoteric arbitrary-base Log(). 2009-09-09 20:57:08 +00:00
Par Winzell 14c1bdd860 Call the convenience collection Funcs, not Funs. 2009-09-09 20:02:51 +00:00
Par Winzell 92fd3054ca Handle the new Log10 class. 2009-09-09 19:57:58 +00:00
Par Winzell 2ae7d6146b Unintentional commit. 2009-09-09 19:56:11 +00:00
Par Winzell 12fabe42f7 Actually, that can't happen, so let's handle it more gracelessly. 2009-09-09 19:55:43 +00:00
Par Winzell 27dcb0e753 Eclipse-warning tweaks from Charlie. 2009-09-09 19:52:56 +00:00
Par Winzell 9c68929213 It turns out PostgreSQL supports LN(exp) and LOG(exp) in double precision, but not LOG(base, exp). So we're adding an explicit LOG10. I wonder how useful the two-argument one is... maybe we should delete it. 2009-09-09 19:51:33 +00:00
Par Winzell 32bccc3dd7 Deprecate FunctionExp in favour of explicit support for many common SQL functions, whose convenience factory methods reside in com.samskivert.depot.Funs. The EpochSeconds class is also deprecated in favour of Funs.dateEpoch(). 2009-09-09 14:39:55 +00:00
Par Winzell f871b08383 Tiny typo. 2009-09-04 21:36:34 +00:00
Par Winzell 3032a1e568 Connection.isClosed() is new in 1.6 and Connection.close() is a no-op if the connection is already closed, so let's go for brevity here and save people from having to have 1.6-specific JDBC drivers. 2009-09-04 19:06:25 +00:00
Michael Bayne 82d742ec09 A (slightly modified) patch from Charlie to use the magical statement
collecting Connection to automatically close all statements created during the
course of our operations.
2009-09-04 17:37:57 +00:00
Par Winzell 52a9c2036f Charlie's commit patch; if we're not in the auto-commit state, let Depot explicitly commit its operations. If we add transaction awareness to Depot in some future, this behaviour might become more subtle. 2009-09-03 22:12:44 +00:00
Michael Bayne f9eb364c7f Formatting tidying. 2009-08-21 01:50:21 +00:00
Michael Bayne 157d339906 Provide a generic key element extraction higher-order function that works for
any element type at any index.
2009-08-20 01:07:57 +00:00
Michael Bayne b43ca1e203 We no longer need to export a GWT jar file. 2009-08-18 22:07:07 +00:00
Michael Bayne 928926d5e1 Use ByteEnum from samskivert. This is going to break a bunch of stuff which Ray
or I will fix. Whee!
2009-08-18 22:04:04 +00:00
Michael Bayne c6ae109f19 Some code hygeine from Charlie. 2009-08-17 21:06:57 +00:00
Michael Bayne 4a48875b7f Nixed unused imports, unneeded cast. 2009-08-17 07:32:34 +00:00
Michael Bayne 1f0c33eacf Improved error message. 2009-08-07 03:11:37 +00:00
Michael Bayne 363614dff5 Zell may want to refute that this is a good idea, but if I try to order by a
computed field in a computed record, Depot freaks out because it doesn't know
what table the computed field comes from when it doesn't come from any table.

So clearly this is what we want to achieve that functionality, but what I'm not
100% sure about is what ass biting we're opening ourselves up to here by not
freaking out in this case. We may be taking a step backwards in terms of useful
error reporting if someone does something stupid with computed fields. But
we'll just have to see what those errors are when they crop up. If the database
can't figure out what we're talking about with the unqualified field name, it
too will freak out.
2009-08-07 02:49:20 +00:00
Michael Bayne 37295dbcb3 Added Exps.count() and Exps.countDistinct() and the necessary plumbing to sneak
a 'distinct' into the argument list of the count() invocation.
2009-08-07 01:58:58 +00:00
Michael Bayne a52abcc7b2 Allow FieldOverride to be constructed with a ColumnExp. 2009-08-07 01:36:40 +00:00
Michael Bayne 0c7a8a5f01 Added sum() and abs(). 2009-08-07 01:24:10 +00:00
Michael Bayne 2ee38910c6 Allow a Key<T> to be invalidated directly and create the KeyCacheKey for the
caller.
2009-07-30 23:23:18 +00:00
Michael Bayne e876ff0832 Step one in making Depot's caching classloader friendly: make the keys use only
system classes (not 100% done, if you use a ByteEnum in a key right now it
doesn't do the right thing). Also moved SimpleCacheKey into impl because it's
an implementation detail, not meant to be used by external parties.
2009-07-30 22:06:18 +00:00
Par Winzell c0b031a36d Remove unused imports. 2009-07-28 16:11:53 +00:00
Michael Bayne a64f465990 We need these codes to be consistent across VMs in the cache network. 2009-07-17 22:21:11 +00:00
Michael Bayne 05c9e52bfb Revamp of cache management. We need our cache adapter to create our caches for
us so that if we use multiple PersistenceContexts in the same VM they don't all
point to the same cache buckets which causes badness. At some point we'll
probably have to make it easier to customize these configurations, but this
should work for now.
2009-07-17 22:11:06 +00:00