-----BEGIN PGP SIGNED MESSAGE-----
Benjamin, et al --
[I couldn't find your public key... Is it on a keyserver?]
...and then Benjamin Pflugmann said...
% On Fri 2002-12-27 at 20:15:22 -0500, davidtg-mysql@stripped wrote:
% > Soooooo... When you experienced folks write software that's meant to be
% > installed from a script or such, do you lead off with a 'drop database'
% > command, or is that just too dangerous to put in a script
% I would think so.
I'm going to figure you think "too dangerous" rather than think "lead
off" based on your comments below :-)
% > and you make your users clean up any old installation by hand?
% I would at least require them to do something special (use a --force
% flag or call a seperate cleanup script, or whatever).
I was thinking about a cleanup script; it sounds like that's the way to
% > This will have to be run by a root user, so we can figure that this
% > user might have read the docs and know that he's going to start
% > [over] from scratch, but then, again, users are users :-)
% Even if most people would read the docs (that's not my experience, not
% even for those having root privileges ;), the problem is that the
Yeah, yeah :-) One *hopes* that with power would come responsibility,
but in this loose age...
% damage could be relativly big. And the greater the possible damage the
% more conservative your scripts should be.
OK. Sounds like sage advice.
% > Meanwhile, is there if/then/else functionailty in SQL so that I can say
% > if exist dbname exit "some error" ;
% > create database dbname ;
% > ...
% > and not try to create and populate a database on top of an existing one?
% Since there is a flag --force to the mysql command line client, which
% will force continuation in case of sql error, it sounds as if the
% default behaviour of the tool already is to bail out on error. If not,
% it's a bug (either documentation of behaviour).
Oh :-) Well, so I tried it; I commented out the drop and reran my
script, and it quit at
ERROR 1007 at line 3: Can't create database 'dbname'. Database exists
so it looks like it doesn't continue. Good; I won't be trying to make
stuff on top of stuff.
% > Or is there perhaps a "RENAME DATABASE" command (I saw RENAME TABLE) so
% > that I could rename the old one to get it out of the way but not toss it?
% If you do not restrict yourself to a SQL script, but a shell script
% which calls mysql to execute some SQL, you could react very flexible
% on the concerns you mentioned.
Yeah. There will be an installation script (probably shell, because of
its portability, but perhaps perl for power) so I can just take the extra
steps of detecting the database and getting rid of it as a subtask.
It does; thanks!
HAND & Happy Holidays
David T-G * There is too much animal courage in
(play) davidtg@stripped * society and not sufficient moral courage.
(work) davidtgwork@stripped -- Mary Baker Eddy, "Science and Health"
http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
-----END PGP SIGNATURE-----