Module file.worker

Class CsvToSqlExtensions

java.lang.Object
io.github.astrapi69.file.csv.CsvToSqlExtensions

public final class CsvToSqlExtensions extends Object
  • Method Details

    • extractSqlColumns

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

      public static String getCsvFileAsSqlInsertScript(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 String getCsvFileAsSqlInsertScript(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 String getCsvFileAsSqlInsertScript(String tableName, String[] headers, String[] columnTypes, List<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 String getCsvFileAsSqlInsertScript(String tableName, String[] headers, String[] columnTypes, String[] columnTypesEdit, List<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 String[] getDataFromLine(String line, String seperator)
      Gets the data from line.
      Parameters:
      line - the line
      seperator - the seperator
      Returns:
      the data from line
    • getSqlData

      public static StringBuilder getSqlData(String[] columns, String[] columnTypes, String[] columnTypesEdit, Map<Integer,Integer> lineOrder, List<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