Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WDDX Max Size? 1

Status
Not open for further replies.

cash0

Programmer
May 23, 2001
22
AU
I'm having trouble with truncated wddx packets.

The error message is usually something like: "WDDX packet parse error at line 1, column -1. End of entity not allowed; an end tag is missing.. "

The problem is that the wddx xml string is getting truncated. So decided I count the number of characters in this string and a very suspicious number of 63,999 came up.

Is there some kind of character limit on the size of wddx strings, and if so, is there anything I can do to store any more than 63,999 characters.

 
My guess is that you are using a url or the GET method in a form. If this is true and you are using IE as your browser, the truncation is most likely due to the fact that the url will only support up to about 2000 characters.

Your solution would be to pass your wddx packet through a form using the POST method.
 
I checked that, but that is not the case.

My attention has turned to the update query that places the wddx data into the database. My code looks something like:

------------

<cfwddx action=&quot;cfml2wddx&quot; input='#this.arevisions#' output=&quot;xmlrevisions&quot;>

<cfquery name=&quot;qSaveWorkflow&quot; datasource=&quot;#request.stdsn.content#&quot;>
update tWorkflow
set xmlrevisions = <cfqueryparam value=&quot;#xmlrevisions#&quot; cfsqltype=&quot;cf_sql_longvarchar&quot; null=&quot;NO&quot;>
where Workflowuuid = '#this.workflowuuid#'
</cfquery>

----------

For some reason, the cfqueryparam is cutting off the string at the 64000th character.

Does anyone know of a size limit on SQL statements or a size limit on cfqueryparam?
 
I would fully expect that to be the upper limit of a varchar type.

Have you tried using a CLOB instead? What type of database are you using?



-Carl
 
I've finally fixed it I think.

Initially I thought it was to do with wddx, but then I soon realized that the SQL query just was not writing more and 64000 characters. Furthermore, it didn't read more than 64k either. I don't know if it is a ColdFusion limitation or a SQL server limitation.

So after many hours of trial and error I've come up with a solution involving the UPDATETEXT and READTEXT features of SQL Server. To do this, I had to split my xmlstring into chunks of 64k and loop through a query appending the chunks to the existing data. The code looked something like this:

-----------------

<cfquery name=&quot;qUpdateXMLRevisions&quot; datasource=&quot;#request.stdsn.content#&quot;>
<cfloop from=&quot;1&quot; to=&quot;#ArrayLen(aRevisionTokens)#&quot; index=&quot;i&quot;>
-- Get the pointer to the field
DECLARE @ptrval#i# varbinary(16)
SELECT @ptrval#i# = TEXTPTR(XMLRevisions)
FROM tWorkflow
WHERE workflowUUID = '#this.workflowuuid#'

-- Append the substring to the end of the field.
UPDATETEXT tWorkflow.XMLRevisions @ptrval#i# NULL NULL <cfqueryparam value=&quot;#aRevisionTokens#&quot; cfsqltype=&quot;cf_sql_longvarchar&quot; null=&quot;NO&quot;>
</cfloop>
</cfquery>

------------------

Then I had to do a very similar thing to get the data using READTEXT where I read 64k at a time and appended it to a string.

For the record I was doing this with ColdFusionMX, SQL Server 2000, the ColdFusion SQL Server driver, and the xmlrevisions field is of type 'text(16)'.
 
If you check out the advanced settings for your datasource in the CFMX administrator, you will see two buffer settings, which default to 64000 characters max. I think you want to raise the upper limit of the one below:

Long Text Buffer(chr) 64000

Also, you might want to enable CLOB and/or BLOB data retrieval if your application needs this functionality.

To get to the Advanced Settings menu, select Data Sources from the menu on the left in the administrator, click your datasource name that appears in the list, and lastly click the &quot;Show Advanced Settings&quot; button.

-Tek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top