On 30-5-2018 02:45, Adriano dos Santos Fernandes wrote:
Hi!
Here is first prototype of a system package, which worth discuss.
I have put the RDB$ prefix on the package name, as liking very much or
not, is the system prefix of Firebird objects.
I did not named its sub routines or they parameters with RDB$ prefix.
That's totally annoying and unnecessary.
I agree.
I added the _UTIL suffix as there is already and will not be removed the
virtual table RDB$TIME_ZONES. I think RDB$TIME_ZONE name for the package
would be hence confusing.
Here is the usage of the two current sub routines.
Function DATABASE_VERSION
-----------
SQL> select rdb$time_zone_util.database_version() from rdb$database;
DATABASE_VERSION
================
2017c
-----------
Minor nitpick: the current db is 2018e.
It worth discuss the name conversion. Should it be prefixed by GET_
(DATABASE_VERSION)?
I think it is fine to leave that off.
Procedure TRANSITION_RULES
-----------
SQL> set list on;
SQL>
SQL> select * from rdb$time_zone_util.transition_rules(
CON> 'America/Sao_Paulo',
CON> date '2016-01-01',
CON> date '2019-12-31');
RULE_START 2015-10-18 03:00:00.0000 GMT
RULE_END 2016-02-21 01:59:59.9999 GMT
ZONE_OFFSET -180
DST_OFFSET 60
I find this a bit confusing. If I'm interpreting it right, this means
the actual zone offset is -120. Maybe add an extra column
EFFECTIVE_OFFSET (or something like that). Presence of that could make
it more self-explanatory.
..
-----------
It list all transition rules from the start to the end date, including
the pre-start and post-end in the same rule set of start and end
respectively.
I'm deliberately returning the timestamps in GMT time zone, but they can
be easily converted to the wanted one.
The input parameter names are TIMEZONE_NAME, FROM_TIMESTAMP and
TO_TIMESTAMP.
The name convention also worth discuss, should it be prefixed by GET_ or
LIST_ ?
Again, I don't think that is necessary.
For GMT it will list:
-----------
SQL> select * from rdb$time_zone_util.transition_rules(
CON> 'GMT',
CON> date '2016-01-01',
CON> date '2019-12-31');
RULE_START 0001-01-01 00:00:00.0000 GMT
RULE_END 9999-12-31 23:59:59.9999 GMT
ZONE_OFFSET 0
DST_OFFSET 0
-----------
--
Mark Rotteveel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel