Commit Graph

799 Commits

Author SHA1 Message Date
Michael Bayne d5b06f23e2 Fixed javadoc classpath, samskivert apidocs URL. 2011-06-27 21:07:51 +00:00
Charlie Groves b6942ec74a Remove and ignore Eclipse files in favor of letting people generate their own using m2eclipse 2011-06-27 20:51:07 +00:00
Ray Greenwell c26d9b29fb Had this laying around...
- Added an IntegerIterable Transformer.
- Document that these *Iterable transformers work with List/Set/Collection...
  In case it wasn't clear.
- Added a sizeHint argument to the createCollectionBuilder method, take
  advantage of that in the IntegerIterable since we don't need to do any
  work to find the size.
2011-06-24 20:17:02 +00:00
Charlie Groves d5eb7cf3ff Bump to ooo-build 2.5 since the maven-ant-tasks jar 2.1 uses is no longer available 2011-06-24 20:11:48 +00:00
Charlie Groves cef1461109 Warning cleanup 2011-06-24 19:47:18 +00:00
Charlie Groves 7ba475e61c Use default values for the values section of an insert statement for hsqldb as well as postgres
It blows up expecting a column name in the values parenthesis, but the default values string that
postgres was working seems to work. It's not in http://hsqldb.org/doc/guide/ch09.html, but so it
goes.
2011-06-24 19:25:57 +00:00
Charlie Groves a28990116c Some test cleanup from Eclipse 2011-06-24 19:22:24 +00:00
Michael Bayne e3ff96745d Added support for limit to deleteAll.
I would have prefered to only add this support to the Query interface, and not
clutter up DepotRepository with two additional overloaded methods. However,
that would not have been possible without duplicating a bunch of logic from
DepotRepository. Yet another reason why the Query builder approach is awesome
and the fuckloads of overloaded methods approach isn't.
2011-06-23 22:12:47 +00:00
Dave Hoover ee93f91e61 Preparing for depot-1.5-SNAPSHOT development. 2011-05-24 20:57:26 +00:00
Dave Hoover 6c47a9c4ac Preparing for 1.4 release. 2011-05-24 20:50:06 +00:00
Ray Greenwell eb6d48d054 Changed selectCount() to not alter the state of the Query,
so that I can select a count of matching rows and then go on
to add an ordering and limit and select a particular page of results.
2011-05-13 16:43:31 +00:00
Andrzej Kapolka 5d9a584e4c Because MySQL can't abide parentheses around its intervals, let's put
them around the entire expression rather than around the operands
(which matches the behavior of the binary operator method).
2011-05-12 01:48:24 +00:00
Michael Bayne 607f63a7a1 Fixed a problem where the Postgres JDBC driver would call toString() on an
enum, when we need it to be using name() instead. We just take care to send it
the results of name() instead of the enum value itself.

It would be nice to share this code with BuildVisitor.bindValue, but that would
require yet further twisting and factoring of the code, obscuring it even more.
We'll just hope that special cases like Enum and ByteEnum aren't going to keep
cropping up.
2011-05-05 19:02:38 +00:00
Michael Bayne fe028a1e42 Override toString in the enum we use for testing, to be sure we don't rely on
it in our internals. We actually do use the toString value, but only in
constructing the cache key for a query, which should generally not result in
badness, unless you override your enums to not return unique strings for
different enum values.

