java.lang.Object
io.github.astrapi69.file.csv.CsvToSqlExtensions
The class
CsvToSqlExtensions
.-
Method Summary
Modifier and TypeMethodDescriptionstatic String
extractSqlColumns
(String[] headers) Extract sql columns.static String
getCsvFileAsSqlInsertScript
(String tableName, CsvBean csvBean) Gets the csv file as sql insert script.static String
getCsvFileAsSqlInsertScript
(String tableName, CsvBean csvBean, boolean withHeader, boolean withEndSemicolon) Gets the csv file as sql insert script.static String
getCsvFileAsSqlInsertScript
(String tableName, String[] headers, String[] columnTypes, String[] columnTypesEdit, List<String[]> lines) Gets the csv file as sql insert script.static String
getCsvFileAsSqlInsertScript
(String tableName, String[] headers, String[] columnTypes, List<String[]> lines) Gets the csv file as sql insert script.static String[]
getDataFromLine
(String line, String seperator) Gets the data from line.static StringBuilder
getSqlData
(String[] columns, String[] columnTypes, String[] columnTypesEdit, Map<Integer, Integer> lineOrder, List<String[]> lines, boolean withEndSemicolon) Gets the sql data.
-
Method Details
-
extractSqlColumns
Extract sql columns.- Parameters:
headers
- the headers- Returns:
- the string
-
getCsvFileAsSqlInsertScript
Gets the csv file as sql insert script.- Parameters:
tableName
- the table namecsvBean
- 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 namecsvBean
- the csv beanwithHeader
- the with headerwithEndSemicolon
- 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 nameheaders
- the headerscolumnTypes
- the column typeslines
- 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 nameheaders
- the headerscolumnTypes
- the column typescolumnTypesEdit
- the column types editlines
- the lines- Returns:
- the csv file as sql insert script
-
getDataFromLine
Gets the data from line.- Parameters:
line
- the lineseperator
- 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 columnscolumnTypes
- the column typescolumnTypesEdit
- the column types editlineOrder
- the line orderlines
- the lineswithEndSemicolon
- the with end semicolon- Returns:
- the sql data
-