From: Graham H. <gr...@ly...> - 2001-04-05 23:01:16
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've been looking through MiddleKit in the 0.5.1rc2 release (incidentally, very easy to follow code; thank you!), and have a list of things that would need to be changed to have a PostgreSQL backend, something I would need to be able to use MK. I'm willing to implement this stuff, incidentally. o You use /* a lot. /*, despite being recognized by Postgres and MySQL both, isn't really proper SQL syntax: real SQL comments match the regexp `--.*$'. I'm not going to change this, as Pg supports the C style block comments. o Postgres has different syntax for drop database (no if exists clause, mostly) and changing to a new database, as well as IDs and a couple other minor things. Not a big deal. o You use enum (...), which isn't in ANSI; I assume this is a MySQL thing, as the normal way to do it in ANSI is `varchar (<max enum length>) check (<column_name> in (...))' which requires some sort of referential integrity checking. o You use `bigint unsigned /* Video */' for foreign key referencing; ANSI doesn't specify, but assuming your IDs fit in an int4, `int4 references Video (videoId)' will do the checking correctly. If they don't, then I suppose an int8 would do the trick, but that's a lot of rows. o Generate.py would of course need to be hacked slightly, but only slightly. o MySQLObjectStore would need to be hacked but that's easy enough. Except: you have retrieveLastInsertID taking no arguments, assuming that the database will keep track of the last inserted ID on a per connection basis, I assume? Postgres can do this through one of two methods: get the OID from the insert statement and look at that row, or get the last returned value from the sequence corresponding to that class. But in one case I would need the return value for the statement and in the other I would need the object inserted. While I could just override commitInserts and do it myself, and I will have to end up doing that if I want this to work with the 0.5.1 release, it would seem better to make the database layer a little more flexible. o I'm pretty sure I know how to retrofit transaction support onto the object store, which speaks well for the design; I can even get revertChanges in and working. But as revertChanges isn't implemented I'm a little unclear about how it is intended to work. If I work with a store and saveChanges a dozen times, and then revertChanges once, what does reverting mean? Does it mean `go back to the state things were in when I started working with the store' or does it mean `don't do what I've been working on since the last save' or does it mean `undo what I did last save' or what? o How do you run the tests? I'd like to be able to make my changes and then run all those tests to make sure I didn't break something, but I'm not entirely sure how to get them to go. - -- Graham Hughes <gr...@ly...> PGP fingerprint: 1F1D 0027 B835 E114 3F5B 2C7C 64D1 83A0 C5C7 312A -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.5 and Gnu Privacy Guard <http://www.gnupg.org/> iD8DBQE6zPkgZNGDoMXHMSoRAtBiAKDm8DEaM9nkPhdMYGLzfUzHjX1TfwCg6z2N CgZm2c29aG5rmNB8c9LIr+o= =EpI3 -----END PGP SIGNATURE----- |