diff options
author | Ingela Anderton Andin <[email protected]> | 2010-04-01 09:29:21 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-04-01 11:31:32 +0200 |
commit | 87bd1e8987ba216cb66f680094939cae333f2077 (patch) | |
tree | e57c313b198621a5f6c415f2208537816a79ac03 /lib/odbc/src | |
parent | 71238dc853d1e56b34b883b233d99d4480f6bffa (diff) | |
download | otp-87bd1e8987ba216cb66f680094939cae333f2077.tar.gz otp-87bd1e8987ba216cb66f680094939cae333f2077.tar.bz2 otp-87bd1e8987ba216cb66f680094939cae333f2077.zip |
OTP-8511 Timestamps in ODBC
Now supports SQL_TYPE_TIMESTAMP on the format {{YY, MM, DD}, {HH, MM, SS}}.
Thanks to Juhani Ränkimies.
Diffstat (limited to 'lib/odbc/src')
-rw-r--r-- | lib/odbc/src/odbc.erl | 10 | ||||
-rw-r--r-- | lib/odbc/src/odbc_internal.hrl | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/odbc/src/odbc.erl b/lib/odbc/src/odbc.erl index f8914639e6..eb27a471ec 100644 --- a/lib/odbc/src/odbc.erl +++ b/lib/odbc/src/odbc.erl @@ -931,6 +931,16 @@ fix_params({sql_double, InOut, Values}) -> {?USER_DOUBLE, fix_inout(InOut), Values}; fix_params({sql_bit, InOut, Values}) -> {?USER_BOOLEAN, fix_inout(InOut), Values}; +fix_params({'sql_timestamp', InOut, Values}) -> + NewValues = + case (catch + lists:map(fun({{Year,Month,Day},{Hour,Minute,Second}}) -> + {Year,Month,Day,Hour,Minute,Second} + end, Values)) of + Result -> + Result + end, + {?USER_TIMESTAMP, fix_inout(InOut), NewValues}; %% default is IN %%% fix_params({Type, Values}) -> fix_params({Type, in, Values}). diff --git a/lib/odbc/src/odbc_internal.hrl b/lib/odbc/src/odbc_internal.hrl index 10ed139338..aa60120f9a 100644 --- a/lib/odbc/src/odbc_internal.hrl +++ b/lib/odbc/src/odbc_internal.hrl @@ -71,6 +71,7 @@ -define(USER_TINY_INT, 11). -define(USER_WCHAR, 12). -define(USER_WVARCHAR, 13). +-define(USER_TIMESTAMP, 14). %% INPUT & OUTPUT TYPE -define(IN, 0). |