r9799 - helma-ng/trunk/modules/helma/storage

[email protected] Sat, 16 May 2009 21:45:50 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090516194550.3CB5A3D0D6@mia>
Author: hannes
Date: 2009-05-16 21:45:50 +0200 (Sat, 16 May 2009)
New Revision: 9799

Modified:
   helma-ng/trunk/modules/helma/storage/googlestore.js
Log:
Use specialized Text class to be able to store strings > 500 chars in google datastore.

Details at http://dev.helma.org/trac/helma/changeset/9799

Modified: helma-ng/trunk/modules/helma/storage/googlestore.js
===================================================================
--- helma-ng/trunk/modules/helma/storage/googlestore.js	2009-05-16 19:45:48 UTC (rev 9798)
+++ helma-ng/trunk/modules/helma/storage/googlestore.js	2009-05-16 19:45:50 UTC (rev 9799)
@@ -60,6 +60,9 @@
                 }
             });
             value = list;
+        } else if (typeof value === 'string' && value.length > 500) {
+            // maximal length for ordinary strings is 500 chars in datastore
+            value = new Text(value); 
         }
         entity.setProperty(id, value);
     }
@@ -133,6 +136,8 @@
                                new Storable(obj.getKind(), obj) : obj);
                 }
                 value = array;
+            } else if (value instanceof Text) {
+                value = value.getValue();
             } else {
                 value = Context.javaToJS(value, global);
             }