commentDAO_access

Package: machii_info_sample.model.comment
Inherits from: model.comment.commentdao
Method Summary
public void create(comment comment)

CRUD method

Methods inherited from model.comment.commentdao:   update , read , init , delete
Method Detail
create

public void create( comment comment )

CRUD method

Parameters:
comment comment

Code:

	<cffunction name="create" returntype="void" output="false" hint="CRUD method">
		<cfargument name="comment" type="machii_info_sample.model.comment.comment" required="yes" displayname="create" hint="I am the comment from which to create a record" />
		<cfset var commentInsert = 0 />		
		<cfset var qry_lastComment = 0 />				
		<cfquery name="commentInsert" datasource="#variables.dsn#" >
			INSERT INTO comments (
				comment,
				faqid,
				CreatedByUserID
			) VALUES (
				<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#trim(arguments.comment.getComment())#" >,	
				<cfqueryparam cfsqltype="CF_SQL_BIGINT" value="#trim(arguments.comment.getFaqID())#" >,
				<cfqueryparam cfsqltype="CF_SQL_BIGINT" value="#trim(arguments.comment.getCreatedByUserID())#" >				
			)
		</cfquery>
		<cfquery name="qry_lastComment" datasource="#variables.dsn#" >
			SELECT 	commentID
			FROM	comments
			WHERE	comment = '#trim(arguments.comment.getComment())#'
		</cfquery>
		<cfset arguments.comment.setCommentID(qry_lastComment.commentID) />
		<cfreturn />
	</cffunction>