commentGateway

Package: machii_info_sample.model.comment
I am a data gateway to comments
Method Summary
public commentGateway init(string dsn)

I initialize the comment gateway.

public query getComments(numeric faqid)

I return a query containing all comments for a faq

Method Detail
getComments

public query getComments( numeric faqid )

I return a query containing all comments for a faq

Parameters:
numeric faqid

Code:

	<cffunction name="getComments" access="public" returntype="query" output="false" displayname="Find All" hint="I return a query containing all comments for a faq">
		<cfargument name="faqid" type="numeric" required="true" />
		<cfset var commentsSelect = 0 />
		<cfquery name="commentsSelect" datasource="#variables.dsn#">
			SELECT 	c.*, 
					users.username
			FROM	comments c
				LEFT JOIN users ON c.createdByUserID = users.userID
			WHERE	faqID = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#arguments.faqID#" >
			ORDER BY c.dateCreated
		</cfquery>
		<cfreturn commentsSelect />
	</cffunction> 

init

public commentGateway init( string dsn )

I initialize the comment gateway.

Parameters:
string dsn

Code:

	<cffunction name="init" access="public" returntype="machii_info_sample.model.comment.commentGateway" output="false" displayname="Comment Gateway Constructor" hint="I initialize the comment gateway.">
		<cfargument name="dsn" type="string" required="yes" displayname="Data Source Name" hint="I am the data source." />	
		<cfset variables.dsn = arguments.dsn />
		<cfreturn this />
	</cffunction>