utils/spacewalk-archive-audits | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
New commits:
commit 795e173c6c7a26288203740170a48ed692e72e5c
Author: Grant Gainey <ggainey(a)redhat.com>
Date: Fri Sep 27 09:34:45 2013 -0400
1012963 - Don't use :table as a param-name in Oracle prepared stmts
diff --git a/utils/spacewalk-archive-audits b/utils/spacewalk-archive-audits
index 42dffdf..32a4b7f 100755
--- a/utils/spacewalk-archive-audits
+++ b/utils/spacewalk-archive-audits
@@ -49,7 +49,7 @@ LOG_COLS = ['id', 'stamp', 'user_id']
SQL_PIECES = {'oracle': {
'COUNT' : 'select count(*) from %(table)s',
- 'FIND_COLS' : "select column_name from user_tab_columns
where table_name = :table",
+ 'FIND_COLS' : "select column_name from user_tab_columns
where table_name = :the_table",
'FIND_TABLE' : "select table_name from user_tables where
table_name like '%|_LOG' escape '|'",
'GET_DATA' : "select %(cols)s, %(tcols)s from %(tname)s t
inner join log l on l.id = t.log_id where l.stamp <= to_date(:tstamp, 'YYYY-MM-DD
hh24:mi:ss') order by l.id",
'PURGE_DATA' : """
@@ -65,7 +65,7 @@ SQL_PIECES = {'oracle': {
},
'postgresql' : {
'COUNT' : 'select count(*) from %(table)s;',
- 'FIND_COLS' : 'select column_name from
information_schema.columns where table_name = :table;',
+ 'FIND_COLS' : 'select column_name from
information_schema.columns where table_name = :the_table;',
'FIND_TABLE' : "select table_name from
information_schema.tables where table_name like '%!_log' escape
'!';",
'GET_DATA' : 'select %(cols)s, %(tcols)s from %(tname)s t
inner join log l on l.id = t.log_id where l.stamp <= (timestamp :tstamp) order by
l.id;',
'PURGE_DATA' : 'delete from %(ptable)s t using log l where
l.id = t.log_id and l.stamp <= (timestamp :tstamp);',
@@ -137,7 +137,7 @@ def tables():
def columns(tbl):
"""What are the columns of table <tbl>?"""
- stmt = rhnSQL.execute(_get_sql('FIND_COLS'), table=tbl)
+ stmt = rhnSQL.execute(_get_sql('FIND_COLS'), the_table=tbl)
col_names = stmt.fetchall() or []
rc = []
for name in col_names:
commit 0c9cef2175ec68af148fef2257b62489320c605e
Author: Grant Gainey <ggainey(a)redhat.com>
Date: Fri Sep 27 09:26:35 2013 -0400
1012934 - Oracle prepared-stmt cannot have semicolons
diff --git a/utils/spacewalk-archive-audits b/utils/spacewalk-archive-audits
index 09bbb87..42dffdf 100755
--- a/utils/spacewalk-archive-audits
+++ b/utils/spacewalk-archive-audits
@@ -48,10 +48,10 @@ LOG_LOCATION = '/var/log/rhn/archive-audit-tables.log'
LOG_COLS = ['id', 'stamp', 'user_id']
SQL_PIECES = {'oracle': {
- 'COUNT' : 'select count(*) from %(table)s;',
- 'FIND_COLS' : "select column_name from user_tab_columns
where table_name = :table;",
- 'FIND_TABLE' : "select table_name from user_tables where
table_name like '%!_LOG' escape '!';",
- 'GET_DATA' : "select %(cols)s, %(tcols)s from %(tname)s t
inner join log l on l.id = t.log_id where l.stamp <= to_date(:tstamp, 'YYYY-MM-DD
hh24:mi:ss') order by l.id;",
+ 'COUNT' : 'select count(*) from %(table)s',
+ 'FIND_COLS' : "select column_name from user_tab_columns
where table_name = :table",
+ 'FIND_TABLE' : "select table_name from user_tables where
table_name like '%|_LOG' escape '|'",
+ 'GET_DATA' : "select %(cols)s, %(tcols)s from %(tname)s t
inner join log l on l.id = t.log_id where l.stamp <= to_date(:tstamp, 'YYYY-MM-DD
hh24:mi:ss') order by l.id",
'PURGE_DATA' : """
delete %(ptable)s
where exists (
@@ -59,9 +59,9 @@ SQL_PIECES = {'oracle': {
from log l
where l.id = %(ptable)s.log_id
and l.stamp <= to_date(:tstamp, 'YYYY-MM-DD
hh24:mi:ss')
- );
+ )
""",
- 'PURGE_LOG_DATA' : "delete from log l where l.stamp <=
to_date(:tstamp, 'YYYY-MM-DD hh24:mi:ss');"
+ 'PURGE_LOG_DATA' : "delete from log l where l.stamp <=
to_date(:tstamp, 'YYYY-MM-DD hh24:mi:ss')"
},
'postgresql' : {
'COUNT' : 'select count(*) from %(table)s;',