Query of Queries weirdness

Posted At : Aug 16, 2008 17:30 PM | Posted By : Ed Tabara
Related Categories: ColdFusion

Problem:

We have a DB table with varchar values. To make it easy i've created it with a QueryNew:

<cfset getTMP = QueryNew("id, col1, col2")>
<cfset QueryAddRow(getTMP, 2)>
<cfset QuerySetCell(getTMP, "id", "1", 1)>
<cfset QuerySetCell(getTMP, "col1", "1212-77-01", 1)>
<cfset QuerySetCell(getTMP, "col2", "1212-77-01", 1)>
<cfset QuerySetCell(getTMP, "id", "2", 2)>
<cfset QuerySetCell(getTMP, "col1", "1212-77-01ewr", 2)>
<cfset QuerySetCell(getTMP, "col2", "1212-77-01qwe", 2)>

And what is needed is to do the following query:

Select *
From getTMP
Where col1 = <cfqueryparam CFSQLTYPE="CF_SQL_VARCHAR" value="1212-77-01">
or col2 = <cfqueryparam CFSQLTYPE="CF_SQL_VARCHAR" value="1212-77-01">

What we will get is the following error:
Query Of Queries syntax error.
Encountered ". Query Of Queries runtime error.

It come that ColdFusion see the value of CFQUERYPARAM as a DATE and not as VARCHAR. Casting to varchar left and right sides of the equalities does not help at all.


Solution:

Use LIKEinstead of =in the query like this:

Select *
From getTMP
Where col1 like <cfqueryparam CFSQLTYPE="CF_SQL_VARCHAR" value="1212-77-01">
or col2 like <cfqueryparam CFSQLTYPE="CF_SQL_VARCHAR" value="1212-77-01">

Comments (5)| Print| Send | 253 Views | 2% / 36% Popularity

Kiwi Dream

Posted At : Jul 23, 2008 17:42 PM | Posted By : Ed Tabara
Related Categories: Fun

A great movie for those that have a dream. LOVE it! No more words.. just watch it.



Comments (1)| Print| Send | 585 Views | 6% / 7% Popularity

Morning head-breaker: anyone with a solution?

Posted At : Jul 17, 2008 17:12 PM | Posted By : Ed Tabara
Related Categories: ColdFusion

Given:
1) an XML having the % sign in one of the values
example:

<?xml version='1.0' encoding='utf-8' ?>
<tst>
<details>
<somename>less than 50% </somename>
</details>
</tst>

2) a script on a website (WS1) that submit that XML to other website (WS2) that is running CF8 (if the actual verion even matter)
The issue:
When submitting that XML with HTTP POST the following error is happening on WS2:

500
ROOT CAUSE:
java.lang.IllegalArgumentException
at coldfusion.filter.FormScope.parseName(FormScope.java:367)
at coldfusion.filter.FormScope.parseQueryString(FormScope.java:324)
at coldfusion.filter.FormScope.parsePostData(FormScope.java:293)
at coldfusion.filter.FormScope.fillForm(FormScope.java:243)
at coldfusion.filter.FusionContext.SymTab_initForRequest(FusionContext.java:430)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:33)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:284)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
javax.servlet.ServletException: ROOT CAUSE:
java.lang.IllegalArgumentException
at coldfusion.filter.FormScope.parseName(FormScope.java:367)
at coldfusion.filter.FormScope.parseQueryString(FormScope.java:324)
at coldfusion.filter.FormScope.parsePostData(FormScope.java:293)
at coldfusion.filter.FormScope.fillForm(FormScope.java:243)
at coldfusion.filter.FusionContext.SymTab_initForRequest(FusionContext.java:430)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:33)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:284)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:70)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:284)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


IF the % sign is taken off from the XML everything works fine and no error is generated.

NOTE 1:If the script doing the post is emulated on WS2 (so that the XML being submitted from WS2 to WS2), that "500" does not happen.

NOTE 2:The error seem to happen not on the application (because an test output followed by CFABORT just at the start of Application.cfm file does not change anything and the script on WS2 still get the error and not the test output).

NOTE 3:First the CF8 was on Java 1.5 . Then we reinstalled CF8, so it's on the default Java 6 now. But the error is still there.

ANY suggestions would be VERY appreciated!!!

Comments (11)| Print| Send | 791 Views | 8% / 79% Popularity

It will come back to you!

Posted At : Jul 07, 2008 12:30 PM | Posted By : Ed Tabara
Related Categories: Other, Fun

Saw this today morning and just wasn't able to stay away :)
Have a great week everyone!


P.S. Hereis the original site. And by the way, it is ColdFusion powered!!!

Comments (1)| Print| Send | 1075 Views | 10% / 7% Popularity

Wanted by Timur Bekmambetov

Posted At : Jun 30, 2008 12:31 PM | Posted By : Ed Tabara
Related Categories: Other, Fun

After "Night Watch"and "Day Watch"(after Sergei LukyanenkoGREAT series of books) and knowing Bekmambetovis working on a Hollywood movie with Angelina Jolie, i was waiting to see what he will come to and yesterday finally i went out to watch "Wanted". I have to say that it met my best expectations. James McAvoy, Angelina Jolieand Morgan Freemanwas great! Too bad Konstantin Khabenskyhad a so small role in this movie. Even that the Watch's movies had a bit more solutions in unexpected super effects, there are still a lot of them in the Wantedas well... and you can feel Bekmambetovstyle and hand there. Well... i will not write anything else about it because always is better to see something once than to hear or read about it 10 times.

P.S. Based on IMDB.COM, Wantedhit $51.1Mfor the first weekend... and that's for a R Rated movie! Not bad at all.

Comments (0)| Print| Send | 932 Views | 9% / 0% Popularity

Serious bug with ColdFusion 8 at least

Posted At : Jun 23, 2008 21:00 PM | Posted By : Ed Tabara
Related Categories: ColdFusion

I don't know if this is known already or not, but this look serious to me. And its is really easy to re-create.
Here are the steps:

  1. Create a foloder that you will can access from your browser
  2. In that folder create an empty Application.cfc file
  3. Create a CFM file with in it
  4. Run that file from your browser
Voila!
You will get a lot of info.. TOO much actually :)

Comments (9)| Print| Send | 1671 Views | 16% / 64% Popularity

AJAX and bad HTML

Posted At : Jun 19, 2008 23:03 PM | Posted By : Ed Tabara
Related Categories: AJAX

Be aware of incorrect formatted HTML!

Yesterday i was checking a script that was using AJAX to load some form fields into the form based on the selection in a drop down. Everything there was working fine except the fact that when submitting the form, all AJAX loaded fields was missing in the FORM structure. And this was happening in FireFox while working fine in Internet Explorer.
To be short i will get right to the solution.
The problem was that the FORM tag was right after the TABLE tag (read FORM inside TABLE). Right after i changed the order, all worked fine.


Comments (0)| Print| Send | 1392 Views | 13% / 0% Popularity