schema/spacewalk/oracle/procs/epoch_seconds_to_timestamp_tz.sql
| 14 ++++++++
schema/spacewalk/postgres/procs/epoch_seconds_to_timestamp_tz.sql
| 16 ++++++++++
schema/spacewalk/upgrade/spacewalk-schema-1.8-to-spacewalk-schema-1.9/012-epoch_seconds_to_timestamp_tz.sql.oracle
| 14 ++++++++
schema/spacewalk/upgrade/spacewalk-schema-1.8-to-spacewalk-schema-1.9/012-epoch_seconds_to_timestamp_tz.sql.postgresql
| 16 ++++++++++
4 files changed, 60 insertions(+)
New commits:
commit 20e2c92fc7cf5c95321fcc53b168d644124a048e
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Feb 1 10:03:03 2013 +0100
Adding utility function epoch_seconds_to_timestamp_tz.
diff --git a/schema/spacewalk/oracle/procs/epoch_seconds_to_timestamp_tz.sql
b/schema/spacewalk/oracle/procs/epoch_seconds_to_timestamp_tz.sql
new file mode 100644
index 0000000..e0cb583
--- /dev/null
+++ b/schema/spacewalk/oracle/procs/epoch_seconds_to_timestamp_tz.sql
@@ -0,0 +1,14 @@
+--
+-- Take seconds since epoch (January 1, 1970 UTC) and convert it
+-- to time-zone'd timestamp.
+--
+
+create or replace function epoch_seconds_to_timestamp_tz(secs in number)
+return timestamp with local time zone
+is
+begin
+ return to_timestamp_tz('1970-01-01 00:00:00 UTC', 'YYYY-MM-DD HH24:MI:SS
TZR') + numtodsinterval(secs, 'second');
+end;
+/
+show errors
+
diff --git a/schema/spacewalk/postgres/procs/epoch_seconds_to_timestamp_tz.sql
b/schema/spacewalk/postgres/procs/epoch_seconds_to_timestamp_tz.sql
new file mode 100644
index 0000000..99ed1c9
--- /dev/null
+++ b/schema/spacewalk/postgres/procs/epoch_seconds_to_timestamp_tz.sql
@@ -0,0 +1,16 @@
+-- oracle equivalent source sha1 8cb4b4ce75b5de5afefb3ce0306453e7beb9ebd3
+--
+-- Take seconds since epoch (January 1, 1970 UTC) and convert it
+-- to time-zone'd timestamp. Mainly as compatibility with Oracle
+-- which does not have the single-parameter to_timestamp.
+--
+
+create function epoch_seconds_to_timestamp_tz(secs in numeric)
+returns timestamp with time zone
+as
+$$
+begin
+ return to_timestamp(secs);
+end;
+$$ language plpgsql;
+
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.8-to-spacewalk-schema-1.9/012-epoch_seconds_to_timestamp_tz.sql.oracle
b/schema/spacewalk/upgrade/spacewalk-schema-1.8-to-spacewalk-schema-1.9/012-epoch_seconds_to_timestamp_tz.sql.oracle
new file mode 100644
index 0000000..e0cb583
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.8-to-spacewalk-schema-1.9/012-epoch_seconds_to_timestamp_tz.sql.oracle
@@ -0,0 +1,14 @@
+--
+-- Take seconds since epoch (January 1, 1970 UTC) and convert it
+-- to time-zone'd timestamp.
+--
+
+create or replace function epoch_seconds_to_timestamp_tz(secs in number)
+return timestamp with local time zone
+is
+begin
+ return to_timestamp_tz('1970-01-01 00:00:00 UTC', 'YYYY-MM-DD HH24:MI:SS
TZR') + numtodsinterval(secs, 'second');
+end;
+/
+show errors
+
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.8-to-spacewalk-schema-1.9/012-epoch_seconds_to_timestamp_tz.sql.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.8-to-spacewalk-schema-1.9/012-epoch_seconds_to_timestamp_tz.sql.postgresql
new file mode 100644
index 0000000..99ed1c9
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.8-to-spacewalk-schema-1.9/012-epoch_seconds_to_timestamp_tz.sql.postgresql
@@ -0,0 +1,16 @@
+-- oracle equivalent source sha1 8cb4b4ce75b5de5afefb3ce0306453e7beb9ebd3
+--
+-- Take seconds since epoch (January 1, 1970 UTC) and convert it
+-- to time-zone'd timestamp. Mainly as compatibility with Oracle
+-- which does not have the single-parameter to_timestamp.
+--
+
+create function epoch_seconds_to_timestamp_tz(secs in numeric)
+returns timestamp with time zone
+as
+$$
+begin
+ return to_timestamp(secs);
+end;
+$$ language plpgsql;
+
Show replies by date