Function summary

The following table lists the script functions and the equivalent ColdFusion tag.

Function

Equivalent ColdFusion Tag

dbinfo

cfdbinfo

imap

cfimap

pop

cfpop

ldap

cfldap

feed

cffeed

dbinfo

Description

Used in CFScript to retrieve information about a data source such as database details, tables, queries, procedures, foreign keys, indexes, and version information about the database, driver, and JDBC.

Syntax

Mode

Syntax

Creating the service

new dbinfo() or createObject("component", "dbinfo");

Executing the service action

dbinfoService.action_method(attribute-value_pair);

Initializing the attributes

See Initializing the attributes below.

Getting the CFC properties

See Getting the CFC Properties below.

Working with the data returned

data=dbinfoService.action_method(attribute-value_pair);writedump(data);

Properties

datasource

dbname

name

password

pattern

table

username

All attributes supported by the tag cfdbinfo can be used as attribute-value pairs. For example,

<cfdbinfo userName="myUserName">

can be used as

dbinfoService.setUserName("myUserName");

For details, see the Attributes section for the cfdbinfo tag.

See also

Function summary

History

ColdFusion 9.0.1: Added this function.

Methods

The following dbinfo types are available as methods. All methods have similar arguments and syntax.

  •  

    dbnames

    tables

    columns

    version

    procedures

    foriegnkeys

    index

     

    Description

    All methods correspond to the type of information supported by the tag cfdbinfo. For details of each method, see the relevant section for the tag cfdbinfo in ColdFusion 9 CFML Reference.

    Returns

    All methods return a query object.

    Syntax

    dbinfoService.methodName(attribute-value pair);

    Arguments

    All attributes supported by the tag cfdbinfo.

     

  • setAttributes, getAttributes, clearAttributes, clear, setProperties, getProperties, clearProperties, and clearProperties. For details, see Methods common to all functions.

Usage

This function corresponds to the tag cfdbinfo. For details, see the Usage section for the tag cfdbinfo.

Example

<cfscript>

d = new dbinfo(datasource=" cfartgallery ").dbnames(datasource="ajax");
writedump(d);
d = new dbinfo(datasource=" ajax").dbnames();
writedump(d);
</cfscript>

imap

Description

Used in CFScript to query an IMAP server to retrieve and manage mails within multiple folders.

Syntax

Mode

Syntax

Creating the service

new imap(); or createObject("component", "imap");

Initializing the attributes

See Initializing the attributes below.

Executing the service action

imapService.methodName(_attribute-value_pair_)

Getting the CFC properties

See Getting the CFC Properties below.

Working with returned data

imapResult=imapService.action_method(_attribute-value_pair_);

Properties

attachmentpath

connection

folder

generateuniquefilenames

maxrows

messagenumber

name

newfolder

password

port

recurse

secure

server

startrow

stoponerror

timeout

uid

username

 

 

All attributes supported by the tag cfimap can be used as attribute-value pairs. For example,

<cfimap action="open" connection = "myconnection">

can be used as

imapService = new imap(server="myimapserver",username="myusername",password="mypassword",port=
"myport",secure="yes");
imapService.open();

 

Note: If connection properties such as server, username, password, port, and secure are specified either during initialization or when open method is called, a connection is created implicitly. Therefore, you need not specify the properties for further actions. If sandbox security is turned on, the directory referred to by the property attachmentPath must be given the required permission. By default, the temp directory is used.

For details of the attributes, see the Attributes section for the tag cfimap.

See also

Function summary

History

ColdFusion 9.0.1: Added this function.

Methods

The following imap actions are available as methods. All methods have similar arguments and syntax.

  •  

    getAll

    delete

    open

    close

    markRead

    createFolder

    deleteFolder

    renameFolder

    listAllFolders

    moveMail

    getHeaderOnly

     

    Description

    All methods correspond to the type of information supported by the tag cfimap. For details of each method, see the relevant section of cfimap in the ColdFusion 9 CFML Reference.

    Returns

    A query object for methods getAll, getHeaderOnly, and listAllFolders. Else, nothing.

    Syntax

    imapService.methodName(attribute-value pair);

    Arguments

    All attributes supported by the tag cfimap.

     

  • setAttributes, getAttributes, clearAttributes, clear, setProperties, getProperties, and clearProperties. For details, see Methods common to all functions.

