Eiffel:ODBC 处理 BIGINT
Eiffel: ODBC Dealing with BIGINT
埃菲尔铁塔
我似乎从 ODBC with Eiffel DB_SELECTION.cursor 的 BIGINT 中得到了一个 INTEGER_32_REF。有时我似乎有足够的价值,但有时却没有...
946383958 => good INTEGER_32_REF (id->4 of following table)
9475984837 => 886050245 WRONG INTEGER_32_REF (id->4 of following table)
646383958 => good INTEGER_32_REF (id->3 of following table)
6475984837 => -2113949755 WRONG INTEGER_32_REF (id->4 of following table)
...
似乎不处理 BIGINT 并给出直接从 DB 值解释的 INTEGER_32_REF 值,典型情况下传递 2^32
PostgreSQL
有一个table,数据如下electricity_amount BIGINT NOT NULL DEFAULT 0
id | a_date | amount | electricity_amount | consumption_sector_id | electricity_rate_id
----+------------+-----------+--------------------+-----------------------+---------------------
1 | 2019-01-01 | 746383958 | 7475984837 | 1 | 1
2 | 2019-02-01 | 846383958 | 8475984837 | 1 | 1
3 | 2019-03-01 | 646383958 | 6475984837 | 1 | 1
4 | 2019-04-01 | 946383958 | 9475984837 | 1 | 1
默认情况下,并非所有数据类型都映射到 Eiffel 端。
因此,您需要继承 class GLOBAL_SETTINGS
并调用该功能
set_use_extended_types (True) --| Use extended types: INTEGER_64, STRING_32 etc.
埃菲尔铁塔
我似乎从 ODBC with Eiffel DB_SELECTION.cursor 的 BIGINT 中得到了一个 INTEGER_32_REF。有时我似乎有足够的价值,但有时却没有...
946383958 => good INTEGER_32_REF (id->4 of following table)
9475984837 => 886050245 WRONG INTEGER_32_REF (id->4 of following table)
646383958 => good INTEGER_32_REF (id->3 of following table)
6475984837 => -2113949755 WRONG INTEGER_32_REF (id->4 of following table)
...
似乎不处理 BIGINT 并给出直接从 DB 值解释的 INTEGER_32_REF 值,典型情况下传递 2^32
PostgreSQL
有一个table,数据如下electricity_amount BIGINT NOT NULL DEFAULT 0
id | a_date | amount | electricity_amount | consumption_sector_id | electricity_rate_id
----+------------+-----------+--------------------+-----------------------+---------------------
1 | 2019-01-01 | 746383958 | 7475984837 | 1 | 1
2 | 2019-02-01 | 846383958 | 8475984837 | 1 | 1
3 | 2019-03-01 | 646383958 | 6475984837 | 1 | 1
4 | 2019-04-01 | 946383958 | 9475984837 | 1 | 1
默认情况下,并非所有数据类型都映射到 Eiffel 端。
因此,您需要继承 class GLOBAL_SETTINGS
并调用该功能
set_use_extended_types (True) --| Use extended types: INTEGER_64, STRING_32 etc.