Handling null values and added boolean data type.\n Handling jdbc inner exceptions.
This commit is contained in:
		
							parent
							
								
									beb8f72560
								
							
						
					
					
						commit
						b52a7358ff
					
				@ -117,7 +117,13 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
 | 
				
			|||||||
          statement.setFloat(idx + 1, event[i])
 | 
					          statement.setFloat(idx + 1, event[i])
 | 
				
			||||||
        when String
 | 
					        when String
 | 
				
			||||||
          statement.setString(idx + 1, event[i])
 | 
					          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))
 | 
					          statement.setString(idx + 1, event.sprintf(i))
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
      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
 | 
					      # 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.
 | 
					      # inserted will be re-run. We're going to log it for the lols anyway.
 | 
				
			||||||
      @logger.warn("JDBC - Exception. Will automatically retry", :exception => e)
 | 
					      @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
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    statement.close()
 | 
					    statement.close()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user