> Relying on the implicit conversion is lazy and error prone (since many people
> accidentally
> invert the condition - either while they're writing the code or, worse, when
> they're reading other people's code).
Which is precisely why I stopped using the shortcut. I only type at a
mere 45 WPM,
> > Whilst I agree with you about implicitly coercing the
> numeric result,
> > I'm sure I've heard Mr Cofield (or rathter certain guidelines)
> > advocate that very method in coding guidelines... Are the
> ones I got
> > out of date of have I got my memories completely mixed up?
>
> You're m
On 4/27/05, Sean Corfield <[EMAIL PROTECTED]> wrote:
>
> On 4/27/05, COLLIE David <[EMAIL PROTECTED]> wrote:
> > Whilst I agree with you about implicitly coercing the numeric result,
> > I'm sure I've heard Mr Cofield (or rathter certain guidelines) advocate
> > that very method in coding guidelin
On 4/27/05, COLLIE David <[EMAIL PROTECTED]> wrote:
> Whilst I agree with you about implicitly coercing the numeric result,
> I'm sure I've heard Mr Cofield (or rathter certain guidelines) advocate
> that very method in coding guidelines... Are the ones I got out of date
> of have I got my memories
In Java, numbers are not boolean values, and if you try to use one as
such you'll get a compiler error.
I'm not saying that "NOT len(string)" is a no-no, just that I think
"len(string) EQ 0" is clearer and easier to understand. It's all
personal preference. If Sean's guidelines recommend the for
Bryan Stevenson wrote:
> arrrgg...listen to Barney (and me and Dave W)...just do it in the null
> attributeno silly JS neededyou're making it WAY too complicated and
> it will be a monster to maintain.
>
> sorry for the rantit just pains me to see these kinds of "solutions" ;-)
heh ... it was probably CFSCRIPT, was curious how in the world JS could be
used for this, now THAT would be over-complicated I am sure.
On 4/27/05, Bryan Stevenson <[EMAIL PROTECTED]> wrote:
>
> All the posts not from Barney/Dave/myselfnot sure who specifically...I
> just saw the "solution"
All the posts not from Barney/Dave/myselfnot sure who specifically...I
just saw the "solution" heading off in the wrong direction IMHO
and perhaps it was CFSCRIPT and not JS (just remembering the mention of a
UDF now)
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
E
Who suggested a method using JS?
On 4/27/05, Bryan Stevenson <[EMAIL PROTECTED]> wrote:
>
> arrrgg...listen to Barney (and me and Dave W)...just do it in the null
> attributeno silly JS neededyou're making it WAY too complicated
> and
> it will be a monster to maintain.
>
> sorry f
> is marginal at best. But at this point, we might as well be arguing about
> how many angels can dance on the head of a pin.
5..I counted...
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.88
> I'd say that's a slightly kludgy hack that I only mention
> because the 'right' solution was proposed and overruled.
> You're implicitly coercing the numeric result returned by
> 'len' into a boolean value, which works, because of the
> typeless nature of CF. By using a numeric comparison t
but I think for most NOT len(somevalue) is just as clear.
Russ
-Original Message-
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 27, 2005 11:36 AM
To: CF-Talk
Subject: Re: cfqueryparam and null values
I'd say that's a slightly kludgy hack that I o
bah! ;-)
yes I do occasionally get the good old "cannot convert to boolean" but those
are sorted before going to prod ;-)
I've been doing it since '98...little set in my ways...but I hear ya..
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone
> I'd say that's a slightly kludgy hack that I only mention
> because the 'right' solution was proposed and overruled.
> You're implicitly coercing the numeric result returned by
> 'len' into a boolean value, which works, because of the
> typeless nature of CF. By using a numeric comparison t
I'd say that's a slightly kludgy hack that I only mention because the
'right' solution was proposed and overruled. You're implicitly
coercing the numeric result returned by 'len' into a boolean value,
which works, because of the typeless nature of CF. By using a numeric
comparison that returns bo
quot;CF-Talk"
Sent: Wednesday, April 27, 2005 7:45 AM
Subject: Re: cfqueryparam and null values
> On 4/27/05, Al Everett <[EMAIL PROTECTED]> wrote:
>> On 4/26/05, Bryan Stevenson <[EMAIL PROTECTED]> wrote:
>> > > > cfsqltype="cf_sql_varchar"
>> >
arrrgg...listen to Barney (and me and Dave W)...just do it in the null
attributeno silly JS neededyou're making it WAY too complicated and
it will be a monster to maintain.
sorry for the rantit just pains me to see these kinds of "solutions" ;-)
Bryan Stevenson B.Comm.
VP & Dire
On 4/26/05, Bryan Stevenson <[EMAIL PROTECTED]> wrote:
> null="#YesNoFormat(Len(Trim(FORM.txtFirstName))#">
This is also the technique I use.
--
http://www.spreadfirefox.com/?q=affiliates&id=58370&t=1";>Get
Firefox!
http://www.spreadfirefox.com/?q=affiliates&id=58370&t=1
~~
On 4/27/05, Al Everett <[EMAIL PROTECTED]> wrote:
> On 4/26/05, Bryan Stevenson <[EMAIL PROTECTED]> wrote:
> > > null="#YesNoFormat(Len(Trim(FORM.txtFirstName))#">
>
> This is also the technique I use.
Of course I put "EQ 0" at the end there.
--
http://www.spreadfirefox.com/?q=affiliates&id=58
Pete Ruckelshaus wrote:
> OK, here's what I did, a bit more elegant than the first time. I
> added the following to my UDF library include file:
Um... why not:
function isNullNumeric(str) {
return not isNumeric(str);
}
function isNullString(str) {
return len(trim(str)) eq 0;
}
fun
Why are you bothering with those functions? Not to mention the fact
that you haven't 'var' scoped any of the local variables, and that
they can all be simplified to a single line (function
isNullNumeric(str) { return NOT isNumeric(str); }).
Surely this is simpler (note the isNumeric call directly
OK, here's what I did, a bit more elegant than the first time. I
added the following to my UDF library include file:
function isNullNumeric(str) {
if (isNumeric(str)) {
response = "no";
} else {
response = "yes";
}
return response;
}
I always forget that comparison operators generate a result
Hence things are possible like:
or null="#myVar EQ 10#" in cfqueryparam tags (null takes a
string-literal representation of a boolean, hence that resolves to
null="true" or null="false").
They generate a result as surely as math op
This is the method I use and I find I only need to use it when dealing with
dates. Probably because I tend to default numerics to zero.
On 4/26/05, Pete Ruckelshaus <[EMAIL PROTECTED]> wrote:
>
> Here's what I'm doing:
>
> QUERY
>
>
> if (isNumeric(getDataCards.dcardid)) {
> dcardid_null="no
errrp...thanks Dave...yep...shoulda checked before the evil "Send" ;-)
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: [EMAIL PROTECTED]
web: www.electricedgesystems.com
~
> cfsqltype="cf_sql_varchar"
> null="#YesNoFormat(Len(Trim(FORM.txtFirstName))#">
You just made the same mistake I often make. If the user entered a value,
that's when you don't want to use NULL:
NULL="#YesNoFormat(not Len(Trim(Form.txtFirstName))#">
Dave Watts, CTO, Fig Leaf Software
http://w
Here's what I'm doing:
QUERY
if (isNumeric(getDataCards.dcardid)) {
dcardid_null="no";
} else {
dcardid_null="yes";
}
And in the insert statement:
So, yeah, I'm using the null attribute, I just don't want to go
through the shenanigans
How does this treat you?
cheers,
barneyb
On 4/26/05, Pete Ruckelshaus <[EMAIL PROTECTED]> wrote:
> Are there any best practices for nulling cfqueryparam values?
> Currently I'm having to write a cfscript before this insert query that
> checks each value and then sets a specific null variable va
HTH
Cheers
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: [EMAIL PROTECTED]
web: www.electricedgesystems.comcom/tiny.cfm/54
~
I didn't quite understand your email, but there is an attribute
null="yes|no" for cfqueryparam. Is that of any use to you?
Ade
-Original Message-
From: Pete Ruckelshaus [mailto:[EMAIL PROTECTED]
Sent: 26 April 2005 22:02
To: CF-Talk
Subject: cfqueryparam and null values
Are there any be
there is a null attribute for that takes a yes/no value. even
if you have a value specified, if 'null' is set to yes, a null value gets
inserted.
On 4/26/05, Pete Ruckelshaus <[EMAIL PROTECTED]> wrote:
>
> Are there any best practices for nulling cfqueryparam values?
> Currently I'm having to
--
Damien McKenna - Web Developer - [EMAIL PROTECTED]
The Limu Company - http://www.thelimucompany.com/ - 407-804-1014
#include
~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://w
Tuesday, September 30, 2003 10:33 AM
Subject: RE: cfqueryparam and NULL values (SELECT)
> There is no way to use CFQUERYPARAM to pass a NULL to the
> database, so for that 'value' (and that value alone) you
> HAVE to use it directly.
This may be true sometimes, but i
Well, learn something new every day.
-Original Message-
From: Dave Watts [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 30, 2003 10:33 AM
To: CF-Talk
Subject: RE: cfqueryparam and NULL values (SELECT)
> There is no way to use CFQUERYPARAM to pass a NULL to
t: Tuesday, September 30, 2003 1:33 PM
To: CF-Talk
Subject: RE: cfqueryparam and NULL values (SELECT)
> There is no way to use CFQUERYPARAM to pass a NULL to the
> database, so for that 'value' (and that value alone) you
> HAVE to use it directly.
This may be true sometimes,
> There is no way to use CFQUERYPARAM to pass a NULL to the
> database, so for that 'value' (and that value alone) you
> HAVE to use it directly.
This may be true sometimes, but isn't always true. That's why CFQUERYPARAM
has a NULL attribute - for exactly those cases. Some databases do allow the
CFQUERYPARAM is only useful for dynamic information. It makes the
statements faster with most DBMSs (using prepared statements), and also
provides a level of security, because it prevents SQL injection attacks.
For any hard coded values (numbers, strings, whatever), you can use
CFQUERYPARAM if you
> trying to do the following query:
>
> SELECT *
> FROM tblCheckout
> WHERE
> videoID =
> cfsqltype="cf_sql_integer"> AND
> actual_returndate =
> cfsqltype="cf_sql_date" null="yes">
>
> i'm getting 0 records returned, where I know there is 1
> record that matches the criteria.
>
> I
38 matches
Mail list logo