Browse Source

- change log level for 'probably invalid queries' from WARN to ERR
- as we stop execution and return a failure anyway, we should also
inform the user with the correct log level about this
- move error message to default case


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4485 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt 17 years ago
parent
commit
e6fd5e020a
1 changed files with 8 additions and 7 deletions
  1. 8 7
      modules/db_postgres/km_dbase.c

+ 8 - 7
modules/db_postgres/km_dbase.c

@@ -235,6 +235,7 @@ int db_postgres_fetch_result(const db_con_t* _con, db_res_t** _res, const int nr
 			case PGRES_FATAL_ERROR:
 			case PGRES_FATAL_ERROR:
 				LM_ERR("%p - invalid query, execution aborted\n", _con);
 				LM_ERR("%p - invalid query, execution aborted\n", _con);
 				LM_ERR("%p - PQresultStatus(%s)\n", _con, PQresStatus(pqresult));
 				LM_ERR("%p - PQresultStatus(%s)\n", _con, PQresStatus(pqresult));
+				LM_ERR("%p: %s\n", _con, PQresultErrorMessage(CON_RESULT(_con)));
 				if (*_res)
 				if (*_res)
 					db_free_result(*_res);
 					db_free_result(*_res);
 				*_res = 0;
 				*_res = 0;
@@ -248,11 +249,11 @@ int db_postgres_fetch_result(const db_con_t* _con, db_res_t** _res, const int nr
 			case PGRES_COPY_IN:
 			case PGRES_COPY_IN:
 			/* unexpected response */
 			/* unexpected response */
 			case PGRES_BAD_RESPONSE:
 			case PGRES_BAD_RESPONSE:
-				LM_WARN("%p - probable invalid query\n", _con);
 			default:
 			default:
-				LM_WARN("%p - PQresultStatus(%s)\n",
-					_con, PQresStatus(pqresult));
-				if (*_res) 
+				LM_ERR("%p - probable invalid query\n", _con);
+				LM_ERR("%p - PQresultStatus(%s)\n", _con, PQresStatus(pqresult));
+				LM_ERR("%p: %s\n", _con, PQresultErrorMessage(CON_RESULT(_con)));
+				if (*_res)
 					db_free_result(*_res);
 					db_free_result(*_res);
 				*_res = 0;
 				*_res = 0;
 				return -4;
 				return -4;
@@ -453,10 +454,10 @@ int db_postgres_store_result(const db_con_t* _con, db_res_t** _r)
 		case PGRES_COPY_IN:
 		case PGRES_COPY_IN:
 		/* unexpected response */
 		/* unexpected response */
 		case PGRES_BAD_RESPONSE:
 		case PGRES_BAD_RESPONSE:
-			LM_WARN("%p Probable invalid query\n", _con);
 		default:
 		default:
-			LM_WARN("%p: %s\n", _con, PQresStatus(pqresult));
-			LM_WARN("%p: %s\n", _con, PQresultErrorMessage(CON_RESULT(_con)));
+			LM_ERR("%p Probable invalid query\n", _con);
+			LM_ERR("%p: %s\n", _con, PQresStatus(pqresult));
+			LM_ERR("%p: %s\n", _con, PQresultErrorMessage(CON_RESULT(_con)));
 			if (*_r) db_free_result(*_r);
 			if (*_r) db_free_result(*_r);
 
 
 			*_r = 0;
 			*_r = 0;