AW: [opencms-dev] PostgreSQL

Nicolás Lichtmaier nick at technisys.com.ar
Fri Mar 1 19:05:33 CET 2002


>
>
>in order to put your efforts in a release version of OpenCms
>you have to create three new classes (CmsDbAccess, CmsQueries
>and CmsResourceBroker) like that stuff in the \opencms\src\ \
>com\opencms\file\mySql directory. And in the same way like the
>MySql stuff uses the generic-oracle-ism you should inherite the
>Sql statements from generic, resp. roll your own for PostgreSQL.
>  Further more the setup scripts may attract you attention to 
>endorse this area with data for this particular database.
>  At least there may be some more entries in one or more proper-
>ty files.
>  To stay tuned with the further development of OpenCms and to
>archive early synchronization with test-versions subscribe to
>the opencms-dev mailing list - traffice quite moderate (~ 4 mails
>per day, seldom more then 25 a week).
>
I have it kind of working now. I have successfully imported the 
workspace into the database.

What I did was to modify the "genericsql" files in ocsetup (which aren't 
reallt genericm they are Oracle specific). So I endedn destroying the 
Oracle support and replacing it with PotsgreSQL support. My plan is to 
create a new resource broker eventually. The new setup process doesn't 
ask fot a jdbc URL, it asks for a "database host" (I guess I'll need to 
add this to the bean so that is saved among pages displays like the 
other parameters). The jsp then construct the needed URLs (2): 
jdbc:postgresql://host/template1 (to create the database) and 
jdbc:postgresql://host/database (to use it).

I'd like to duplicate as little files as posible, I will provide a sed 
script to transform the create_database oracle sql file to postgresql, 
so that the PostgreSQL doesn't fell into obsolescence. The needed 
changes are things like LONG RAW -> OID and VARCHAR2 -> VARCHAR. I think 
that other SQL files could be shared. I modified CmsDbAccess in 
genericSql to add the one PostgreSQL requirement: to handle blobs inside 
a begin-commit (even when querying). I modified query.properties to add 
some things that IMO should be compatible with Oracle: PostgreSQL does 
not support omitting the AS keyword (SELECT COUNT(*) AS THECOUNT 
FROM....) and replacing CONCAT with ||. Both things are ANSI SQL. 
Wouldn't it be better to try to keep those files the same?

I had a problem with the $$keyword$$ replacer. As the function 
replaceValues (in CmsSetupDb.java) used a tokenizer, some things were 
imposible to do. E.g. you couldn't do "create user '$$user$$'" because 
the tokenizer will include the single quotes in the token. I ended 
rewriting this function to not use a tokenizer, but simple 
indexOf("$$"). It now requires that all tokens are in the form 
"$$token$$", but that is the case now. I'm sending this latter patch 
now, because I think is backwards compatible with the old replacer.

Well, I have now been subscribed to the list. I will keep you informed 
about what I do. Bye!

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: replacer.patch
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20020301/439193c4/attachment.ksh>


More information about the opencms-dev mailing list