I have a few functions that I'd like to verify datasource health before 
attempting further code. 

Ideally, I'd have a function like 'dataSourceIsAvailable('datasourceName') 
that would return true/false

If true, I would attempt some database oriented code. If false, I would 
throw error and not attempt anything else. 

So far, this is the best I can come up with. I would rewrite this into a 
function with DSN and tableName as arguments.


<cftry>

  <cfquery name="dbcheck" datasource="myDSN">
    select top 1 * from TABLE
  </cfquery>
  
  <!--- specify the type of error for which we search --->

  <cfcatch type = "Database">
    <cfif #cfcatch.message# contains 'Error'>
      <cfset dbERROR = 1>
      <cfabort>
    </cfif>
  </cfcatch>

</cftry>

-- 
-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Open 
BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to