Package org.apache.pivot.sql

Examples of org.apache.pivot.sql.ResultList$Field


        String connectionURL = args[0];

        Connection connection = null;
        Statement statement = null;
        ResultSet resultSet = null;
        ResultList resultList = null;

        try {
            connection = DriverManager.getConnection(connectionURL);
            statement = connection.createStatement();

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet);
            resultList.setFields(new ResultList.Field("i"),
                new ResultList.Field("f"),
                new ResultList.Field("s"),
                new ResultList.Field("b"));
            out.println(JSONSerializer.toString(resultList));

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet);
            resultList.setFields(new ResultList.Field("i", "integer"),
                new ResultList.Field("f", "float"),
                new ResultList.Field("s", "string"),
                new ResultList.Field("b", "boolean"));
            out.println(JSONSerializer.toString(resultList));

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet);
            resultList.setFields(new ResultList.Field("i", "integer", Integer.class),
                new ResultList.Field("f", "float", Float.class),
                new ResultList.Field("s", "string", String.class),
                new ResultList.Field("b", "boolean", Boolean.class));
            out.println(JSONSerializer.toString(resultList));

            // Test forward and backward iteration
            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet);
            resultList.setFields(new ResultList.Field("i"),
                new ResultList.Field("f"),
                new ResultList.Field("s"),
                new ResultList.Field("b"));

            Iterator<Map<String, Object>> iterator = resultList.iterator();
            while (iterator.hasNext()) {
                out.println(JSONSerializer.toString(iterator.next()));
            }
        } finally {
            if (resultSet != null) {
View Full Code Here


        try {
            connection = DriverManager.getConnection(connectionURL);
            Statement statement = connection.createStatement();
            ResultSet resultSet;
            ResultList resultList;

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet);
            resultList.setFields(new ResultList.Field("i"),
                new ResultList.Field("f"),
                new ResultList.Field("s"),
                new ResultList.Field("b"));
            out.println(JSONSerializer.toString(resultList));

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet);
            resultList.setFields(new ResultList.Field("i", "integer"),
                new ResultList.Field("f", "float"),
                new ResultList.Field("s", "string"),
                new ResultList.Field("b", "boolean"));
            out.println(JSONSerializer.toString(resultList));

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet);
            resultList.setFields(new ResultList.Field("i", "integer", Integer.class),
                new ResultList.Field("f", "float", Float.class),
                new ResultList.Field("s", "string", String.class),
                new ResultList.Field("b", "boolean", Boolean.class));
            out.println(JSONSerializer.toString(resultList));

            // Test forward and backward iteration
            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet);
            resultList.setFields(new ResultList.Field("i"),
                new ResultList.Field("f"),
                new ResultList.Field("s"),
                new ResultList.Field("b"));

            Iterator<Map<String, Object>> iterator = resultList.iterator();
            while (iterator.hasNext()) {
                out.println(JSONSerializer.toString(iterator.next()));
            }
        } finally {
            if (connection != null) {
View Full Code Here

        try {
            connection = DriverManager.getConnection(connectionURL);
            Statement statement = connection.createStatement();
            ResultSet resultSet;
            ResultList resultList;

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet,
                new ResultList.Field("i"),
                new ResultList.Field("f"),
                new ResultList.Field("s"),
                new ResultList.Field("b"));
            out.println(JSONSerializer.toString(resultList));

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet,
                new ResultList.Field("i", "integer"),
                new ResultList.Field("f", "float"),
                new ResultList.Field("s", "string"),
                new ResultList.Field("b", "boolean"));
            out.println(JSONSerializer.toString(resultList));

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet,
                new ResultList.Field("i", "integer", Integer.class),
                new ResultList.Field("f", "float", Float.class),
                new ResultList.Field("s", "string", String.class),
                new ResultList.Field("b", "boolean", Boolean.class));
            out.println(JSONSerializer.toString(resultList));

            // Test forward and backward iteration
            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet,
                new ResultList.Field("i"),
                new ResultList.Field("f"),
                new ResultList.Field("s"),
                new ResultList.Field("b"));

            Iterator<Map<String, Object>> iterator = resultList.iterator();
            while (iterator.hasNext()) {
                out.println(JSONSerializer.toString(iterator.next()));
            }
        } finally {
            if (connection != null) {
View Full Code Here

        try {
            connection = DriverManager.getConnection(connectionURL);
            Statement statement = connection.createStatement();
            ResultSet resultSet;
            ResultList resultList;

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet,
                new ResultList.Field("i"),
                new ResultList.Field("f"),
                new ResultList.Field("s"),
                new ResultList.Field("b"));
            out.println(JSONSerializer.toString(resultList));

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet,
                new ResultList.Field("i", "integer"),
                new ResultList.Field("f", "float"),
                new ResultList.Field("s", "string"),
                new ResultList.Field("b", "boolean"));
            out.println(JSONSerializer.toString(resultList));

            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet,
                new ResultList.Field("i", "integer", Integer.class),
                new ResultList.Field("f", "float", Float.class),
                new ResultList.Field("s", "string", String.class),
                new ResultList.Field("b", "boolean", Boolean.class));
            out.println(JSONSerializer.toString(resultList));

            // Test forward and backward iteration
            resultSet = statement.executeQuery("SELECT * FROM result_list_test");
            resultList = new ResultList(resultSet,
                new ResultList.Field("i"),
                new ResultList.Field("f"),
                new ResultList.Field("s"),
                new ResultList.Field("b"));

            List.ItemIterator<Map<String, Object>> iterator = resultList.iterator();
            while (iterator.hasNext()) {
                out.println(JSONSerializer.toString(iterator.next()));
            }

            while(iterator.hasPrevious()) {
View Full Code Here

        return newMock(FieldValidatorSource.class);
    }

    protected final Field mockFieldWithLabel(String label)
    {
        Field field = mockField();

        train_getLabel(field, label);

        return field;
    }
View Full Code Here

    @Test(dataProvider = "parse_client_failure_data")
    public void parse_client_failure(Class type, String input, String expectedMessage)
    {
        Translator t = source.getByType(type);
        Field field = mockField();

        replay();

        try
        {
View Full Code Here

    public FieldTranslator createDefaultTranslator(ComponentResources resources, String parameterName)
    {
        assert resources != null;
        assert InternalUtils.isNonBlank(parameterName);
        Field field = (Field) resources.getComponent();
        Class propertyType = resources.getBoundType(parameterName);

        return createDefaultTranslator(field, resources.getId(), resources.getContainerMessages(),
                null, propertyType, resources.getAnnotationProvider(parameterName));
    }
View Full Code Here

    public FieldTranslator createTranslator(ComponentResources resources, String translatorName)
    {
        assert resources != null;
        assert InternalUtils.isNonBlank(translatorName);
        Field field = (Field) resources.getComponent();

        Translator translator = translatorSource.get(translatorName);

        return createTranslator(field, resources.getId(), resources.getContainerMessages(), null, translator);
    }
View Full Code Here

public class FieldTranslatorSourceImplTest extends InternalBaseTestCase
{
    @Test
    public void create_default_property_type_null()
    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;

        replay();
View Full Code Here

    }

    @Test
    public void create_default_translator_not_found_for_type()
    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        AnnotationProvider ap = mockAnnotationProvider(null);
View Full Code Here

TOP

Related Classes of org.apache.pivot.sql.ResultList$Field

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.