Class SqlFileReader

java.lang.Object
org.nuiton.util.sql.SqlFileReader
All Implemented Interfaces:
java.lang.Iterable<java.lang.String>

public class SqlFileReader
extends java.lang.Object
implements java.lang.Iterable<java.lang.String>
Create an iterable on a SQL text content. The content is iterated on each SQL statement. For information the class handles semi-colon in quote. File example: INSERT INTO client (prenom, age) VALUES ('John', 11); INSERT INTO client (prenom, age) VALUES ('Jack', 12); Then: SqlFileReader reader = new SqlFileReader(stream); for (String sql : reader) { // process sql variable }
Author:
jruchaud
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  SqlFileReader.SqlFileReaderIterator
    Use to create an iterator on the iterable.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.io.Reader source  
  • Constructor Summary

    Constructors 
    Constructor Description
    SqlFileReader​(java.io.Reader source)  
    SqlFileReader​(java.lang.String source)  
  • Method Summary

    Modifier and Type Method Description
    java.util.Iterator<java.lang.String> iterator()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

    • source

      protected java.io.Reader source
  • Constructor Details

  • Method Details

    • iterator

      public java.util.Iterator<java.lang.String> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<java.lang.String>