Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support date type on mysql adapter #42

Merged
merged 1 commit into from Oct 19, 2012

Conversation

Projects
None yet
2 participants

davebcn commented Oct 17, 2012

Hi guys,

we're facing the case of having date types columns on our mysql schema.

We don't have a date type on boss_db , I guess because on erlang we deal only with datetimes and now-like structure.

Storing dates and query using them is working if you pad them as datetimes ({Date, {0,0,0}}) so no problem here.

The only problem is when you try to read or update an already present element that includes a date type row. We got something like that

[{boss_db_adapter_mysql,pack_value,
[{date,{2012,7,31}}],
[{file,"src/db_adapters/boss_db_adapter_mysql.erl"},
{line,422}]},

I added support for this case so when we recover a date value from mysql db is gracefully translated to their datetime version.

Contributor

evanmiller commented Oct 19, 2012

Explicitly supporting a "date" type would be best so that it works with type-validation, but I guess this is a reasonable hack for now.

@evanmiller evanmiller added a commit that referenced this pull request Oct 19, 2012

@evanmiller evanmiller Merge pull request #42 from davebcn/master
Support date type on mysql adapter
e24727e

@evanmiller evanmiller merged commit e24727e into ErlyORM:master Oct 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment