Handling null values and added boolean data type.\n Handling jdbc inner exceptions.

This commit is contained in:
kushtrim junuzi 2015-07-22 08:06:57 -04:00
parent beb8f72560
commit b52a7358ff

View File

@ -117,7 +117,13 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
statement.setFloat(idx + 1, event[i])
when String
statement.setString(idx + 1, event[i])
else
when true
statement.setBoolean(idx + 1, true)
when false
statement.setBoolean(idx + 1, false)
when nil
statement.setString(idx + 1, nil)
else
statement.setString(idx + 1, event.sprintf(i))
end
end
@ -133,6 +139,9 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
# Since the exceutebatch failed this should mean any events failed to be
# inserted will be re-run. We're going to log it for the lols anyway.
@logger.warn("JDBC - Exception. Will automatically retry", :exception => e)
if e.getNextException() != nil
@logger.warn("JDBC - Exception. Will automatically retry", :exception => e.getNextException())
end
end
statement.close()