It's looking like the Postgres4 driver calls createArray with an Object[] full
of enums, and it calls toString on the values in the array. I have an idea for
how to fix that, which is coming up next.
2011-05-05 18:56:39 +00:00
Michael Bayne 4c1864ddd6 This is exactly the sort of place where it's useful to *not* turn a complex
value into a string and then throw it away when doing debug logging.
2011-05-05 18:56:33 +00:00
Michael Bayne e53288b7c4 Compactified header, extracted copyright and license bits into LICENSE. 2011-05-05 18:35:14 +00:00
Michael Bayne 72c4782b3c We need to quote identifiers in MySQL so that we can handle columns with names
like group.
2011-05-04 18:40:24 +00:00
Michael Bayne fd4be08c78 None would be best in this case. 2011-04-30 23:21:35 +00:00
Andrzej Kapolka 531b9a3234 Some changes to allow the ability to subclass the stats class and
record more extensive, per-table stats.
2011-04-01 04:44:04 +00:00
Charlie Groves e41e3c9961 Match the SQLBuilder changes in HSQLBuilder to fix the build 2011-03-29 19:36:35 +00:00
Ray Greenwell 903bb5181b From Mark Johnson: support long autogenerated fields. 2011-03-29 03:42:24 +00:00
Ray Greenwell 07e5b934b5 Patch from Mark Johnson: support long[] field types. 2011-03-29 01:52:59 +00:00
Charlie Groves 1f7263c6fa Preparing for 1.4-SNAPSHOT development. 2011-03-23 22:19:01 +00:00
Charlie Groves 19d9821f66 Preparing for 1.3 release. 2011-03-23 22:16:54 +00:00
Charlie Groves cd9854a8ca Ignore dist and target 2011-03-23 22:16:37 +00:00
Charlie Groves 8d56a93538 Meh, I was wrong in r841. Because the target version is 1.6, anything that tries to build against
depot with a 1.5 compiler is going to blow up with a mismatched version. Go back to 1.5 in build.xml
and pom.xml, but leave Eclipse using a 1.6 JVM. This means if anyone regenerates the m2eclipse
configuration, this will break in Eclipse again. Lame.
2011-03-23 22:09:29 +00:00
Charlie Groves 7129295906 Updates from running genrecord 2011-03-23 20:42:45 +00:00
Charlie Groves 1a2967b31f yohoho no longer cares if depot is built with 1.6, so build with that since we're using 1.6's Connection.createArrayOf in PostgreSQL4Builder. Sneak a ooo-buildification in with the compiler version bump. 2011-03-23 20:42:00 +00:00
Charlie Groves 1be9961245 Crap, missed a few 2011-03-23 01:44:48 +00:00
Charlie Groves 2dbfaa0ee6 Remove an @Override from an interface as that isn't 1.5 compatible, and remove some unused imports 2011-03-23 01:43:52 +00:00
Michael Bayne ad4f2c9970 Changed expressions that deal with count() results to Number because Postgres
in its burning desire to support the amazing four hundred billion rows, returns
a Long for count expressions.

Clients using selectCount() won't be impacted, but clients doing more complex
counting are going to have to sprinkle in some .intValue() calls.
2011-02-28 22:58:38 +00:00
Michael Bayne 677de3da03 Added notNull() at Ray's request. 2011-02-28 19:12:52 +00:00
Andrzej Kapolka 89927523bc Let byte enum columns be nullable. 2011-02-21 20:58:34 +00:00
Michael Bayne 86476b4494 Now that we accept a list of SQL statements to be executed individually (and
committed after each statement), I no longer need to manually handle table
population.
2011-02-18 18:25:34 +00:00
Michael Bayne 687de42168 Added needed import. 2011-02-18 18:24:40 +00:00
Michael Bayne 8499fc1c06 Implemented a framework for testing database migrations. Unfortunately, I am
not filled with ideas on how to programmatically verify that the primary key
migration I've just created a test for is actually working. I can visually
inspect the logging output, but that's not useful for catching potential future
regressions.
2011-02-18 01:53:38 +00:00
Michael Bayne 62fb0eac99 Allow a name and a series of initialization statements to be provided when
creating a persistence context.
2011-02-18 01:53:30 +00:00
Michael Bayne 2565a292d1 Have the trivial fetcher do no stats updating by default. 2011-02-18 01:53:23 +00:00
Michael Bayne e59b20dd56 Report the pkName in both cases, and do so using valid Java code. 2011-02-18 00:40:48 +00:00
Michael Bayne adf914e156 Wired up handling of primary key changes (with some reorganization of a patch
from Nathan). If we need to add our primary key, we do so, if we need to remove
it, we do so, and only then do we consider whether we need to migrate it (in
which case we drop and re-add it).
2011-02-18 00:35:58 +00:00
Michael Bayne 8670d0e109 Support creation of arrays of stock enum values (which are turned into
strings). From Jamie.
2011-02-16 02:13:35 +00:00
Par Winzell 10e97b55c9 PostgreSQL gets very confused when date_part() is used in a GROUP BY and the part bit isn't a constant. It doesn't recognize the selected values as being identical to the grouped-by values, and throws an error. So we use a literal here. 2011-02-15 23:21:11 +00:00
Michael Bayne 6603fb7d81 Patches from Jamie:
1. DateFuncs.dayOfWeek and dayOfMonth can now be used on Timestamp. +FromDate
variants exist for using on Date.

