CFC oddness....


ok, have following cfc:

<cfcomponent displayname="duplicate" hint="duplicates local club
tournaments">
<!--- function retrieves customers database --->
<cffunction name="getinfo"
hint="gets tournament info database" returntype="boolean"
output="no">
<cfargument name="tid" required="yes" type="numeric">
<cfset var duplicatetournamentlist = "">
<cfset var result = true>
<cfset var newtourndate = calcdate(arguments.tid)>
<cftry>
<cfquery name="duplicatetournamentlist" datasource="salleboise">
insert clubtournaments( tournname, tourndesc, tournfoilevent,
tournepeeevent, eventtype, tourndatetime, tournduplicated )
select tournname, tourndesc, tournfoilevent, tournepeeevent, eventtype,
<cfqueryparam cfsqltype="cf_sql_date" value="#newtourndate#">
tourndatetime, 0 tournduplicated
from clubtournaments
where tournid = <cfqueryparam cfsqltype="cf_sql_integer"
value="#arguments.tid#">
</cfquery>

<cfcatch type="any">
<cfset result = false>
</cfcatch>
</cftry>
<cfreturn result />
</cffunction>

<cffunction name="calcdate" access="public" returntype="date" hint="returns
1st saturday of month">
<cfargument name="id" type="numeric" required="yes">
<cfset var gettourndate = "">
<cfset var tourndate = "">
<cfset var firstofmonth2monthsahead = "">
<cfset newtourndate = "">
<cfquery name="gettourndate" datasource="salleboise">
select tourndatetime
clubtournaments
tournid=<cfqueryparam cfsqltype="cf_sql_integer"
value="#arguments.id#">
</cfquery>
<cfset tourndate = gettourndate.tourndatetime>
<cfset firstofmonth2monthsahead = createdatetime(year(dateadd('m', 2,
tourndate)), month(dateadd('m', 2, tourndate)), day(tourndate),
hour(tourndate),
minute(tourndate), second(tourndate))>
<cfset newtourndate = dateadd('d',
7-dayofweek(firstofmonth2monthsahead), firstofmonth2monthsahead)>
<cfreturn newtourndate />
</cffunction>
</cfcomponent>

the problem seems happening when new info added
database. new date added correctly, not time... if
dump of whats being stored in newtourndate, shows:

{ts '2008-07-05 15:00:00'}

i have mysql field i'm storing info timestamp, , thought
that should fine. time keeps defaulting 12:00:00, instead of
the 15:00:00 shown.

why happening?

cfsqltype="cf_sql_date"

you have sql type set date, time ignored means
gets set default 00:00:00 or 12 midnight.

try cfsqltype="cf_sql_timestamp" both date , time.



More discussions in ColdFusion


adobe

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support