Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including cf-query with all npm packages installed. Try it out:

var cfQuery = require("cf-query")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

cf-query v0.0.3

Use ColdFusion/Railo query JSON more easily

Query.js

Use ColdFusion/Railo query JSON more easily

Interface

next() - boolean Progresses the current row.

getValue(column) - string/null Return data for the given [column] based on the current row. Returns null if the pointer has progressed beyond the last row. Errors if the column doesn't exist.

getValueAt(column, row) - string/null Return data for the given [column] for the given row. Returns null if the pointer has progressed beyond the last row. Errors if the column doesn't exist.

reset() Sets the pointer back to the start. The start is at the beginning of the query, not the first row so next() will need to be called before the first row is accessed.

getCurrentRow() - numeric Returns the current row.

getRecordCount() - numeric Returns the record count.

Usage

// Create a new clients query - Where json is a ColdFusion query JSON string
var clients = new Query(json);

// Loop over the clients and output their first name
while (clients.next()) {
    console.log(clients.getValue("firstName"));
}
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free