aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar aldot <aldot@5e8054f6-fb45-0410-9d17-f830fe724320>2009-04-21 09:46:20 +0000
committerGravatar aldot <aldot@5e8054f6-fb45-0410-9d17-f830fe724320>2009-04-21 09:46:20 +0000
commitfd2cb2d4fb874b145377c9db20722ade807623fb (patch)
tree575e4bf4ec2802ada882f842592facd949d0dd9d
parent9a699fa106cab4dc77d2619c53d0920875a6ebb2 (diff)
downloadndoutils-oracle-fd2cb2d4fb874b145377c9db20722ade807623fb.tar.gz
ndoutils-oracle-fd2cb2d4fb874b145377c9db20722ade807623fb.tar.bz2
- tweak uppercase
git-svn-id: https://www.nagiosforge.org/svn/ndoutils_oracle/trunk/ndoutils-1.4b7-oracle@86 5e8054f6-fb45-0410-9d17-f830fe724320
-rw-r--r--src/db.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/db.c b/src/db.c
index a18aefb..0c817a3 100644
--- a/src/db.c
+++ b/src/db.c
@@ -566,7 +566,7 @@ char *ndo2db_db_timet_to_sql(ndo2db_idi *idi, time_t t){
case NDO2DB_DBSERVER_ORACLE:
#ifdef USE_ORACLE
/* unixts2date is a PL/SQL function (defined in db/oracle.sql */
- asprintf(&buf,"(SELECT unixts2date(%lu) FROM dual)",(unsigned long)t);
+ asprintf(&buf,"(SELECT unixts2date(%lu) FROM DUAL)",(unsigned long)t);
#endif
break;
default:
@@ -594,8 +594,7 @@ char *ndo2db_db_sql_to_timet(ndo2db_idi *idi, char *field){
break;
case NDO2DB_DBSERVER_ORACLE:
#ifdef USE_ORACLE
- //asprintf(&buf,"(select ((SELECT %s FROM %%s) - to_date('01-01-1970 00:00:00','dd-mm-yyyy hh24:mi:ss')) * 86400) from dual)",(field==NULL)?"":field);
- asprintf(&buf,"((select ((SELECT %s FROM %%s) - to_date('01-01-1970 00:00:00','dd-mm-yyyy hh24:mi:ss')) * 86400) from dual)",(field==NULL)?"":field);
+ asprintf(&buf,"((SELECT ((SELECT %s FROM %%s) - TO_DATE('01-01-1970 00:00:00','dd-mm-yyyy hh24:mi:ss')) * 86400) FROM DUAL)",(field==NULL)?"":field);
#endif
break;
default:
@@ -829,7 +828,7 @@ int ndo2db_db_get_latest_data_time(ndo2db_idi *idi, char *table_name, char *fiel
buf=NULL;
#else
//XXX: Use ndo2db_db_sql_to_timet()
- if( asprintf(&buf,"SELECT ( ( ( SELECT * FROM ( SELECT %s FROM %s WHERE instance_id='%lu' ORDER BY %s DESC) WHERE ROWNUM = 1 ) - to_date( '01-01-1970 00:00:00','dd-mm-yyyy hh24:mi:ss' )) * 86400) AS latest_time FROM DUAL"
+ if( asprintf(&buf,"SELECT ( ( ( SELECT * FROM ( SELECT %s FROM %s WHERE instance_id=%lu ORDER BY %s DESC) WHERE ROWNUM = 1 ) - TO_DATE( '01-01-1970 00:00:00','dd-mm-yyyy hh24:mi:ss' )) * 86400) AS latest_time FROM DUAL"
,(field_name==NULL)?"":field_name
,table_name
,idi->dbinfo.instance_id