cfquerytag, no verbose ceremonious coding. No ceremony, just a plain datasource definition in the administrator and we could query the database with ease.
Application.cfcor even define it at runtime or even within the query constructs themselves.
Application.cfc, which will dictate the datasources for that specific ColdFusion application
queryobject containing a recordset and other metadata information about the query. The query can ask for information from the database, write new data to the database, update existing information in the database, or delete records from the database. This can be done in several ways:
datasourcecompletely from query calls and CFML will use the one defined in
Application.cfcas the default datasource connection. This is a great way to encapsulate the datasource in a single location. However, we all know that there could be some applications with multiple datasources, that's ok, at least you can have one by default.
Application.cfc, which is sometimes our preferred approach as the connections are versioned controlled and more visible than in the admin. You will do this by defining a struct called
this.datasources. Each key will be the name of the datasource to register and the value of each key a struct of configuration information for the datasource. However, we recommend that you setup environment variables in order to NOT store your passwords in plain-text in your source code.
Application.cfcabove and pass it into the
.cfconfig.jsonin the web root of your project and if you start up a CommandBox server on any CFML engine, CFConfig will transfer the configuration to the engine's innards:
for, cfloop or cfoutputconstruct.
each()operations in a multi-threaded fashion. The
each()functions allows for a
maxThreadsarguments so the iteration can happen concurrently on as many
maxThreadsas supported by your JVM.
cfqueryparamconstruct/tag (https://cfdocs.org/cfqueryparam) and always sanitize your input via the
encodefunctions in CFML.
:varnamenotation in your SQL construct to denote a variable place holder or a
?to denote a positional placeholder. The
cfqueryparamtag or the inline
cfsqltypeconstruct will bind the value to a specific database type in order to avoid SQL injection and to further the database explain plan via types. The available SQL binding types are:
queryFilter()operations to actually filter out the necessary data from a query, or
returntypeattribute within the query options or just an attribute of the cfquery tag (https://cfdocs.org/cfquery)