Specials CreationDate and LastUpdatedDate not working.

12 views
Skip to first unread message

vandarin

unread,
Oct 5, 2010, 2:54:28 PM10/5/10
to DataMgr
Hi -

First off, I love DataMgr, it is saving so much time!

The issue I'm having is with Specials definitions. I have the
following that I'm loading with loadXML()

<table introspect="true" name="customers">
<field ColumnName="loginId" PrimaryKey="true" AllowNulls="false"
CF_DataType="CF_SQL_INTEGER" />
<field ColumnName="dateCreated" CF_DataType="CF_SQL_DATE"
Special="CreationDate" />
<field ColumnName="dateUpdated" CF_DataType="CF_SQL_DATE"
Special="LastUpdatedDate" />
<!-- snip -->
</table>

However, when I do either insertRecord() or updateRecord(), the row is
inserted/updated, but the two date fields are still set to NULL. I've
tried setting allowNulls="false", but then I get the error "Field
'dateCreated' doesn't have a default value"

On a previous install, I worked around this by manually setting the
defaults to getdate() or CURRENT_TIMESTAMP, but this application will
need to be installed on both MySQL and MSSQL, so I'd like to be able
to have one XML file populate both types.

Any ideas? Am I missing something obvious?

Thanks
Lane Roberts

Steve Bryant

unread,
Oct 5, 2010, 3:56:27 PM10/5/10
to dat...@googlegroups.com
Lane,

You might check to make sure the 2nd and 3rd argument of loadXml() are
both true. Otherwise, DataMgr will ignore the definitions for those
columns. This is functionality that I may need to adjust, but in the
meantime I think that should get you going.

Let me know how you get on with that.

Thanks,

Steve

Lane Roberts

unread,
Oct 5, 2010, 4:40:57 PM10/5/10
to dat...@googlegroups.com
Ok, I think I got it. I was using loadXml(xml, true, true). However, I was not letting the DataMgr object persist. I was resetting it after I ran loadXml.

This also explains what I was seeing on the previous site, where sometimes it would work and sometimes it wouldn't. When it worked, I hadn't reloaded the application, so DataMgr had persisted the Specials information. As soon as I reloaded my app, it reset DataMgr, and it stopped updating the special fields.

I've added a loadXml() line to my onApplicationStart() method, right after initializing DataMgr, and everything looks good so far.

Thanks for your help,

Lane

--
You received this message because you are subscribed to the Google Groups "DataMgr" group.
To post to this group, send email to dat...@googlegroups.com.
To unsubscribe from this group, send email to datamgr+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/datamgr?hl=en.


Reply all
Reply to author
Forward
0 new messages