Class CsvToSqlExtensions


  • public final class CsvToSqlExtensions
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String extractSqlColumns​(java.lang.String[] headers)
      Extract sql columns.
      static java.lang.String getCsvFileAsSqlInsertScript​(java.lang.String tableName, CsvBean csvBean)
      Gets the csv file as sql insert script.
      static java.lang.String getCsvFileAsSqlInsertScript​(java.lang.String tableName, CsvBean csvBean, boolean withHeader, boolean withEndSemicolon)
      Gets the csv file as sql insert script.
      static java.lang.String getCsvFileAsSqlInsertScript​(java.lang.String tableName, java.lang.String[] headers, java.lang.String[] columnTypes, java.lang.String[] columnTypesEdit, java.util.List<java.lang.String[]> lines)
      Gets the csv file as sql insert script.
      static java.lang.String getCsvFileAsSqlInsertScript​(java.lang.String tableName, java.lang.String[] headers, java.lang.String[] columnTypes, java.util.List<java.lang.String[]> lines)
      Gets the csv file as sql insert script.
      static java.lang.String[] getDataFromLine​(java.lang.String line, java.lang.String seperator)
      Gets the data from line.
      static java.lang.StringBuilder getSqlData​(java.lang.String[] columns, java.lang.String[] columnTypes, java.lang.String[] columnTypesEdit, java.util.Map<java.lang.Integer,​java.lang.Integer> lineOrder, java.util.List<java.lang.String[]> lines, boolean withEndSemicolon)
      Gets the sql data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • extractSqlColumns

        public static java.lang.String extractSqlColumns​(java.lang.String[] headers)
        Extract sql columns.
        Parameters:
        headers - the headers
        Returns:
        the string
      • getCsvFileAsSqlInsertScript

        public static java.lang.String getCsvFileAsSqlInsertScript​(java.lang.String tableName,
                                                                   CsvBean csvBean)
        Gets the csv file as sql insert script.
        Parameters:
        tableName - the table name
        csvBean - the csv bean
        Returns:
        the csv file as sql insert script
      • getCsvFileAsSqlInsertScript

        public static java.lang.String getCsvFileAsSqlInsertScript​(java.lang.String tableName,
                                                                   CsvBean csvBean,
                                                                   boolean withHeader,
                                                                   boolean withEndSemicolon)
        Gets the csv file as sql insert script.
        Parameters:
        tableName - the table name
        csvBean - the csv bean
        withHeader - the with header
        withEndSemicolon - the with end semicolon
        Returns:
        the csv file as sql insert script
      • getCsvFileAsSqlInsertScript

        public static java.lang.String getCsvFileAsSqlInsertScript​(java.lang.String tableName,
                                                                   java.lang.String[] headers,
                                                                   java.lang.String[] columnTypes,
                                                                   java.util.List<java.lang.String[]> lines)
        Gets the csv file as sql insert script.
        Parameters:
        tableName - the table name
        headers - the headers
        columnTypes - the column types
        lines - the lines
        Returns:
        the csv file as sql insert script
      • getCsvFileAsSqlInsertScript

        public static java.lang.String getCsvFileAsSqlInsertScript​(java.lang.String tableName,
                                                                   java.lang.String[] headers,
                                                                   java.lang.String[] columnTypes,
                                                                   java.lang.String[] columnTypesEdit,
                                                                   java.util.List<java.lang.String[]> lines)
        Gets the csv file as sql insert script.
        Parameters:
        tableName - the table name
        headers - the headers
        columnTypes - the column types
        columnTypesEdit - the column types edit
        lines - the lines
        Returns:
        the csv file as sql insert script
      • getDataFromLine

        public static java.lang.String[] getDataFromLine​(java.lang.String line,
                                                         java.lang.String seperator)
        Gets the data from line.
        Parameters:
        line - the line
        seperator - the seperator
        Returns:
        the data from line
      • getSqlData

        public static java.lang.StringBuilder getSqlData​(java.lang.String[] columns,
                                                         java.lang.String[] columnTypes,
                                                         java.lang.String[] columnTypesEdit,
                                                         java.util.Map<java.lang.Integer,​java.lang.Integer> lineOrder,
                                                         java.util.List<java.lang.String[]> lines,
                                                         boolean withEndSemicolon)
        Gets the sql data.
        Parameters:
        columns - the columns
        columnTypes - the column types
        columnTypesEdit - the column types edit
        lineOrder - the line order
        lines - the lines
        withEndSemicolon - the with end semicolon
        Returns:
        the sql data