20e06e9789
Ready my Transformer for prime time. There are some optimizations that could probably be made, but for now I defer to the new One Rule of Optimization: "Do not optimize for performance unless it does not weird the code or it Really Matters".
Ray Greenwell
2010-07-05 22:43:13 +00:00
2b71609148
I should change the name of this test...
Ray Greenwell
2010-07-05 22:36:18 +00:00
48279471e1
Updated tests.
Ray Greenwell
2010-07-05 22:34:15 +00:00
eef66bcaee
Changed my String[] Transformer: - continue to terminate Strings with a newline - turn newlines inside a String into "\n" - turn null elements into "\0".
Ray Greenwell
2010-07-05 22:10:56 +00:00
0e82904696
Provide the Transformer with the field's Type rather than it's Class. The Type contains generic type information which would allow a transformer to do the right thing with a field of, say, type Set<Integer>.
Michael Bayne
2010-07-05 21:43:10 +00:00
a5fee01354
Maybe I can generalize this into a rule: if either of operands 2 or 3 to the ternary operator are boolean constants, don't use the ternary operator.
Ray Greenwell
2010-07-05 21:32:28 +00:00
f2f995766b
A demonstration of the failing of the current String[] transformer. I'll do some more tests and nix this one today.
Ray Greenwell
2010-07-05 14:16:00 +00:00
ce1d06e82b
I was trying to be clever with newline and save a character, but I forgot about that cleverness in fromPersistent, so skip it for now.
Ray Greenwell
2010-07-02 03:56:26 +00:00
f4c7b7fef4
Better String[] Transformer, RFC.
Ray Greenwell
2010-07-02 03:49:43 +00:00
846ea920b6
Make the adapter configurable, as was always the intention.
Par Winzell
2010-07-01 17:15:32 +00:00
a0e8c602ed
Maintain correct record counts for cacheless finds.
Par Winzell
2010-06-24 18:15:40 +00:00
75a22f5584
Nix joiner.
Michael Bayne
2010-06-19 18:05:46 +00:00
728159dc48
Replace the CommaSeparatedString transformer with an escaping TabSeparatedString transformer. Maybe I should just use StringUtil methods...
Michael Bayne
2010-06-19 18:05:23 +00:00
f4cc4f2bee
Move the repository south to match AllTypesTest.
Michael Bayne
2010-06-19 17:52:52 +00:00
978bf81acb
Added support for boxed booleans. I have to admit that adding it to the test case, seeing it fail, then adding the code to handle it was rather satisfying.
Michael Bayne
2010-06-19 17:48:51 +00:00
9d9ba71c97
Import tidying.
Michael Bayne
2010-06-19 17:45:28 +00:00
d0dd828925
Comment our workarounds.
Michael Bayne
2010-06-19 17:44:55 +00:00
45ec7cf77c
Implemented the ColumnTyper interface for our various builders.
Michael Bayne
2010-06-19 17:41:10 +00:00
5587d134bd
Request the appropriate length for int arrays.
Michael Bayne
2010-06-19 17:40:03 +00:00
ff53b67e3d
Test that @Transform works in its various supported use cases, and fails as early as possible in situations where the developer is fucking up.
Michael Bayne
2010-06-19 17:36:04 +00:00
7f9bf7b589
Determined that we need to pass the field type into the fromPersistent() to support use cases like ByteEnum. (Even though I'm leaving ByteEnum support hard-coded for the time being.)
Michael Bayne
2010-06-19 17:35:05 +00:00
1d9a19e502
Unit tests for all supported field types (including null versions).
Michael Bayne
2010-06-19 17:34:21 +00:00
06c36fbed2
- Added support for @Transform annotation. - Revamped column type determination to use a mechanism that supports delegation and does not rely on a heap of instanceof calls (which results in runtime failure rather than compile time failure when a new column type is added) - Discovered that HSQLDB (at least) does not handle Byte, Short and Float correctly. It returns them as Integer, Integer and Double respectively, which then causes failure when trying to write those values back to the fields. We work around this by converting non-null results to the correct type after we get them back from the JDBC driver.
Michael Bayne
2010-06-19 17:33:55 +00:00
a4e7f3fb47
Make "ant -Ddebug=true tests" run the tests with SQL debugging on.
Michael Bayne
2010-06-18 23:49:32 +00:00
6fd404587f
Allow a specific test to be run with "ant -Dtest=Foo tests".
Michael Bayne
2010-06-18 23:12:27 +00:00
5e77d29c47
Test good and bad byte enum marshaller creation.
Michael Bayne
2010-06-18 22:49:02 +00:00
0950fdd4ea
Transformers: more than meets the eye.
Michael Bayne
2010-06-17 19:11:35 +00:00
f722d1b2df
There must be a way to have svn magically put in the current year.
Michael Bayne
2010-06-17 19:05:21 +00:00
2125367297
Automatically handle changes to primary key by dropping the old one (which triggers the creation of the new one).
Par Winzell
2010-05-06 14:38:52 +00:00
f54c74e385
Abstract records should never be directly referenced; fail as early as possible and explain what's going on.
Par Winzell
2010-05-06 14:37:18 +00:00
743ca150cf
Patch from Jamie Doornbos: update Eclipse file to match the move to guava, in r600.
Ray Greenwell
2010-04-16 16:40:29 +00:00
70a16d64ad
Back to the freakoutery. Nathan's going to use the existing (if somewhat verbose) mechanisms to accomodate his needs. We freak out as early as possible to save the developer a time wasting debugging session in situations where they update only one or the other of the persistent and runtime class, or make a typo, or get the types wrong, etc.
Michael Bayne
2010-04-10 00:28:26 +00:00
a23cb7e4d8
Patch from Nathan Curtis: gracefully ignore any field contained in the runtime class that's not in the persistent class.
Ray Greenwell
2010-04-09 20:38:33 +00:00
26ece1f2c0
Ray points out these should be FluentExp's.
Par Winzell
2010-04-07 18:34:23 +00:00
31f5d593e5
Move in() and like() into FluentExp (they can certainly operate on an expression), and add notLike() variants.
Par Winzell
2010-04-07 16:24:18 +00:00
40d596509d
Added a note about the @Generated annotation, which we're declining to use.
Ray Greenwell
2010-03-30 20:07:07 +00:00
704476323e
Faster Key construction via the generated getKey() factory.
Ray Greenwell
2010-03-24 19:51:56 +00:00
55b0d2e3ea
Behold, the power of Guava.
Michael Bayne
2010-03-16 23:56:30 +00:00
8b871dcf19
Look ma, unit tests that run against HSQLDB.
Michael Bayne
2010-03-16 04:57:52 +00:00
aae3d909a2
Via Charlie Groves, some bits that Eclipse noticed.
Ray Greenwell
2010-03-04 21:41:32 +00:00
1e2f88ac77
Factor out the canonical order generation as we'll still need this for the static newKey() methods even if we revamp this whole business.
Michael Bayne
2010-03-04 07:01:49 +00:00
21132b4edb
Be stricter about our primary key requirements here.
Michael Bayne
2010-03-04 07:01:07 +00:00
a970856aae
Well, we can at least write a unit test for this super special business.
Michael Bayne
2010-03-04 02:57:49 +00:00
c017ec5bd1
Provide a fast path for key construction in the rather common case of a non-composite key (where ordering cannot be a problem). Boy I really wish I had unit tests...
Michael Bayne
2010-03-04 02:45:42 +00:00
57e3cce8d0
Return this until/unless I tackle field sorting.
Ray Greenwell
2010-03-03 17:04:16 +00:00
37c348a305
I might get my head chopped off for this one, but presumably the generated Key construction code "knows what it's doing" and can call the optimized Key constructor. We can rollback if I'm missing something.
Ray Greenwell
2010-03-03 03:59:02 +00:00
96e858070a
This static shared map should really be a ConcurrentMap.
Ray Greenwell
2010-03-03 03:57:54 +00:00
93d90083a1
Use single quotes around the truncation parameter. (Assume future enums in DateTruncate will correspond to the postgres args).
Ray Greenwell
2010-03-02 21:36:29 +00:00
cb86b6def4
If we're shadowing a field, let's try using the shadowed column's name.
Andrzej Kapolka
2010-03-02 21:30:20 +00:00
42d99f90ca
Some language about the proper usage of Sequence.
Ray Greenwell
2010-02-25 23:17:06 +00:00
0b51d1e62f
Formatting.
Ray Greenwell
2010-02-25 22:35:15 +00:00
4b1ffe3df9
We need to specify that we want to call the varargs version, not the Iterables version. Screw Java.
Par Winzell
2010-02-25 18:48:54 +00:00
6930ed5b40
Bring back this test: WithKeys's constructor begins with iterator().next().getClass() and it's not obvious to me that it can made to elegantly not knowing that class.
Par Winzell
2010-02-25 18:48:24 +00:00
0b8be77564
Unused import.
Par Winzell
2010-02-25 18:47:17 +00:00
aa4ac73e5d
Fixed some javadoc bugs.
Michael Bayne
2010-02-25 06:52:07 +00:00
b5e7ba8642
Whitespace patrol.
Michael Bayne
2010-02-25 06:49:07 +00:00
b8d957ce4c
Accept Iterable rather than Collection everywhere we reasonably can.
Michael Bayne
2010-02-25 06:48:27 +00:00
950653960b
Separate SeqImpl out of Sequence, hiding it away in our impl package tree. Make Sequence an interface.
Michael Bayne
2010-02-25 06:30:12 +00:00
503f3893cb
XList is now an ex-List.
Ray Greenwell
2010-02-25 06:12:22 +00:00
e972ebc72b
Added toSet().
Ray Greenwell
2010-02-24 22:01:25 +00:00
6255819745
Twice now I've blown this comment.
Ray Greenwell
2010-02-24 17:34:03 +00:00
17a6cb3332
Comment pedantry. Considered adding a note that toArray() is generally not safe, but the Collections run through here in normal depot usage will be safe to use. Check out the implementation of AbstractCollection's toArray(T[]).
Ray Greenwell
2010-02-24 02:07:36 +00:00
9444cad7d8
Check our preconditions for fast failure, and added toArray().
Ray Greenwell
2010-02-23 22:27:30 +00:00
e251cd9944
This guy needs also to be marked deprecated to let the compiler know that I know that it's implementing a deprecated interface method.
Michael Bayne
2010-02-23 08:54:54 +00:00
54b7bf9e99
Bring on the deprecation warnings.
Michael Bayne
2010-02-23 08:47:46 +00:00
b022382231
XList is going away. To be replaced with this, still somewhat out of place in a database library but at least slightly more ignorable, bit of functional helpfulness.
Michael Bayne
2010-02-23 08:35:30 +00:00
152ff056d9
Charlie has convinced me that the database manipulation operations should be public and I should not force everyone who wants to use Depot to route all database accesses through custom public methods that hide all of the underlying Depot business behind application specific APIs.
Michael Bayne
2010-02-23 07:30:58 +00:00
1fe2c451f8
Both In() and IsNull() will work on general expressions, not just columns.
Par Winzell
2010-02-22 18:58:57 +00:00
cdeb8eac8a
Fail with a useful error message any time a migration tries to reference a non-existent field.
Michael Bayne
2010-02-10 16:47:31 +00:00
9661056e10
Be more flexible: follow the "PECS" rule for our Function.
Ray Greenwell
2010-02-05 02:33:57 +00:00
4fca0623dd
Ray's patch to fix empty table insertion.
Andrzej Kapolka
2010-02-03 20:36:16 +00:00
94d381b8cc
It's convenient when the toString()'d values are valid SQL.
Par Winzell
2010-01-27 17:09:41 +00:00
d079445420
I'm not sure why I thought this was a good idea last night, even temporarily for testing, but it's certainly not anymore.
Par Winzell
2010-01-27 17:08:12 +00:00
f0c8d185f0
With last night's patch to MultiKeySet, we'll be using a lot more IN() statements, and some of them contain shorts and bytes. Handle it.
Par Winzell
2010-01-27 15:21:57 +00:00
c8eb3be297
An ancient TODO entry, now with a checkbox next to it. The way we load records (by loading keys first, then the records by key) has hitherto created really cumbersome expressions when the records in question have multi-column keys. We'd get basically SELECT * from FOO where (A = 1 and B = 'x') or (A = 1 and B = 'y') or ... and so forth, for another 30,000 arguments. This happens constantly, and we're not sure we want to trust PostgreSQL to always be handling such a flagrantly suboptimal structure elegantly. So, we now optimize it ourselves. When possible, turn constructions like the previous into where (A = 1 and B in ('x', 'y', ...)). This code has not been tested against serious amounts of data, so I am doing a sneaky midnight commit to easily test on Whirled Dev.
Par Winzell
2010-01-27 07:39:43 +00:00
784d3c18ca
Typo fix, TODO note.
Par Winzell
2009-12-10 15:48:54 +00:00
4c21819f22
Adapt to the new google-collect jar. Thanks Charlie.
Par Winzell
2009-11-11 20:41:31 +00:00
6d745b4247
Roll back Charlie's constructor patch. It's an admirable idea but it just adds too much unwieldy boilerplate to large records, and neither of us like the idea of on/off switches. We'll just have to construct by hand.
Par Winzell
2009-10-29 17:38:47 +00:00
116679ebfe
Get rid of @Column(type=...) which was always an abomination.
Par Winzell
2009-10-29 16:33:34 +00:00
4e390ecb0e
Charlie's patch to generate field-instantiating constructors for records that do not have existing (non-generated) constructors. Generated, nullable or default-value'd fields are ignored by the constructor.
Par Winzell
2009-10-26 15:30:53 +00:00
4b43b7d099
We'd accidentally conflated SQL expressions and SQL clauses into the one interface SQLExpressionsf, which would allow statements like 'FooRecord.BAR.add(FooRecord.getKey(1))' to compile erroneously. Let SQLExpressions and QueryClauses both be subclasses of a new type SQLFragment, and let our ExpressionVisitor be a FragmentVisitor.
Par Winzell
2009-10-23 13:59:47 +00:00
8f25455481
More convenient multi-column indexing! From Charlie.
Par Winzell
2009-10-15 16:21:14 +00:00
27b7790275
Remove some superfluous bits. From Charlie.
Par Winzell
2009-10-15 16:20:55 +00:00
9c0c3be37b
Aii, ColumnDefinition.defaultValue is null when it's unset, unlike the annotation.
Par Winzell
2009-09-29 20:10:07 +00:00
d3e10710d2
Whitespace tweak.
Par Winzell
2009-09-25 00:47:33 +00:00
e2d4269516
Patch from Nathan to support longs.
Andrzej Kapolka
2009-09-25 00:41:18 +00:00
4a552b29bc
Let's not run this MySQL atrocity unless absolutely necessary.
Par Winzell
2009-09-22 21:33:42 +00:00
681f420b8f
Patch from Charlie to always commit if auto-commit is off.
Michael Bayne
2009-09-22 01:54:38 +00:00
04dc2daa8b
More Galileo hygiene.
Michael Bayne
2009-09-15 04:53:50 +00:00
6a4c14b1eb
Some Galileo inspired raw type elimination.
Michael Bayne
2009-09-14 22:18:09 +00:00
95e4e2d7da
Javadoc cleanup and improvements.
Michael Bayne
2009-09-13 03:05:37 +00:00
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.
Michael Bayne
2009-09-10 19:01:57 +00:00
b331be7ed8
While we're fooling around (and since we've been Calendar maniacs lately), let's name these DateFuncs nicely.
Michael Bayne
2009-09-10 19:00:16 +00:00
b49150a0ae
Nix the examples.
Michael Bayne
2009-09-10 18:50:56 +00:00
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.
Michael Bayne
2009-09-10 18:50:37 +00:00
e37c18ca50
Missed some rather important bits in the last commit.
Par Winzell
2009-09-10 16:59:33 +00:00
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.
Par Winzell
2009-09-10 15:26:54 +00:00
8a57bd2461
SQLOperator gets the axe.
Michael Bayne
2009-09-10 03:44:00 +00:00
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.
Michael Bayne
2009-09-10 03:41:30 +00:00
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.
Michael Bayne
2009-09-10 03:35:03 +00:00