Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes for the "C" create event for creating tables (was DDL event)
- Loading branch information
Showing
8 changed files
with
82 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
symmetric/src/main/java/org/jumpmind/symmetric/common/csv/CsvUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.jumpmind.symmetric.common.csv; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.io.OutputStreamWriter; | ||
|
||
import com.csvreader.CsvReader; | ||
import com.csvreader.CsvWriter; | ||
|
||
public class CsvUtil { | ||
|
||
public static String[] tokenizeCsvData(String csvData) { | ||
String[] tokens = null; | ||
if (csvData != null) { | ||
InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(csvData.getBytes())); | ||
CsvReader csvReader = new CsvReader(reader); | ||
csvReader.setEscapeMode(CsvReader.ESCAPE_MODE_BACKSLASH); | ||
try { | ||
if (csvReader.readRecord()) { | ||
tokens = csvReader.getValues(); | ||
} | ||
} catch (IOException e) { | ||
} | ||
} | ||
return tokens; | ||
} | ||
|
||
public static String escapeCsvData(String data) { | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
CsvWriter writer = new CsvWriter(new OutputStreamWriter(out), ','); | ||
writer.setEscapeMode(CsvWriter.ESCAPE_MODE_BACKSLASH); | ||
try { | ||
writer.write(data); | ||
writer.close(); | ||
out.close(); | ||
} catch (IOException e) { | ||
} | ||
return out.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters