Had a very strange experience this evening with the GAE version of
OpenBD, which may be a bug - not sure.
I was trying to turn a CFC property into a datastore Text object if it
was too large to be a string.
The issue was that if I had the "constructor" call chained to the
createObject, the object that was getting returned was not a Text, but
was a String:
if (lcase(local.properties[local.key].type) is "string"
AND len(local.setValue) gt
variables.dataTypeUtils.MAX_STRING_PROPERTY_LENGTH) {
local.textObj =
createObject("java","com.google.appengine.api.datastore.Text").init(javacast("string",local.setValue));
local.newEntity.setProperty(local.key,local.textObj);
} else {
local.newEntity.setProperty(local.key,local.setValue);
}
This ended up with local.textObj being a String, and App Engine
throwing a "your string is longer then 500 chars, use a text" error.
But, if I did this:
if (lcase(local.properties[local.key].type) is "string"
AND len(local.setValue) gt
variables.dataTypeUtils.MAX_STRING_PROPERTY_LENGTH) {
local.textObj =
createObject("java","com.google.appengine.api.datastore.Text");
local.textObj.init(javacast("string",local.setValue));
local.newEntity.setProperty(local.key,local.textObj);
} else {
local.newEntity.setProperty(local.key,local.setValue);
}
it worked fine.
Rather unexpected - thought it might be useful to know.
Thanks!
Ed.
--
Open BlueDragon Public Mailing List
http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
mailing list - http://groups.google.com/group/openbd?hl=en
!! save a network - please trim replies before posting !!