Usage

This function corresponds to the tag cfimap. See the Usage section for cfimap in the ColdFusion 9 CFML Reference for details.

Example

<cfscript>

m = new imap();
m.setAttributes(server="#REQUEST.server#",username="#REQUEST.username#",
password="#REQUEST.password#",secure="#REQUEST.secure#",
connection="#REQUEST.connectionname#",stoponerror="#REQUEST.stoponerror#");
m.open();
master = m.getAll(connection = "#REQUEST.connectionname#",name = "queryname", stoponerror = "#REQUEST.stoponerror#" );
writedump(master);

</cfscript>

pop

Description

Used in CFScript to retrieve or delete e-mail messages from a POP mail server.

Syntax

Mode

Syntax

Creating the service

new pop(); or createObject("component", "pop");

Initializing the attributes

See Initializing the attributes below.

Executing the service action

popService.action_method(_attribute-value_pair_);

Getting the CFC properties

See Getting the CFC Properties below.

Working with data returned

popresult = popService.action_method (attribute-value pair); where popresult is a query object if the action_method is getAll or getHeaderOnly. For any other method, nothing is returned.

Properties

server

attachmentPath

debug

generateUniqueFilenames

maxRows

messageNumber

name

password

port

startRow

timeout

uid

username

 

 

All attributes supported by the tag cfpop can be used as attribute-value pairs. For example,

<cfpop server = "#form.popserver# " action = "getHeaderOnly" name = "GetHeaders">

can be used as

popHeaders = popService.getHeaderOnly(server="#form.popserver#");

 

Note: name is a required attribute in cfpop, but not in CFScript.

See also

Function summary

History

ColdFusion 9.0.1: Added this function.

Methods

The following pop actions are available as methods. All methods have similar arguments and syntax.

  •  

    getHeaderOnly

    getAll

    delete

     

  •  

    Description

    All methods correspond to the type of information supported by the tag cfpop. For details of each method, see the relevant section of cfpop in the ColdFusion 9 CFML Reference.

    Returns

    All methods except delete returns a query object.

    Syntax

    popService.methodName(attribute-value pair)

    Arguments

    All attributes supported by the tag cfpop.

     

  • setAttributes, getAttributes, clearAttributes, clear, setProperties, getProperties, and clearProperties. For details, see Methods common to all functions.

Usage

This function corresponds to the tag cfpop. For usage details, see the Usage section for cfpop__.

Example

<cfscript>

