"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/sql.c" between
openvas-manager-7.0.2.tar.gz and openvas-manager-7.0.3.tar.gz

About: OpenVAS Manager is a layer between OpenVAS-Scanner and various client applications such as OpenVAS-Client or Greenbone Security Assistant. Among other features, it adds server-side storage of scan results and it makes it unnecessary for scan clients to keep connection until a scan finishes. OpenVAS-9.

sql.c  (openvas-manager-7.0.2):sql.c  (openvas-manager-7.0.3)
skipping to change at line 51 skipping to change at line 51
sql_prepare_internal (int, int, const char*, va_list, sql_stmt_t **); sql_prepare_internal (int, int, const char*, va_list, sql_stmt_t **);
int int
sql_exec_internal (int, sql_stmt_t *); sql_exec_internal (int, sql_stmt_t *);
int int
sql_explain_internal (const char*, va_list); sql_explain_internal (const char*, va_list);
int int
sql_explain (const char*, ...); sql_explain (const char*, ...);
/* Variables. */
/**
* @brief Whether to log errors.
*
* Used to turn off logging when cancelling statements on exit.
*/
int log_errors = 1;
/* Helpers. */ /* Helpers. */
/** /**
* @brief Quotes a string of a known length to be passed to sql statements. * @brief Quotes a string of a known length to be passed to sql statements.
* *
* @param[in] string String to quote. * @param[in] string String to quote.
* @param[in] length Size of \p string. * @param[in] length Size of \p string.
* *
* @return Freshly allocated, quoted string. Free with g_free. * @return Freshly allocated, quoted string. Free with g_free.
*/ */
skipping to change at line 166 skipping to change at line 174
ret = sql_prepare_internal (retry, 1, sql, args_copy, &stmt); ret = sql_prepare_internal (retry, 1, sql, args_copy, &stmt);
va_end (args_copy); va_end (args_copy);
if (ret == -1) if (ret == -1)
g_warning ("%s: sql_prepare_internal failed\n", __FUNCTION__); g_warning ("%s: sql_prepare_internal failed\n", __FUNCTION__);
if (ret) if (ret)
return ret; return ret;
/* Run statement. */ /* Run statement. */
while ((ret = sql_exec_internal (retry, stmt)) == 1); while ((ret = sql_exec_internal (retry, stmt)) == 1);
if (ret == -1) if ((ret == -1) && log_errors)
g_warning ("%s: sql_exec_internal failed\n", __FUNCTION__); g_warning ("%s: sql_exec_internal failed\n", __FUNCTION__);
sql_finalize (stmt); sql_finalize (stmt);
if (ret == 2) if (ret == 2)
continue; continue;
if (ret == -2) if (ret == -2)
return 1; return 1;
assert (ret == -1 || ret == 0); assert (ret == -1 || ret == 0);
return ret; return ret;
} }
} }
skipping to change at line 285 skipping to change at line 293
{ {
g_warning ("%s: sql_prepare failed\n", __FUNCTION__); g_warning ("%s: sql_prepare failed\n", __FUNCTION__);
abort (); abort ();
} }
/* Run statement. */ /* Run statement. */
while ((ret = sql_exec_internal (1, stmt)) == 1); while ((ret = sql_exec_internal (1, stmt)) == 1);
if (ret == -1) if (ret == -1)
{ {
g_warning ("%s: sql_exec_internal failed\n", __FUNCTION__); if (log_errors)
g_warning ("%s: sql_exec_internal failed\n", __FUNCTION__);
abort (); abort ();
} }
if (ret == -2 || ret == 2) if (ret == -2 || ret == 2)
{ {
/* Busy or locked, with statement reset. Or schema changed. */ /* Busy or locked, with statement reset. Or schema changed. */
sql_finalize (stmt); sql_finalize (stmt);
continue; continue;
} }
break; break;
} }
skipping to change at line 337 skipping to change at line 346
{ {
g_warning ("%s: sql_prepare failed\n", __FUNCTION__); g_warning ("%s: sql_prepare failed\n", __FUNCTION__);
return -1; return -1;
} }
/* Run statement. */ /* Run statement. */
ret = sql_exec_internal (1, *stmt_return); ret = sql_exec_internal (1, *stmt_return);
if (ret == -1) if (ret == -1)
{ {
g_warning ("%s: sql_exec_internal failed\n", __FUNCTION__); if (log_errors)
g_warning ("%s: sql_exec_internal failed\n", __FUNCTION__);
return -1; return -1;
} }
if (ret == 0) if (ret == 0)
/* Too few rows. */ /* Too few rows. */
return 1; return 1;
if (ret == -2 || ret == 2) if (ret == -2 || ret == 2)
{ {
/* Busy or locked, with statement reset. Or schema changed. */ /* Busy or locked, with statement reset. Or schema changed. */
sql_finalize (*stmt_return); sql_finalize (*stmt_return);
continue; continue;
skipping to change at line 688 skipping to change at line 698
while (1) while (1)
{ {
ret = sql_exec_internal (1, iterator->stmt); ret = sql_exec_internal (1, iterator->stmt);
if (ret == 0) if (ret == 0)
{ {
iterator->done = TRUE; iterator->done = TRUE;
return FALSE; return FALSE;
} }
if (ret == -1) if (ret == -1)
{ {
g_warning ("%s: sql_exec_internal failed\n", __FUNCTION__); if (log_errors)
g_warning ("%s: sql_exec_internal failed\n", __FUNCTION__);
abort (); abort ();
} }
if (ret == -2) if (ret == -2)
{ {
/* Busy or locked, with statement reset. Just try step again like /* Busy or locked, with statement reset. Just try step again like
* we used to do in sql_exec_internal. We're not supposed to do this * we used to do in sql_exec_internal. We're not supposed to do this
* for SQLite, but it would mean quite a bit of reworking in the * for SQLite, but it would mean quite a bit of reworking in the
* callers to be able to handle this case. */ * callers to be able to handle this case. */
g_warning ("%s: stepping after reset\n", __FUNCTION__); g_warning ("%s: stepping after reset\n", __FUNCTION__);
continue; continue;
 End of changes. 5 change blocks. 
4 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)