[ZOPE] ZBabel translation to Postgres

Olaf Zanger olaf.zanger@soli-con.com
Thu, 04 Jan 2001 14:44:19 +0100


Dies ist eine mehrteilige Nachricht im MIME-Format.
--------------02D4F9ABA658F7BC75AA9BA0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

hi andrew,

thanks for the description. i figured it as far as that:

you need in postgresql (this is tested only from zope with zsql method,
since some other things don't work in the ZBabel Produkt with
postgresql):

sqlGetPhrasesToUpdate:
 
select distinct Phrases.*

WHERE md5Hash not in 
(
 select c.md5Hash
 from Phrases as c, Phrases as d
 where c.md5Hash = d.md5Hash and c.lang <> d.lang and c.lang='<dtml-var
srcLang>'
)
and lang <>'<dtml-var srcLang>'

sqlNewPhrase:

insert into Phrases (phrase_id,lang,md5Hash,renderPath,renderText)
values (
nextval('phrases_phrase_id_seq'),
<dtml-sqlvar lang type=nb>,
<dtml-sqlvar md5Hash type=nb>,
<dtml-sqlvar renderPath type=nb>,
<dtml-sqlvar renderText type=nb>
)

all other sqlFunctions seam to work (out of zope ZSQL method)

i attache the ZBabel.sql for postgres.
the examples are handgenerated so the hashes are fake.

TAKE CARE 
until now this just fakes the ability of ZBabel on Postgres on a ZSQL
Method level for testing purposes.

I get errors:
when i first want to view a page with the <dtml-babel src=uk dst=de>
test</dtml-babel>

pg.error
error value: error: attribute 'phrases_phrase_id_seq' not found


probably that helps anybody

olaf



> | What does the whole thing do anyway?
> 
> Finds all the phrases that don't have a translation for the language
> selected. It's hard to find things that don't exist in databases without
> nested selects which MySQL did not have at the time.
> 
> MySQL was chosen precisely because it is restricted, and is basically the
> lowest common denominator when it comes to SQL.
> 
> I do recall however, that postgres only implements INNER and OUTER joins
> although I don't know the status of the JOIN stuff in postgres at this time.
> 
> | Has anybody ported ZBabel already?
> 
> Someone was going to send me patches for postgres, but, I never received
> them.
> 
> I'll happily integrate patches, although, automatically selecting the
> right query based on database type will be required so that several releases
> aren't required. I don't think that that's a hard thing to achieve.

-- 
soli-con Engineering Zanger
Dipl.-Ing. (FH) Olaf Marc Zanger
Lorrainestrasse 23
3013 Bern / Switzerland
Fon: +41-31-332 9782
Mob: +41-76-572 9782
mailto:info@soli-con.com
mailto:olaf.zanger@soli-con.com
http://www.soli-con.com
--------------02D4F9ABA658F7BC75AA9BA0
Content-Type: application/x-unknown-content-type-sql_auto_file;
 name="phrases.sql"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="phrases.sql"

RFJPUCBUQUJMRSBwaHJhc2VzOwpEUk9QIFNFUVVFTkNFIHBocmFzZXNfcGhyYXNlX2lkX3Nl
cTsKCkNSRUFURSBUQUJMRSBwaHJhc2VzICgKCSAgcGhyYXNlX2lkIAlzZXJpYWwsCgkgIGxh
bmcgCQljaGFyYWN0ZXIoMiksCgkgIG1kNUhhc2ggCWNoYXJhY3RlcigzMiksCgkgIHJlbmRl
clBhdGggCWNoYXJhY3RlcigyNTUpLAoJICByZW5kZXJUZXh0IAl0ZXh0Cik7Cgpjb3B5IHBo
cmFzZXMgZnJvbSBzdGRpbiB1c2luZyBkZWxpbWl0ZXJzICcsJzsKMSxlbixtZDVIYXNoMSxa
QmFiZWxUZXN0LExpdmUKMixkZSxtZDVIYXNoMSxaQmFiZWxUZXN0LExlYmVuCjMsZW4sbWQ1
SGFzaDIsWkJhYmVsVGVzdCxFYXQKNCxkZSxtZDVIYXNoMixaQmFiZWxUZXN0LEVzc2VuCjUs
ZW4sbWQ1SGFzaDMsWkJhYmVsVGVzdCxMb3ZlCjYsZGUsbWQ1SGFzaDQsWkJhYmVsVGVzdCxH
ZWhlbgo3LGVzLG1kNUhhc2g1LFpCYWJlbFRlc3QsY29uCjgsZnIsbWQ1SGFzaDYsWkJhYmVs
VGVzdCxhdmVjCjksbmwsbWQ1SGFzaDcsWkJhYmVsVGVzdCx1dHJpY2h0ZW4KXC4KCgppbnNl
cnQgaW50byBwaHJhc2VzIChwaHJhc2VfaWQpIHZhbHVlcyAoc2V0dmFsKCdwaHJhc2VzX3Bo
cmFzZV9pZF9zZXEnLDE1KSk7CnNlbGVjdCBjdXJydmFsKCdwaHJhc2VzX3BocmFzZV9pZF9z
ZXEnKTsKCkNSRUFURSBVTklRVUUgSU5ERVggcGhyYXNlc19waHJhc2VfaWRfaW5kIE9OIHBo
cmFzZXMgKHBocmFzZV9pZCk7CgoKCg==
--------------02D4F9ABA658F7BC75AA9BA0
Content-Type: text/x-vcard; charset=us-ascii;
 name="olaf.zanger.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Visitenkarte für Olaf Zanger
Content-Disposition: attachment;
 filename="olaf.zanger.vcf"

begin:vcard 
n:Zanger;Olaf Marc
tel;cell:+41-76-572 9782
tel;work:+41-31-332 9782
x-mozilla-html:FALSE
url:www.soli-con.com
org:soli-con Engineering Zanger
adr:;;Lorrainestrasse 23;Bern;BE;3013;Switzerland
version:2.1
email;internet:olaf.zanger@soli-con.com
title:Dipl.-Ing.
note;quoted-printable:IT-Consulting=0D=0AEmbedded Systems=0D=0AEnergy Systems=0D=0AOpen Source Solutions=0D=0A
x-mozilla-cpt:;-32176
fn:Olaf Zanger
end:vcard

--------------02D4F9ABA658F7BC75AA9BA0--