Commit Graph

1800 Commits

Author SHA1 Message Date
mdb 87753db18a Added batchQuery().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1852 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-08 21:32:58 +00:00
mdb 0b81f21eea A patch from MikeT to support sending more complex (mime) messages.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1851 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-05 00:45:46 +00:00
mdb 6fc0cf2db0 Cope with very large numbers. Consider that:
int low = Integer.MAX_VALUE - 2;   // = 2147483645
  int high = Integer.MAX_VALUE;      // = 2147483647
  int mid1 = (low + high) / 2;       // = -2
  int mid2 = low + (high - low) / 2; // = 2147483646
  int mid3 = (low + high) >> 1;      // = -2        
  int mid4 = (low + high) >>> 1;     // = 2147483646

So we'll use the last one (non-sign-propagating shift) as it is likely to be
fastest and clearest.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1850 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-05 00:13:00 +00:00
mdb 1412f7c5e7 Type-safety patrol!
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1849 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-31 04:30:41 +00:00
ray a1774e073d Following mike's example, let's put the @SuppressWarnings on the same
line as the thing we're suppressing, to more closely couple them.
Also, removed one hanging on a method by using a temporary variable within.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1848 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-31 03:24:35 +00:00
ray e394ddd5a5 Now that we support jdk 1.5, use the T.valueOf() factory methods where T
is Boolean, Byte, Short, Character, Integer, Long, Float, or Double.

This has always made sense for Boolean, but with 1.5 they added these
methods everywhere and they are the preferred method for obtaining an
instance of any of those classes unless you absolutely want different
object references.

Since many Integer objects have a low value, the small bit of overhead
incurred for calling these methods should more than make up for itself
in saved memory and garbage collection time.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1847 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-24 01:18:50 +00:00
mdb f2f1d8e62f Added a handy class for caching things for a spell.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1846 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-20 22:36:17 +00:00
mdb 49cffb85b2 More type safety goodness. It all compiles with no warnings now. Yay!
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1845 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 17:54:07 +00:00
mdb 9e898c84a3 More type safety goodness.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1844 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 01:27:36 +00:00
ray 93196c5045 Reverted to using an array for our buckets.
Use the @SuppressWarnings annotation with surgical precision.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1843 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 01:18:38 +00:00
mdb a043cd1848 Those weren't needed.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1842 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 01:17:56 +00:00
mdb e6b7505a69 Ignore unavoidable unchecked warnings.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1841 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 01:15:47 +00:00
mdb 20a9e352ee Suppress warnings.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1840 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 01:13:46 +00:00
ray 89c9ddb431 Got a wild hair and added some methods to CountHashMap, and added
an Entry interface that can be used to get the count directly from
an Entry (without having to know that values are stored internally as
an int[]). It turned out to be a bit ugly.

What I really need to do is hide all the int[] business by rewriting
this class, which will also clean up the ugliness.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1839 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-03 02:28:00 +00:00
mdb 7a4588e859 We need to ensure that only one repository operation is active on a particular
JDBC connection at a time. JDBC connections are thread safe, but we frequently
have to execute statements like:

insert into FOO values(0, blah, blah);
select LAST_INSERTED_ID()

to get the value assigned to an auto-increment column. If another thread
slipped in between those statements and inserted something into its own
auto-increment column having table, we'd get funny business. And indeed we very
occasionally see this race condition happen in the thread-happy webapps.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1838 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-29 18:54:47 +00:00
mdb 5fc9cafc36 Report the key rather than the connection identifier so we can tell if it was
read-only or not.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1837 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-29 17:58:28 +00:00
mdb 70e77b4040 Added ResultListener.NOOP which can be used like so:
foo.doSomeThing(bar, new ResultListener.NOOP<MyType>());


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1836 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-28 22:54:29 +00:00
ray c3498b63e2 Added a static method to normalize an email address.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1835 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-28 22:00:23 +00:00
mdb 38f09416b7 Eliminate the prepared statement caching as it's not useful since we can't use
server side prepared statement caching and it's causing things to break when
for some reason the prepared statements are being closed (perahps automatically
by the new MySQL deriver) and then being reused.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1834 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-28 21:30:35 +00:00
mdb e8cb1fb2d4 Add the NOOP back but deprecate it.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1833 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-25 23:29:08 +00:00
mdb ec436833fb Type-safe result listeners. Whee!
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1832 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-25 23:23:37 +00:00
mdb 5d6272c0ce Missed an auxiliary table.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1831 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-21 22:18:07 +00:00
mdb c67926d14d Revamped JORA to avoid keeping connection objects around which is not thread
safe and particularly not so in the webapp where one thread might come slip a
read-only connection into the session before an update was about to happen.

This ends up being a giant refactor, but it's much cleaner this way (to pass a
connection into the Table whenever it is doing anything), so I've taken the
pain. Fortuanately, code that uses the convenience methods doesn't need to
change, so as a part of this refactor I've taken the opportunity to switch a
bunch of old stuff to the new, concise, future proof hotness.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1830 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-21 21:26:07 +00:00
ray ca9adfe063 Better genericized typing for addAll() methods.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1829 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-19 18:41:44 +00:00
mdb f160f099f4 We can't use DriverManager if we want to use custom driver classes.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1828 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-17 18:22:32 +00:00
mdb 1e518d06bb Added methods for getting SQL dates to match the methods for getting util
dates.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1827 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-17 01:38:45 +00:00
mdb ccebc24367 Mark updating queries as such.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1826 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-13 19:55:36 +00:00
mdb 9946c3e311 Propagate more modified row counts.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1825 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-13 18:43:44 +00:00
mdb e6c4008258 Documented some return values.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1824 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-13 18:41:46 +00:00
mdb a1f2a34090 Return the number of rows modified by an update.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1823 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-13 18:40:31 +00:00
mdb 790d0dd35f Require a distinction to be made between read-only and read-write queries so
that we can route read-only queries to one or more read-only mirrors of a
database (the MySQL database drivers supports round-robin load balancing of
queries to read-only slaves).


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1822 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-13 18:01:29 +00:00
mdb 86bce6f08f Beans, frank.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1821 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-12 23:35:08 +00:00
mdb 325630b84e Added loadAll() that supports joining with other tables.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1820 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-12 23:21:18 +00:00
mdb a7f04bb8b0 Make the lastInsertedId available when using store().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1819 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-12 22:21:15 +00:00
mdb 333ec4c439 Removed reference to 1.5-specific Collections; fixed ArrayList override.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1818 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-11 04:06:32 +00:00
mdb 9a3d1f1672 Added getColumnSize().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1817 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-11 03:02:44 +00:00
mdb 6c58fd68a4 Use the Retroweaver verifier to ensure we're not referencing unweavable
1.5isms.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1816 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-10 21:57:19 +00:00
samskivert@gmail.com 7c751ee98d Ohforfucksake. Apparently we need it here as well.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1815 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-10 21:04:33 +00:00
mdb 270f915ad9 These need to be in the leaf classes.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1814 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-10 20:57:47 +00:00
andrzej b51d8df102 Fix for ClassCastException.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1813 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-10 18:56:31 +00:00
ray e27af6bfb3 Copy the array using clone; was unchecked-in in my copy of SortableArrayList.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1812 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-10 17:40:57 +00:00
mdb cf3b3148be git-svn-id: https://samskivert.googlecode.com/svn/trunk@1811 6335cc39-0255-0410-8fd6-9bcaacd3b74c 2006-04-10 09:00:44 +00:00
mdb acf8fea697 Genericized all of our Collections extensions; switched numerous other classes
to typesafe 1.5 patterns; tidied some things up. Two impactful changes:

- jora.Table now takes the class object of the row class, rather than its name;
  I also removed support for the derived table stuff as we don't use it and it
  was a PITA to make work cleanly with proper type-safety;

- SortableArrayList got split into SortableArrayList (which does its sorting
  using a Comparator) and ComparableArrayList which contains elements that
  implement Comparable. In the world of loose typing, one class could do both,
  but in strong typing land, they have to be separate classes.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1810 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-10 08:57:47 +00:00
mdb cef9db2032 Starting down the path of converting everything to 1.5 and using Retroweaver to
make things work on the client. We're starting with parameterized types which
are backwards compatible with 1.4 anyway so all Retroweaver is doing to such
classes is changing the classfile format version number. We'll get more jiggy
later as we become more comfortable with the process.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1809 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-10 02:39:30 +00:00
mdb b79253cd76 Made sanitize() cope with null.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1808 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-05 02:40:18 +00:00
mdb b66e2d6e52 Moved robust jar unpacking code out of Narya and into Samskivert.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1807 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-04 18:41:45 +00:00
ray 8adbb71ad9 Added a needed method, since I have write permission to samskivert.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1806 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-04 17:22:35 +00:00
andrzej f5199e0baf Have the increment method return the new value.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1805 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-03-31 23:46:44 +00:00
mdb 046c9c29b9 Whoops, this is an Integer.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1804 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-03-28 20:24:00 +00:00
mdb c69526f67e Include our siteId if appropriate.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1803 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-03-27 23:47:29 +00:00