postgresql/src
Bruce Momjian f478692552 The attached file: SerializePatch2.tgz, contains a patch for
org.postgresql.util.Serialize and org.postgresql.jdbc2.PreparedStatement
that  fixes the ability to "serialize" a simple java class into a
postgres table.

The current cvs seems completely broken in this support, so the patch
puts it  into working condition, granted that there are many limitations
with  serializing java classes into Postgres.

The code to do serialize appears to have been in the driver since
Postgres  6.4, according to some comments in the source.  My code is not
adding any  totally new ability to the driver, rather just fixing what
is there so that  it actually is usable.  I do not think that it should
affect any existing  functions of the driver that people regularly
depend on.

The code is activated if you use jdbc2.PreparedStatement and try to
setObject  some java class type that is unrecognized, like not String or
not some other  primitive type.  This will cause a sequence of function
calls that results in  an instance of Serialize being instantiated for
the class type passed.  The  Serialize constructor will query pg_class
to see if it can find an existing  table that matches the name of the
java class. If found, it will continue and  try to use the table to
store the object, otherwise an SQL exception is  thrown and no harm is
done.  Serialize.create() has to be used to setup the  table for a java
class before anything can really happen with this code other  than an
SQLException (unless by some freak chance a table exists that it  thinks
it can use).

I saw a difference in Serialize.java between 7.1.3 and 7.2devel that I
didn't  notice before, so I had to redo my changes from the 7.2devel
version (why I  had to resend this patch now).  I was missing the
fixString stuff, which is  nice and is imporant to ensure the inserts
will not fail due to embedded  single quote or unescaped backslashes. I
changed that fixString function in  Serialize just a little since there
is no need to muddle with escaping  newlines: only escaping single quote
and literal backslashes is needed.  Postgres appears to insert newlines
within strings without trouble.
2001-08-26 00:54:42 +00:00
..
backend Fix portability problem in new CLOG code, per report from Rene Pijlman. 2001-08-25 23:24:39 +00:00
bin Replace implementation of pg_log as a relation accessed through the 2001-08-25 18:52:43 +00:00
corba Convert files from DOS format to normal text. 2000-12-03 14:43:59 +00:00
data I've sent 3 mails to pgsql-patches. There are two files, one for doc 1999-08-16 20:27:19 +00:00
include Replace implementation of pg_log as a relation accessed through the 2001-08-25 18:52:43 +00:00
interfaces The attached file: SerializePatch2.tgz, contains a patch for 2001-08-26 00:54:42 +00:00
makefiles Shared libraries should not be linked explicitly against -lc on FreeBSD 2001-06-20 20:25:11 +00:00
pl Add -Wno-error because of "unclean" flex output. 2001-08-21 16:25:21 +00:00
template 0 -> O 2001-08-08 13:30:20 +00:00
test Restructure pg_opclass, pg_amop, and pg_amproc per previous discussions in 2001-08-21 16:36:06 +00:00
tools Rename config.h to pg_config.h and os.h to pg_config_os.h, fix a number of 2001-08-24 14:07:50 +00:00
tutorial Restructure pg_opclass, pg_amop, and pg_amproc per previous discussions in 2001-08-21 16:36:06 +00:00
utils pgindent run. Make it all clean. 2001-03-22 04:01:46 +00:00
DEVELOPERS just testing a script... 1999-07-30 03:45:57 +00:00
GNUmakefile.in Restructure the key include files per recent pghackers discussion: there 2001-02-10 02:31:31 +00:00
Makefile Restructure the key include files per recent pghackers discussion: there 2001-02-10 02:31:31 +00:00
Makefile.global.in Rename config.h to pg_config.h and os.h to pg_config_os.h, fix a number of 2001-08-24 14:07:50 +00:00
Makefile.shlib Shared libraries should not be linked explicitly against -lc on FreeBSD 2001-06-20 20:25:11 +00:00
nls-global.mk Change xgettext rule to run in the source tree, so we don't have the 2001-07-15 11:43:55 +00:00
win32.mak Missed this part in pg_config.h rename. 2001-08-24 22:42:28 +00:00