XMLDB - temp tables, and that thing in auth/ldap

XMLDB - temp tables, and that thing in auth/ldap

Martín Langhoff -
回帖数:10
Hi Eloy (and any other XMLDB hacker)

I need a temp table in auth/db that looks exactly like the temp table in auth/ldap. But I don't want *that* code, thankyouverymuch. 眨眼

The absolutely correct thing to do is to extend every XML class to dance tap on the top of a barrel take an "is_temporary" parameter, and to spit the right SQL when asked for it. And also the right SQL for dropping the table.

伤心

Sometimes a switch statement is just so much clearer (if ugly).

Will you kill me if I write a function in ddllib / dmllib that takes a table definition and has a big switch statement? 眨眼

Or - have you got a magic trick?
回复Martín Langhoff

Re: XMLDB - temp tables, and that thing in auth/ldap

Eloy Lafuente (stronk7) -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Testers的头像
Yes, after thinking thoroughly about that, I think I've one magic trick! 装酷 (but, we, magicians use to keep such tricks secret, you know). 眨眼

So, I really like to have two new ddllib functions create_temp_table() and drop_temp_table(), calling exactly the same stuff than the "normal" ones but adding the required "temp" syntax.

Just one note. Everything is "normal" while handling temporary tables BUT MSSQL. It requires the tablename to begin with "#", so perhaps it would be a good idea to allow the new functions to return the "created" tablename is order to use it dynamically later (to delegate all the "db conditional stuff" to xmldb, leaving auth/db code clearer. 装酷

How does it sound?

Ciao 微笑
回复Eloy Lafuente (stronk7)

Re: XMLDB - temp tables, and that thing in auth/ldap

Martín Langhoff -
Yes Yes Yes!!!
回复Eloy Lafuente (stronk7)

Re: XMLDB - temp tables, and that thing in auth/ldap

Martín Langhoff -
How about...
http://git.catalyst.net.nz/gitweb?p=moodle-r2.git;a=commitdiff;h=d8ab1eeeb1e890877d487a33e287435293597e65

Working for me right now, and I'll just use drop_table() if we can teach Oracle to truncate before dropping (is that really only required for temp tables?)

Edit: also some follow up commits to auth/ldap and other ddl things that you might want to check out. This is on a branch off 18_STABLE but I mean to put it in HEAD.
回复Martín Langhoff

Re: XMLDB - temp tables, and that thing in auth/ldap

Martín Langhoff -
Still working on this. The funny thing is that drop_table() on Pg tells me the table doesn't exist!?

Perhaps it's not listed in wherever we query for existing tables...

回复Martín Langhoff

Re: XMLDB - temp tables, and that thing in auth/ldap

Martín Langhoff -
Hey - Eloy, can we put this in 18_STABLE as well? See http://moodle.org/mod/forum/discuss.php?d=69608
回复Martín Langhoff

Re: XMLDB - temp tables, and that thing in auth/ldap

Eloy Lafuente (stronk7) -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Testers的头像
Hi Martín... I was waiting for stuff to go to HEAD in order to XMLDB-ise it as we talked on Skype.

When you say "...as well"... is it supposed to be in HEAD already? Uhm.. I forgot that (didn't notice changes in that area but some others added recently by Penny).

I think that if your changes don't affect "stable" things (just temp tables) the could fit into 18_STABLE if you need them really NOW. Else I would follow the HEAD -> xmldb-ize -> backport to 1.8 we agreed yesterday...

Ciao 微笑
回复Eloy Lafuente (stronk7)

Re: XMLDB - temp tables, and that thing in auth/ldap

Martín Langhoff -

Eloy - sorry about the delay -- got really tangled up with the db plugins on auth and enrol and subsequent accesslib issues...

I've merged my half-breed patch into HEAD. And I'm more than happy woth the proposed

HEAD -> xmldb-ize -> backport to 1.8

And once it's there, I'll merge my auth/db and enrol/db changes into HEAD and 18_STABLE.