Use a Datasource for Client Variables


#1

In many cases, you may wish to persist your client variables somewhere other than a cookie. ColdFusion provides the ability to use your ColdFusion datasource as a client datastore.

Before you can use your datasource as a client variables datastore, you’ll need to create the necessary tables. To do this you would need to create two tables, one named cdata and one named cglobal. The proper schema for these tables can be found below. Please note that if you don’t create the proper schema, then client variables won’t persist and the failure is silent other than a ColdFusion log entry.

Table: cdata

Column

Data type

cfid

CHAR(64), TEXT, VARCHAR, or any data type capable of taking variable length strings up to 64 characters

app

CHAR(64), TEXT, VARCHAR, or any data type capable of taking variable length strings up to 64 characters

data

MEMO, LONGTEXT, LONG VARCHAR, CLOB, or any data type capable of taking long, indeterminate-length strings

Table: cdata

Column

Data type

cfid

CHAR(64), TEXT, VARCHAR, or any data type capable of taking variable length strings up to 64 characters

data

MEMO, LONGTEXT, LONG VARCHAR, CLOB, or any data type capable of taking long, indeterminate-length strings

lvisit

TIMESTAMP, DATETIME, DATE, or any data type that stores date and time values