backend/server/handlers/xmlrpc/queue.py | 4 - backend/server/rhnSQL/driver_postgresql.py | 29 +++------- java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml | 4 + utils/spacewalk-dump-schema | 1 4 files changed, 16 insertions(+), 22 deletions(-)
New commits: commit 9ade6d9184b047a81663d008043aa125a74e52fb Author: Jan Pazdziora jpazdziora@redhat.com Date: Mon Nov 1 15:44:16 2010 +0100
Fixing system_available_packages -- the order by got lost in previous commits, and the name_upper is still there.
Addressing Could not find method called: setNameUpper in class: com.redhat.rhn.frontend.dto.PackageListItem with params: [type: java.lang.String, value: RHNCFG-ACTIONS]
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml index 53bf7d4..2e60759 100644 --- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml +++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml @@ -649,8 +649,8 @@ SELECT P.id, P.summary, PP.name as provider
<mode name="system_available_packages" class="com.redhat.rhn.frontend.dto.PackageListItem"> <query params="sid"> +select * from ( SELECT distinct pn.name AS NAME, - UPPER(pn.name) AS name_upper, pn.name || '-' || evr_t_as_vre_simple(full_list.evr) AS NVRE, pn.name || '-' || evr_t_as_vre_simple(full_list.evr) || '.' || full_list.arch_label AS NVREA, pn.id || '|' || lookup_evr((full_list.evr).epoch, (full_list.evr).version, (full_list.evr).release) || '|' || full_list.arch_id AS ID_COMBO, @@ -676,6 +676,8 @@ SELECT distinct pn.name AS NAME, WHERE SP.server_id = :sid AND SP.name_id = full_list.name_id AND (SP.package_arch_id = full_list.arch_id or SP.package_arch_id is null)) +) x +order by upper(name) </query> </mode>
commit 3977c58b0ba244ef7d7080da5ef44507733115b0 Author: Jan Pazdziora jpazdziora@redhat.com Date: Mon Nov 1 15:43:58 2010 +0100
Use current_timestamp with numtodsinterval instead of sysdate.
Addressing column "sysdate" does not exist at character 609
diff --git a/backend/server/handlers/xmlrpc/queue.py b/backend/server/handlers/xmlrpc/queue.py index 12e1db1..89c9150 100644 --- a/backend/server/handlers/xmlrpc/queue.py +++ b/backend/server/handlers/xmlrpc/queue.py @@ -212,7 +212,7 @@ class Queue(rhnHandler): and sa.action_id = a.id and a.action_type = at.id and sa.status in (0, 1) -- Queued or picked up - and a.earliest_action <= sysdate + (:time_window/24) -- Check earliest_action + and a.earliest_action <= current_timestamp + numtodsinterval(:time_window * 3600, 'second') -- Check earliest_action and at.label in ('packages.update', 'errata.update', 'packages.runTransaction', 'packages.fullUpdate') order by a.earliest_action, a.prerequisite nulls first, a.id @@ -245,7 +245,7 @@ class Queue(rhnHandler): and sa.action_id = a.id and a.action_type = at.id and sa.status in (0, 1) -- Queued or picked up - and a.earliest_action <= sysdate -- Check earliest_action + and a.earliest_action <= current_timestamp -- Check earliest_action and not exists ( select 1 from rhnServerAction sap
commit 3a531da3a718d6bf8c9376385a8bacca9db064ba Author: Jan Pazdziora jpazdziora@redhat.com Date: Mon Nov 1 15:29:02 2010 +0100
Fixing decimal2intfloat -- the function is passed str, not decimal.Decimal; we just try to convert to int or float.
diff --git a/backend/server/rhnSQL/driver_postgresql.py b/backend/server/rhnSQL/driver_postgresql.py index 0379c28..e2db161 100644 --- a/backend/server/rhnSQL/driver_postgresql.py +++ b/backend/server/rhnSQL/driver_postgresql.py @@ -21,7 +21,6 @@ import sys import re import psycopg2 import hashlib -import decimal
import sql_base from spacewalk.server import rhnSQL @@ -104,23 +103,17 @@ class Procedure(Function): #raise rhnSQL.SQLError("Unexpected result returned by procedure %s: %s" % (self.name, str(result)))
def decimal2intfloat(dec, cursor): - "Convert a Decimal to an int or a float with no loss of information" + "Convert a Decimal to an int or a float with no loss of information." + "The dec is passed in as str (not Decimal) so we cannot check its type." if dec is None: return None - if not isinstance(dec, decimal.Decimal): - return dec - oldcontext = decimal.getcontext() - decimal.setcontext(decimal.Context(traps=[decimal.Inexact])) + "If we can convert to int without loss of information, return int, float otherwise." try: - while True: - try: - # try to quantize to integer - return int(dec.quantize(decimal.Decimal(1))) - except decimal.Inexact: - # if not exact return float - return float(dec) - finally: - decimal.setcontext(oldcontext) + if float(dec) == float(int(dec)): + return int(dec) + return float(dec) + except ValueError: + return float(dec)
class Database(sql_base.Database): """ Class for PostgreSQL database operations. """
commit 582c577b859267217e29140afe98468b82a1b9f4 Author: Jan Pazdziora jpazdziora@redhat.com Date: Mon Nov 1 14:55:36 2010 +0100
The conversion should take place both for remote and local connections.
diff --git a/backend/server/rhnSQL/driver_postgresql.py b/backend/server/rhnSQL/driver_postgresql.py index 1e24c03..0379c28 100644 --- a/backend/server/rhnSQL/driver_postgresql.py +++ b/backend/server/rhnSQL/driver_postgresql.py @@ -153,10 +153,10 @@ class Database(sql_base.Database): else: self.dbh = psycopg2.connect(database=self.database, user=self.username, password=self.password, host=self.host, port=self.port) - # convert all DECIMAL types to float (let Python to choose one) - DEC2INTFLOAT = psycopg2.extensions.new_type(psycopg2._psycopg.DECIMAL.values, + # convert all DECIMAL types to float (let Python to choose one) + DEC2INTFLOAT = psycopg2.extensions.new_type(psycopg2._psycopg.DECIMAL.values, 'DEC2INTFLOAT', decimal2intfloat) - psycopg2.extensions.register_type(DEC2INTFLOAT) + psycopg2.extensions.register_type(DEC2INTFLOAT) except Exception, e: if reconnect: # Try one more time:
commit c57afcd9980cc9918af5d0159fadd4317002152e Author: Jan Pazdziora jpazdziora@redhat.com Date: Mon Nov 1 13:19:16 2010 +0100
As the table rhnPaidErrataTempCache is no more, we do not need to have check for temporary tables.
Reverting commit 995e7302835e6c66996813e9186c33a17a600196. "Do not attempt to copy over temporary tables or we get error about rhnpaiderratatempcache."
diff --git a/utils/spacewalk-dump-schema b/utils/spacewalk-dump-schema index 437a346..55cb220 100755 --- a/utils/spacewalk-dump-schema +++ b/utils/spacewalk-dump-schema @@ -63,7 +63,6 @@ sub process_tables { my $tables = $dbh->selectcol_arrayref(q! select lower(table_name) table_name from user_tables - where temporary = 'N' order by table_name !); for (@$tables) {