Thread: [Refdb-devel] refdb db in menu?
Status: Beta
Brought to you by:
mhoenicka
From: Bruce D'A. <bd...@fa...> - 2003-12-11 15:18:28
|
Question: Should the base db (now called "refdb") be included in the list of dbs in the menu? Bruce |
From: Michael S. <sm...@xm...> - 2003-12-11 15:27:28
|
Hi Bruce, You wrote: > Question: > > Should the base db (now called "refdb") be included in the list of dbs > in the menu? I don't know the answer to that. The menu is just generated by calling 'refdbc -C listdb'. So, if the based db doesn't show up when you run that command from the command line, it won't show up in the menu either. --Mike |
From: Markus H. <mar...@mh...> - 2003-12-11 20:20:05
|
Bruce D'Arcus writes: > > Question: > > Should the base db (now called "refdb") be included in the list of dbs > in the menu? > I'm not sure how to handle this intelligently. In a shared environment you'll always face the problem that your database engine hosts a variety of databases that do not belong to RefDB. You should exclude these as well. The only way that I can think of is to stick to a name pattern for RefDB databases and run listdb with an appropriate regexp. Maybe the menu code can use a regexp if one is set in .emacs? regards, Markus -- Markus Hoenicka mar...@ca... (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de |
From: Michael S. <sm...@xm...> - 2003-12-13 10:34:57
|
Markus Hoenicka <mar...@mh...> writes: > Bruce D'Arcus writes: > > > > Question: > > > > Should the base db (now called "refdb") be included in the list of dbs > > in the menu? > > > > I'm not sure how to handle this intelligently. In a shared environment > you'll always face the problem that your database engine hosts a > variety of databases that do not belong to RefDB. You should exclude > these as well. The only way that I can think of is to stick to a > name pattern for RefDB databases and run listdb with an appropriate > regexp. Maybe the menu code can use a regexp if one is set in .emacs? Yes -- it actually already have the refdb-listdb-sql-regexp variable in there already to support just that. The default for it is "%". But as far as the base db named "refdb" goes, users should never be directly adding any data to that via refdbc -C addref or whatever, right? If so, then I will have the code not add it to the menu. --Mike |
From: Michael S. <sm...@xm...> - 2003-12-13 11:00:34
|
hmm, I realize now that naming the base db "refdb" is arbitrary. I guess a user could choose during install to call the base database "mybasedb" or whatever, and then could create another database called "refdb", and have references added to that. Maybe I could make it configurable through a variable named say, refdb-base-database. (In addition to the current refdb-listdb-sql-regexp variable). The code would take the list of databases that listdb returns, check it against refdb-base-database, and remove any whatever name matches. I could make "refdb" the default, and document it by saying: Set this to whatever name you gave to the base RefDB database during installation (that is, using 'mysql -e "CREATE DATABASE refdb1"' or the PostgreSQL "createdb" command). Or to make it more configurable, we could add refdb-listdb-ignore-list variable, again with default value "refdb", but make it a list. Users could put multiple names into it that way, and then wouldn't need to mess around with trying to figure out how to construct a regex and express it in whatever syntax their backend database supported. And that way, we could also include the built-in database names for the backends -- i.e. Postgres's "template0" and "template1" databases, and whatever the names are of the built-in databases that MySQL sets up. How does that sound? Now that I write all that, though, I wonder whether that logic might not be better handled on the RefDB side -- so that refdbd -C listdb wouldn't return the name of the base RefDB database, whatever its name, or of the built-in backend database names. --Mike Michael Smith <sm...@xm...> writes: > Markus Hoenicka <mar...@mh...> writes: > > > Bruce D'Arcus writes: > > > > > > Question: > > > > > > Should the base db (now called "refdb") be included in the list of dbs > > > in the menu? > > > > > > > I'm not sure how to handle this intelligently. In a shared environment > > you'll always face the problem that your database engine hosts a > > variety of databases that do not belong to RefDB. You should exclude > > these as well. The only way that I can think of is to stick to a > > name pattern for RefDB databases and run listdb with an appropriate > > regexp. Maybe the menu code can use a regexp if one is set in .emacs? > > Yes -- it actually already have the refdb-listdb-sql-regexp variable in > there already to support just that. The default for it is "%". > > But as far as the base db named "refdb" goes, users should never be > directly adding any data to that via refdbc -C addref or whatever, > right? If so, then I will have the code not add it to the menu. > > --Mike -- Michael Smith Openwave Systems Japan +81 90 9148 0269 (mobile) Nishishinjuku 6-22-1 +81 3 5909 6347 (office) Tokyo, Japan 163-1117 +81 3 5909 6241 (fax) |
From: Markus H. <mar...@mh...> - 2003-12-13 21:15:41
|
Michael Smith writes: > hmm, I realize now that naming the base db "refdb" is arbitrary. I guess > a user could choose during install to call the base database "mybasedb" > or whatever, and then could create another database called "refdb", and > have references added to that. > No, the name is not arbitrary. It is hard-coded in the main header file. The name changes once in a while if I change the database schema and want to allow users to run parallel installations of RefDB using the old and the new schemas at the same time. > Or to make it more configurable, we could add refdb-listdb-ignore-list > variable, again with default value "refdb", but make it a list. Users > could put multiple names into it that way, and then wouldn't need to > mess around with trying to figure out how to construct a regex and > express it in whatever syntax their backend database supported. > > And that way, we could also include the built-in database names for the > backends -- i.e. Postgres's "template0" and "template1" databases, and > whatever the names are of the built-in databases that MySQL sets up. > The latter is "mysql" (who would have guessed that?). > How does that sound? > I think it may be useful in quite a couple of cases, so I'd suggest to add such a list. This black list together with the regexp that allows to define a white list should be sufficient to pick the right databases. > Now that I write all that, though, I wonder whether that logic might not > be better handled on the RefDB side -- so that refdbd -C listdb wouldn't > return the name of the base RefDB database, whatever its name, or of the > built-in backend database names. > I could do this of course, but it is still a half-assed solution as it does not solve the problem of non-RefDB databases served by the same database engine. A real solution would require refdbd to test each database returned by listdb whether or not it is a RefDB database, e.g. by running a query that retrieves values of all fields listed by their names. This would also filter out databases that the user has no permission to access anyway. Should I put this on my todo list? regards, Markus -- Markus Hoenicka mar...@ca... (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de |
From: Michael S. <sm...@xm...> - 2003-12-15 11:11:30
|
Hi Markus, You wrote: > Michael Smith writes: > > hmm, I realize now that naming the base db "refdb" is arbitrary. I guess > > a user could choose during install to call the base database "mybasedb" > > or whatever, and then could create another database called "refdb", and > > have references added to that. > > > > No, the name is not arbitrary. It is hard-coded in the main header > file. The name changes once in a while if I change the database schema > and want to allow users to run parallel installations of RefDB using > the old and the new schemas at the same time. Ah, OK. I guess I can then hard-code it into the Emacs code. You say it changes once in a while, and I remember that it's 'refdb1' for v0.9.3. Does that mean you alternate it between those two values, and so if I have the Emacs code filter out both "refdb" and "refdb1", it will handle things OK if/when you need to change the name again? > > Or to make it more configurable, we could add refdb-listdb-ignore-list > > variable, again with default value "refdb", but make it a list. Users > > could put multiple names into it that way, and then wouldn't need to > > mess around with trying to figure out how to construct a regex and > > express it in whatever syntax their backend database supported. > > > > And that way, we could also include the built-in database names for the > > backends -- i.e. Postgres's "template0" and "template1" databases, and > > whatever the names are of the built-in databases that MySQL sets up. > > > > The latter is "mysql" (who would have guessed that?). Heh -- I should have guessed, I guess :) > > How does that sound? > > > > I think it may be useful in quite a couple of cases, so I'd suggest to > add such a list. This black list together with the regexp that allows > to define a white list should be sufficient to pick the right > databases. OK. But, along with the blacklist, should I just have it hard-coded to always ignore the following, even if they're not included in the blacklist? If not, there's a risk of users trying to add RefDB data to these databases. refdb refdb1 mysql template0 template1 > > Now that I write all that, though, I wonder whether that logic might not > > be better handled on the RefDB side -- so that refdbd -C listdb wouldn't > > return the name of the base RefDB database, whatever its name, or of the > > built-in backend database names. > > > > I could do this of course, but it is still a half-assed solution as it > does not solve the problem of non-RefDB databases served by the same > database engine. A real solution would require refdbd to test each > database returned by listdb whether or not it is a RefDB database, > e.g. by running a query that retrieves values of all fields listed by > their names. This would also filter out databases that the user has no > permission to access anyway. Should I put this on my todo list? Yes, I think it should be on your todo list. How much of a priority it should be relative to other things you have on there, I can't say. --Mike |
From: Markus H. <mar...@mh...> - 2003-12-15 20:35:51
|
Michael Smith writes: > Ah, OK. I guess I can then hard-code it into the Emacs code. You say it > changes once in a while, and I remember that it's 'refdb1' for v0.9.3. > Does that mean you alternate it between those two values, and so if I > have the Emacs code filter out both "refdb" and "refdb1", it will handle > things OK if/when you need to change the name again? > This should do the trick. So far I didn't find any reason to use something else but refdb or refdb1. > OK. But, along with the blacklist, should I just have it hard-coded to > always ignore the following, even if they're not included in the > blacklist? If not, there's a risk of users trying to add RefDB data to > these databases. > > refdb refdb1 mysql template0 template1 > This is the pitch dark black list, so to speak. In no case a reference database should have one of these names. > Yes, I think it should be on your todo list. How much of a priority it > should be relative to other things you have on there, I can't say. > Ok. I'll put it on my list then. I'll make that user-configurable to save time for those who know what they're doing. regards, Markus -- Markus Hoenicka mar...@ca... (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de |