[thelist] CF: Determining which DB used.
Raymond Camden
jedimaster at macromedia.com
Wed Sep 12 09:33:56 CDT 2001
> you might be able to query information from the server or cgi
> scopes about the machine the code is running on and run
> different queries based on this information. try looking at
> server.OS.name, server.OS.version, and cgi.server_software.
> btw, anybody know why server and variables scopes aren't structures?
Security reasons. That's the official reason. Well, for Server.
Personally, I don't agree that it's a good idea, but, what do you do. If
you want to use the Server scope for your app, I suggest doing
Server.App instead of just Server, that way you can examine the
structure w/ StructKeyList, etc.
> my suggestion would be to create those global variables you
> mention -- one for datasource, one for dbtype, and maybe
> another for dbserver. then, whenever you run a query, check
> the dbserver variable and run a query designed for the
> currently connected database.
This is a good idea, especially if you plan on going back and forth, and
again, if you keep your queries in custom tags, it gets even easier.
> something else to keep in mind -- always use a global
> variable for your local file path root. windows uses a drive
> as the ultimate root while unix uses a slash. being able to
> change this in one location is crucial to portability. you
> might also want to do this for your relative mappings as
> well, if you use them, since you might not be able to setup
> the same mapping in the new location.
>
A personal suggestion for this:
I've done the same type thing you describe above, but I find that it
runs into problems when you update your server. Imagine this. At your
dev server, you have set the web root to d:\web. Your live server uses
e:\web. Before uploading, you 'fix' the var, upload, then correct it
back on your home system. Obviously, not a good idea.
So, first, look for ways around it. You can, for example, use
ExpandPath(".") to get the current directory you are in.
Another option: You can separate your vars and system level stuff into
two files. So, file one has a set of variables that always apply. Ie,
Application.BGCOLOR = "green". File 2 has stuff like Application.Root =
"c:\web". So, when you deploy from Dev to Live, you can upload
everything but file 2. I've also used .ini files to store this kind of
information.
Just random ideas.
=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
Email : jedimaster at macromedia.com
Yahoo IM : morpheus
"My ally is the Force, and a powerful ally it is." - Yoda
More information about the thelist
mailing list