Search in sources :

Example 1 with SpreadsheetInsertVisitor

use of org.teiid.translator.google.visitor.SpreadsheetInsertVisitor in project teiid by teiid.

the class SpreadsheetUpdateExecution method executeInsert.

private UpdateResult executeInsert() throws TranslatorException {
    SpreadsheetInfo info = connection.getSpreadsheetInfo();
    SpreadsheetInsertVisitor visitor = new SpreadsheetInsertVisitor(info);
    visitor.visit((Insert) command);
    checkHeaders(visitor.getWorksheetTitle());
    result = connection.executeRowInsert(visitor.getWorksheetTitle(), visitor.getColumnNameValuePair());
    return result;
}
Also used : SpreadsheetInfo(org.teiid.translator.google.api.metadata.SpreadsheetInfo) SpreadsheetInsertVisitor(org.teiid.translator.google.visitor.SpreadsheetInsertVisitor)

Example 2 with SpreadsheetInsertVisitor

use of org.teiid.translator.google.visitor.SpreadsheetInsertVisitor in project teiid by teiid.

the class TestSQLtoSpreadsheetQuery method testInsertVisitorNull.

@Test
public void testInsertVisitorNull() throws Exception {
    String sql = "insert into PeopleList(A,B,C) values ('String,String', null, 15.5)";
    SpreadsheetInsertVisitor visitor = new SpreadsheetInsertVisitor(people);
    visitor.visit((Insert) getCommand(sql));
    assertEquals(2, visitor.getColumnNameValuePair().size());
    assertEquals("String,String", visitor.getColumnNameValuePair().get("A"));
    assertEquals(15.5, visitor.getColumnNameValuePair().get("C"));
}
Also used : SpreadsheetInsertVisitor(org.teiid.translator.google.visitor.SpreadsheetInsertVisitor) Test(org.junit.Test)

Example 3 with SpreadsheetInsertVisitor

use of org.teiid.translator.google.visitor.SpreadsheetInsertVisitor in project teiid by teiid.

the class TestSQLtoSpreadsheetQuery method testInsertVisitor.

@Test
public void testInsertVisitor() throws Exception {
    String sql = "insert into PeopleList(A,B,C) values ('String,String', 'String@String', 15.5)";
    SpreadsheetInsertVisitor visitor = new SpreadsheetInsertVisitor(people);
    visitor.visit((Insert) getCommand(sql));
    assertEquals(3, visitor.getColumnNameValuePair().size());
    assertEquals("String,String", visitor.getColumnNameValuePair().get("A"));
    assertEquals("String@String", visitor.getColumnNameValuePair().get("B"));
    assertEquals(15.5, visitor.getColumnNameValuePair().get("C"));
}
Also used : SpreadsheetInsertVisitor(org.teiid.translator.google.visitor.SpreadsheetInsertVisitor) Test(org.junit.Test)

Aggregations

SpreadsheetInsertVisitor (org.teiid.translator.google.visitor.SpreadsheetInsertVisitor)3 Test (org.junit.Test)2 SpreadsheetInfo (org.teiid.translator.google.api.metadata.SpreadsheetInfo)1