Ask a Question related to Coldfusion Database Access, Design and Development.
-
Frustated #1
QoQ and leading space(s) suppression
I am facing a peculiar problem with QoQ on CFMX 6.1
My script performs the following:
<cfquery name="Q1" datasource="DATASOURCE1">
SELECT *
FROM tblPAYMENTS
</cfquery>
Three rows are returned in the result set. One of the rows is as follows:
FIELD_1 = 'A'
FIELD_2 = ' 06 M3'
If I do a CFDUMP of query Q1, FIELD_2 does contain string listed above,
including the leading space
Frustated Guest
-
multiline textfield 'leading space' bug *still* not fixed!
I can't believe this bug is still in the flash player - it has been a known issue since flash player 5!! In case you haven't come across it, this... -
Error suppression
Hi All, I know that I can prepend functions with an '@' character in order to get them to not output any errors, but I am wondering is there any... -
#25951 [Opn->Fbk]: Error suppression operator + reference return statement => corrupt func. params
ID: 25951 Updated by: iliaa@php.net Reported By: dand at codemonkey dot ro -Status: Open +Status: ... -
#25951 [Opn]: Error suppression operator + reference return statement => corrupt func. params
ID: 25951 User updated by: dand at codemonkey dot ro Reported By: dand at codemonkey dot ro Status: Open Bug Type: ... -
#25951 [NEW]: Error suppression operator + reference return statement => corrupt func. params
From: dand at codemonkey dot ro Operating system: Debian Linux 3.0 PHP version: 4.3.3 PHP Bug Type: Unknown/Other Function... -
Dan Bracuk #2
Re: QoQ and leading space(s) suppression
Don't allow the leading spaces in the first place.
Dan Bracuk Guest
-
Frustated #3
Re: QoQ and leading space(s) suppression
Don,
I do not own the data I am retrieving, and the spaces are part of the data
structure, meaning they belong there.
I was wondering why QoQ cannot preserve the original data.
Thank you.
-Mauricio
Frustated Guest
-
efecto747 #4
Re: QoQ and leading space(s) suppression
Just replace spaces in the original select with something else so you can put
the spaces back in when you're finished qith your QofQ.
here's an example:
<cfquery name="Q1" datasource="DATASOURCE1">
SELECT FIELD_1, REPLACE(FIELD_2,' ','^^^') AS FIELD_2
FROM tblPAYMENTS
</cfquery>
Your data will look like this:
FIELD_1 = 'A'
FIELD_2 = '^^^06^^^M3'
Then run the QofQ:
<cfquery name="Q2" dbtype="query">
SELECT FIELD_2
FROM Q1
WHERE FIELD_1 = 'A'
</cfquery>
once the QofQ is run you can replace the '^^^' strings with spaces to get the
original text:
<cfoutput>
#Replace(Q2.FIELD_2, '^^^', ' ', 'ALL')#
</cfoutput>
cheers.
efecto747 Guest
-
Adam Cameron #5
Re: QoQ and leading space(s) suppression
> Next, I perform a QoQ like the following:
Other people seem to be offering suggestions as to how to work around this:>
> <cfquery name="Q2" dbtype="query">
> SELECT FIELD_2
> FROM Q1
> WHERE FIELD_1 = 'A'
> </cfquery>
>
> Now, when I do a CFDUMP of Q2, FIELD_2 value is '06 M3' (The leading spaces
> get suppressed or trimmed).
>
> How do I get around that problem?
good.
Have you raised it as a bug in CF?
--
Adam
Adam Cameron Guest
-
Adam Cameron #6
Re: QoQ and leading space(s) suppression
> Have you raised it as a bug in CF?
Actually, I was being pre-emptive there.
I cannot replicate what you say is happening on CFMX7.0. I'm using a
MS-SQL Server DB, with this driver:
"macromedia.jdbc.sqlserver.SQLServerDriver is 3.3".
I have created this table:
CREATE TABLE [Table1] (
[id_col] [int] IDENTITY (1, 1) NOT NULL ,
[space_col] [varchar] (50) NULL
) ON [PRIMARY]
I have populated it thus:
1 [no leading space]
2 [ leading space]
3 [trailing space ]
4 [ both ]
(I have put the square brackets in here simply to demonstrate where the
spacing is: the square brackets are NOT in the actual data).
I then run this process:
<cfquery name="q3" datasource="junk">
select *
from Table1
</cfquery>
<cfquery name="q4" dbtype="query">
select *
from q3
</cfquery>
<hr />
<cfoutput query="q3">
[#id_col#][#space_col#]<br />
</cfoutput>
<hr />
<cfoutput query="q4">
[#id_col#][#space_col#]<br />
</cfoutput>
And the output - from both queries - includes all the spacing I would
expect to see:
[1][no leading space]
[2][ leading space]
[3][trailing space ]
[4][ both ]
[1][no leading space]
[2][ leading space]
[3][trailing space ]
[4][ both ]
What happens if you replicate the above situation? What DB / driver / CF
version are you using?
--
Adam
Adam Cameron Guest
-
Frustated #7
Re: QoQ and leading space(s) suppression
Thank you, Adam.
Code is attached:
<cfquery name = "SALES" datasource="DATASOURCE">
SELECT CHAR_CODE, CUST_ID
FROM SALES
WHERE CUST_ID = 1
</cfquery>
Result Set:
ROW CHAR_CODE CUST_ID
---------- ------------------------------------------------ -------------
000001 06 1
000002 06 1
<cfquery name = "qGetSales" dbtype="query">
SELECT *
FROM SALES
WHERE CUST_ID = 1
</cfquery>
Result Set:
ROW CHAR_CODE CUST_ID
---------- ------------------------------------------------ -------------
000001 06 1
000002 06 1
Frustated Guest



Reply With Quote

