Tabnine Logo
TableDataReader
Code IndexAdd Tabnine to your IDE (free)

How to use
TableDataReader
in
org.eclipse.dirigible.database.ds.model.transfer

Best Java code snippets using org.eclipse.dirigible.database.ds.model.transfer.TableDataReader (Showing top 4 results out of 315)

origin: org.eclipse.dirigible/dirigible-database-data-models

public static List<String[]> readRecords(InputStream csvFile)
    throws FileNotFoundException, IOException, InvalidNumberOfElementsException {
  BufferedReader reader = new BufferedReader(new InputStreamReader(csvFile, StandardCharsets.UTF_8));
  List<String[]> data = new ArrayList<String[]>();
  int item_count = -1;
  int line_number = 0;
  while (true) {
    String line = reader.readLine();
    line_number++;
    if (line == null) {
      break;
    }
    String[] items = getStringItems(line);
    if (item_count == -1) {
      item_count = items.length;
    } else if (item_count != items.length) {
      throw new InvalidNumberOfElementsException(
          String.format(INVALID_NUMBER_D_OF_ELEMENTS_AT_LINE_D_INITIAL_COLUMNS_NUMBER_D, items.length,
              line_number, item_count));
    }
    data.add(items);
  }
  reader.close();
  return data;
}
origin: org.eclipse.dirigible/dirigible-database-data-models

public void insert() throws Exception {
  Connection connection = null;
  try {
    connection = getConnection();
    List<String[]> records = TableDataReader.readRecords(new ByteArrayInputStream(content));
    insertRecords(connection, records, tableName);
  } finally {
    closeConnection(connection);
  }
}
origin: org.eclipse.dirigible/dirigible-database-data-structures

private void deleteRowsDataFromTable(String tableName, String primaryKey, byte[] fileContent) throws Exception {
  Connection connection = null;
  try {
    connection = dataSource.getConnection();
    List<String[]> records = TableDataReader.readRecords(new ByteArrayInputStream(fileContent));
    for (String[] record : records) {
      if (record.length > 0) {
        String sql = SqlFactory.getNative(connection).delete().from(tableName).where(primaryKey + " = ?").build();
        PreparedStatement deleteStatement = connection.prepareStatement(sql);
        deleteStatement.setObject(1, record[0]);
        deleteStatement.execute();
      } else {
        logger.error(String.format("Skipping deletion of an empty data row for table: %s", tableName));
      }
    }
  } finally {
    if (connection != null) {
      connection.close();
    }
  }
}
origin: org.eclipse.dirigible/dirigible-database-data-structures

try {
  connection = dataSource.getConnection();
  List<String[]> records = TableDataReader.readRecords(new ByteArrayInputStream(fileContent));
  for (String[] record : records) {
    if (record.length > 0) {
org.eclipse.dirigible.database.ds.model.transferTableDataReader

Most used methods

  • readRecords
  • getStringItems

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now