Hello,

On 05.10.2005 17:09, Kern Sibbald wrote:

On Wednesday 05 October 2005 15:07, Arno Lehmann wrote:

Hi,

On 05.10.2005 14:01, Phil Stracchino wrote:

John wrote:

I built bacula 1.36.3 from source, and that table was not created when I
installed it.  What version are you using?

Then probably Arno applied the patch when I first sent it out, but it
never made it into mainstream.

Right, I did apply it with 1.34.something, and naturally I never deleted
the database. I checked that it is in the (current) source, though.


I'll regenerate the patch in a better
way once I get my development machine updated.

The table is useful for the queries, too. For example, I have

:List last 25 Jobs ordered by start time with long status:

SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatusLong
AS Status
FROM Job
LEFT JOIN Status ON Job.JobStatus=Status.JobStatus
ORDER BY StartTime
DESC
LIMIT 25;

I don't know if this is proper SQL or if it works with anything but
MySQL - I just know from experience that joins always take me lots of
time to figure out, and my trial-and-error method of coding doesn't
produce very portable code ;-)


Generally, I find it much easier (at least for *my* brain) to avoid joins unless you want some special type and replace the above with:


SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatusLong
AS Status
FROM Job, Status
WHERE Job.JobStatus=Status.JobStatus
ORDER BY StartTime
DESC
LIMIT 25;

Quite right, but the above is only a degenerated form of a left join in SQL :-)

Apart from that, I usually do the same, but whenever I am getting in contact with a DBMS which requires a more strict SQL dialect that doesn't help me - and so I have times where I try to produce proper SQL.

The only downside is for any column name appearing in the SELECT clause (JobId,Name,...), if it is not unique in all the tables listed (Job, Status), then you must specify which one you want.

Which, in itself, can be a problem - I mean, how many tables with ID or Street or Number or Amount do you have in your databases? Well, at least a proper SQL statement leaves no room for misinterpretation, and with todays libraries for perl and php even people like me can rely on a proper database to manage what data we have ;-)

Arno



--
IT-Service Lehmann                    [EMAIL PROTECTED]
Arno Lehmann                  http://www.its-lehmann.de


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to