2. hour, minute, second, etc. are now typed Number to cope with differing
opinions on the part of the underlying SQL drivers as to whether to return
Double, Long, Integer or something else.
2011-02-15 22:20:53 +00:00
Michael Bayne 51aa221606 Use the platform's line separator when generating code from templates. This
assumes that the depot.jar in question was created on a LF-only platform, but
that's probably a safe bet.
2011-02-12 00:26:56 +00:00
Ray Greenwell d59717d025 No longer lazily initialized. 2011-02-10 17:28:39 +00:00
Par Winzell 5c52a84916 I can think of no reason why this was ever allowed to be null. 2011-02-10 17:21:06 +00:00
Michael Bayne b8fec6cab5 Fixed a problem with binding transformed values in updatePartial.
When we go to bind values in an update statement, we either have:

- field names and a pojo from which to extract them, in which case
  transformation happens naturally when we extract the current value from the
  pojo

- value expressions (like 1, or "bob") which we were previously just binding
  directly to the statement, which was wrong because they need to first be
  transformed in the case where the field in question has an @Transform
  annotation; now we get the field marshaller for the field in question and
  pass the raw value to it, so that it can do the necessary transformations in
  writeToStatement()

- other expressions (like LiteralExp("true") or or IntervalExp or anything else
  where the database is involved in computing the final value to be assigned to
  the column).

This last case still holds the potential for badness with regard to transformed
fields. We can't magically transform the value to be stored into a field if the
database is computing the ultimate value. Say, for a contrived example, that
you had a record where you stored an int column as a String for shits and
giggles:

public class MyRecord {
    @Transform(IntToStringTransformer.class)
    public int someValue;
}

someValue will be a string column in the database, owing to the
IntToStringTransformer converting the int to a String.

Now you come along and think to yourself, "Hey, I want to store the current
minute in my  'int' field." and you write something like:

updatePartial(MyRecord.class, MyRecord.SOME_VALUE,
    DateFuncs.minute(Exps.literal(new Timestamp(System.currentTimeMillis()))));

Well, that's going to end up trying to stuff an int-valued expression (computed
by the database) into a String field, and the shit will hit the fan.

I can't really think of a non-contrived situation where this is likely to bite
us in the ass, but I don't especially like grass covered pits like this lying
around, waiting for someone to unsuspectingly step into them.

I could fail if you try to update a transformed field with anything other than
a ValueExp (or the current value from a pojo), but that would prevent you from
doing something potentially useful and safe like copying one field to another,
which both use the same transformation.
2011-02-05 00:22:53 +00:00
Michael Bayne 9aba944105 Clean up after ourselves. 2011-02-04 18:16:22 +00:00
Michael Bayne 6c9d372510 Removed a final annotation that I had slipped in for testing. 2011-02-04 18:14:45 +00:00
Michael Bayne 71d3577074 Ur doin it wrong. The transforming field marshaller needs to operate on F (the
non-persistent type), and transform in getFromSet/writeToStatement, rather than
operate on T (the persistent type) and transform in
getFromObject/writeToObject.

This makes the newly added test in TransformTest work, rather than fail, as it
did previously.
2011-02-04 18:14:15 +00:00