23 Aug 2005 17:54
Re: MySQL Query question
Markus Hoenicka <markus.hoenicka <at> mhoenicka.de>
2005-08-23 15:54:52 GMT
2005-08-23 15:54:52 GMT
Hi Thomas, this issue came up previously a couple of times. As usual, my advice is *not* to access the database directly, no matter how straightforward this may seem from PHP. The proper way would be to query refdbd as this encapsulates all the complicated stuff. That is, instead of pondering how to write SQL queries that indeed catch all of the relevant information, you only have to send refdbd something like "getref :ID:=5" (oversimplified, but you get the point). You don't even have to understand the refdbd internals, and your interface will automatically stay in sync with RefDB even if the SQL impementation changes. Just to make my point, the implementation changes right now to allow multiple UR and L1/L2/L3/L4 fields, and it will again whenever the internal data model changes. If you implement direct SQL access, your interface will be outdated with the next RefdB release. There's two options to talk to refdbd: - use the existing C clients (refdba, refdbc). You only have to start the clients in batch mode through an "exec" or "system" (or whatever it is called in PHP) call, and read the results from stdout into a PHP variable. The previously announced attempts at a PHP interface used this approach, and refdb-mode uses it as well. - write a PHP library that implements the client-server protocol and use that to do the communication. RefDB already has a Perl module which implements the protocol. It should not be too hard to port it to PHP. With such a library in place, you can easily access refdbd without having the C clients installed. The protocol is documented in the manual for the upcoming 0.9.6 release which is already accessible through the RefDB homepage. I suggest to contact the two members of this list who previously announced partial success in writing PHP interfaces. Joining forces will finally make the PHP interface come true. regards, Markus Thomas Bartolucci <tbartolu <at> nnco.nano.gov>: > I'm running RefDB with a MySQL backend. I'm trying to re-work the web > interface for my own use in PHP. I'm having trouble creating the proper > query to extract the proper information. Does anyone know the simplest > MySQL query to pull all the information regarding a single reference > from the database? I can rework the PHP from there, but I can seem to > write the correct query to begin with. -- -- Markus Hoenicka markus.hoenicka <at> cats.de (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
RSS Feed