Best of Talk (06/08/04)

 
Jul 03, 2004

by Dina Hess

Title: Checking if a Table Exists?
Date: 06/08/04      (12 Posts)
Summary: Need to determine if a table exists and, if not, to create it? If your database is SQL Server or PostgreSQL, try this:
 
<cfquery name="createTbl" datasource="#dsn#">
if exists(select * from information_schema.tables
where table_name = 'tblTest')
begin
(select * from tblTest)
end
else
begin
create table tblTest (
id int,
txt varchar(25))
end
</cfquery>
 Workarounds are offered for databases, like MySQL,that do not support schemas.
 
Title: Restricting Access by IP Address
Date: 06/08/04      (14 Posts)
Summary: Looking for a way to restrict access to your application based on a user's IP address? You could implement this at the application level by checking the value of CGI.REMOTE_ADDR and adding a secure login. Alternately, you could restrict IP addresses at the web server level, although router-level restrictions are safer. A "must-read" discussion of IP spoofing is also included.
 
Title: Help for the Speed of this Query?
Date: 06/08/04      (17 Posts)
Summary: A query execution plan is an overview of what the database thinks is the most efficient way to execute a SQL query and includes "which indexes it will use" and "in what order it will do joins and sorts." See PostgreSQL documentation for an explanation of the key concepts. Tips to access MySQL and SQL Server execution plans are included along with an optimization example of a "before" and "after" query.
 

Add a Comment
(If you subscribe, any new posts to this thread will be sent to your email address.)
  
Privacy | FAQ | Site Map | About | Guidelines | Contact | Advertising | What is ColdFusion?
House of Fusion | ColdFusion Jobs | Blog of Fusion | AHP Hosting