p = createObject("component","pop");
p.setAttributes(server="#popServer#",username="failoveruser",password="
#popPassword#");
r = p.GetAll(name="results",maxRows = "2");

writeoutput("getAll Passed<br>");

r = p.GetAll(messageNumber = "2");
writeoutput(#r.FROM# & "<br>");


r= p.GETHEADERONLY(messageNumber = "1");
writeoutput(#r.subject# & "<br>");


</cfscript>

ldap

Description

Used in CFScript to provide an interface to a Lightweight Directory Access Protocol (LDAP) directory server, such as the Netscape Directory Server.

Syntax

Mode

Syntax

Creating the service

new ldap(); or createObject("component", "ldap");

Initializing the attributes

See Initializing the attributes below.

Executing the service action

ldapService.action_method(attribute-value pair);

Getting the CFC properties

See Getting the CFC Properties below.

Working with data

ldapresult = ldapService.query(attribute-value pair).For other methods, nothing is returned.

Properties

server

attributes

delimiter

dn

filter

maxRows

modifyType

name

password

port

rebind

referral

returnAsBinary

scope

secure

separator

sort

sortcontrol

start

startRow

timeout

userName

 

All attributes supported by the tag cfldap can be used as attribute-value pairs. For example,

<cfldap action="add" server="ldap.uconn.edu">

can be used as

ldapService.add(server="ldap.uconn.edu");

For details, see the Attributes section for the tag cfldap.

Methods

The following ldap actions are available as methods. All methods have similar arguments and syntax.

  •  

    query

    add

    modify

    modifyDn

    delete

     

     

  •  

    Description

    All methods correspond to the actions supported by the tag cfldap. For details of each method, see the relevant section of cfldap in the ColdFusion 9 CFML Reference.

    Returns

    If method is query, returns a query object. Else, none.

    Syntax

    ldapService.methodName(attribute-value pair)

    Arguments

    All attributes supported by the tag cfldap.

     

  • setAttributes. For details, see Methods common to all functions
  • getAttributes, clearAttributes, clear, setProperties, getProperties, and clearProperties. For details, see Methods common to all functions.
  • setLdapAttributes

    Description

    Sets the property attributes.

    Returns

    Nothing

    Syntax

    ldapService.setLdapAttributes(attribute-value);

    Arguments

    A string that contains the value of the property attributes.

     

  • getLdapAttributes

    Description

    Gets the property attributes.

    Returns

    A string that contains the value of the property attributes.

    Syntax

    myattributes = ldapService.getLdapAttributes(__);

     

See also

Function summary

History

ColdFusion 9.0.1: Added this function.

Usage

This function corresponds to the tag cfldap. For usage details, see the Usage section for cfldap.

Example

<cfscript>

l = new ldap();
l.setLdapAttributes("objectclass=top, person, organizationalPerson, inetOrgPerson;cn=Joe Smith; sn=Smith; mail=spenella@allaire.com; telephonenumber=(617) 761 - 2128");
l.setUsername("uid=admin,ou=system");
l.setPassword("administrator");
l.setPort(port);
l.setServer(ldapserver);

l.setdn("ou=People+o=aribus.com,dc=example,dc=com");

l.add();-

l.clearAttributes(); result = l.query(name="apache",
attributes="dn,cn,o,ou,c,mail,telephonenumber",
start="dc=example,dc=com",
scope="SUBTREE",
filter="(&(cn=Joe Smith)(ou=people))";

writeoutput("<b>Adding and Querying a LDAP entry : </b>" & "CN = " & result.CN & " DN = " & result.DN & "<br> ");
l.clearAttributes();
l.delete(
DN="ou=People+o=aribus.com,dc=example,dc=com",
);


</cfscript>

feed

Description

Used in CFScript to read or create an RSS or Atom syndication feed. This service reads RSS versions 0.90, 0.91, 0.92, 0.93, 0.94, 1.0, and 2.0, and Atom 0.3 or 1.0. It can create RSS 2.0 or Atom 1.0 feeds.

Syntax

Mode

Syntax

Creating the service

new feed() or createObject("component" "feed")

Initializing the attributes

See Initializing the attributes below.

Executing the service action

feedService.action_method(attribute-value_pair)

Getting the CFC properties

See Getting the CFC Properties below.

Working with the data returned

  • feedresult = feedService.read(attribute-value_pair) where feedresult is a struct with the keys name, query, properties, and xmlvar.
  • feedresult = feedService.create(attribute-value_pair) where feedresult is a string that contains the xmlvar.

Properties

columnMap

enclosureDir

escapeChar

ignoreEnclosureError

name (optional in CFScript)

outputFile

overwrite

overwriteEnclosure

properties (optional in CFScript)

proxyPassword

proxyPort

proxyServer

proxyUser

query (optional in CFScript)

source

timeout

useragent

xmlvar (optional in CFScript)

 

 

All attributes supported by the tag cffeed can be used as attribute-value pairs. For example,

<cffeed action="read" source="http://googleblog.blogspot.com/atom.xml"
query="feedQuery" properties="feedMetadata" >

can be used as

feedservice.read(source="http://googleblog.blogspot.com/atom.xml",
query="feedQuery", properties="feedMetadata");

See also

Function summary

History

ColdFusion 9.0.1: Added this function.

Methods

  • create

    Description

    Creates an RSS 2.0 or Atom 1.0 feed XML document and saves it in a variable, writes it to a file, or both.

    Returns

    String representing the xmlvar

    Syntax

    feedService.create (attribute-value pair);

    Arguments

    All attributes supported by the tag cffeed.

     

  • read

    Description

    Parses an RSS or Atom feed from a URL or an XML file and saves it in a structure or query. You can also get feed metadata in a separate structure.

    Returns

    Struct with the following keys:

     

  • name
  • query
  • properties
  • xmlvar

    Syntax

    feedService.read (attribute-value pair);

    Arguments

    All attributes supported by the tag cffeed.

     

  • setAttributes, getAttributes, clearAttributes, clear, setProperties, getProperties, and clearProperties. For details, see Methods common to all functions Methods common to all functions.
  • getFeedProperties

    Description

    Returns the value of the property properties.

    Returns

    Struct or error (if property is not set)

    Syntax

    feedService.getFeedProeprties()

    Arguments

    None

     

  • setFeedProperties

    Description

    Sets the value of the property properties.

    Returns

    Nothing

    Syntax

    feedService.setFeedProperties()

    Arguments

    properties struct

     

Usage

This service corresponds to the tag cffeed. For usage, see Usage section for cffeed.

Example

<cfscript>
f = new feed();
r = f.read(source=feedpath);

writeoutput("Name : " & r.name.title & "<br>");
writeoutput("Properties : " & r.properties.version & "<br>");
writeoutput("Query : " & r.query.recordcount & "<br>");
writeoutput("XMLVar : " & r.xmlvar.length() & "<br>");
</cfscript>

Methods common to all functions

The following methods are common to all script functions:

  • setAttributes

    Description

    Sets attributes for the function.

    Returns

    Nothing

    Syntax

    service_name.setAttributes (attribute-value pair);

    Arguments

    All attributes supported by the equivalent tag.

     

  • getAttributes

    Description

    Gets the attributes set for the function.

    Returns

    Returns a struct with all or some attribute values.

    Syntax

    service_name.get_Attributes_ (attributelist);

    Arguments

    A comma-separated list of attributes. If no list is specified, all defined attributes are returned.

     

  • clearAttributes

    Description

    Removes all attributes added for the function.

    Returns

    Nothing

    Syntax

    _service_name.clearAttributes(_attribute_list);

    Arguments

    A comma-separated list of attributes.

     

  • clear

    Description

    Removes all attributes added for the function.

    Returns

    Nothing

    Syntax

    service_name.clear();

    Arguments

    None

     

  • clearProperties

    Description

    Removes all properties added for the function.

    Returns

    Nothing

    Syntax

    service_name.clearProperties(attribute_list);

    Arguments

    If nothing is specified, all properties are cleared.

     

  • setProperties

    Description

    Sets properties for the function.

    Returns

    Nothing

    Syntax

    service_name.setproperties (attribute-value pair);

    Arguments

    All attributes supported by the equivalent tag.

     

  • getProperties

    Description

    Gets the properties set for the function.

    Returns

    Returns a struct with all or some attribute values.

    Syntax

    service_name.getproperties (attributelist);

    Arguments

    A comma-separated list of attributes. If no list is specified, all defined attributes are returned.

     

Initializing the attributes

You can initialize the attributes using one of the following ways:

  • service_name=new dbinfo(attribute-value pair)
  • service_name=new dbinfo().init(attribute-value pair)
  • service_name.setAttributes(_attribute-value pair_)
  • service_name.setA_ttributeName_(attribute_value)
  • service_name.action_method(attribute-value_pair)
  • service_name.setProperties (attribute_value)

Getting the CFC Properties

Get the CFC properties using one of the following ways:

  • service_name.getAttributeName(attributelist)
  • service_name.getProperties (attributelist)
  • service_name.getAttributes(attributelist)

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy