SELECT * FROM stuff H...">

How to remove a string from a ColdFusion request?

Given the request (pseudo-code):

<cfquery name="myquery">SELECT * FROM stuff</cfquery>

How do I get rid of the first record? In this case, changing SQL is not an option. I tried: myquery.RemoveRows(0,1);but received an error message:

No matching Method/Function for Query.REMOVEROWS(numeric, numeric) found

I am on a Railo 3 BTW

+5
source share
6 answers

Lo and here:

myquery.RemoveRow(1);

This is exactly what I wanted. Leave this Railo to do something different!

+11
source

It is impossible to think of a way to remove a row from the original object. I can think of two things:

  • Performs a query request. It is assumed that you can identify records that you do not want and specify them in WHERE.

  • queryNew(). querySetCell() . UDF. , , , cflib.org. . # 3

  • cflib.org:) http://www.cflib.org/udf/QueryDeleteRows

+4

"RemoveRows" Java-, . :

myquery.RemoveRows(
    JavaCast( "int", 0 ) // starting row, zero-based
    ,JavaCast( "int", 1 ) // number to delete, returns error if too many
)

, , "int, int", , ", ". , , , ( ) , , .

+2

Railo removeRows, . . ACF, , Railo, .

Railo ACF. ( , Railo 0, ACF- 1.)

+2

, :

SELECT * FROM myquery
LIMIT {1,10000}

This should work in Railo. What he does is offset the request one at a time and pull out 10,000 records.

You can also do this:

SELECT * FROM myquery
WHERE {primarykey} <> {value}

Where he selects all records except the primary key value that you pass.

The great thing about ColdFusion is that there are many ways to do exactly what you are looking for.

0
source

You can simply skip the line when processing the results:

<cfoutput query="myquery">
  <cfif myquery.currentrow GT 1>
    <!---Do the work here. --->
  </cfif>
</cfoutput>
0
source

All Articles