Thanks a lot kevin ; ). But I think it look likes the first code I posted,
except by the assert you added.

Adriano Crestani

On 2/8/07, Kevin Williams <[EMAIL PROTECTED]> wrote:

Your focus should probably be on the APIs your DAS will provide the user
whether that is from a servlet or some other caller.  Here are the Java
DAS apis from the simplest possible read in the test suite:

        /**
         * Read a specific customer
         */
        public void testReadSingle() throws Exception {

            // Create and initialize command to read customers
            DAS das = DAS.FACTORY.createDAS(getConnection());
            Command readCustomers = das.createCommand("select * from
    CUSTOMER where ID = 1");

            // Read
            DataObject root = readCustomers.executeQuery();

            // Verify
            assertEquals(1, root.getInt("CUSTOMER[1]/ID"));
        }

Notice that this example also does not allow parameterized queries.  I
would make this simplifying assumption to get something up and running.

I cannot help with the C++ equivalent of JDBC Connection but I am sure
there is something similar available.

--
Kevin



Adriano Crestani wrote:

> Good idea kelvin, but I'm begginer in servlet and I don't know what
> would be
> the best way for the user to provide the connection and sql. Though I
> tried
> this:
>
> import java.io.IOException;
> import java.sql.DriverManager;
>
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest ;
> import javax.servlet.http.HttpServletResponse;
>
> import org.apache.tuscany.das.rdb.Command;
> import org.apache.tuscany.das.rdb.DAS;
>
> import commonj.sdo.DataObject;
>
> public class CommandServlet extends HttpServlet {
>
>    private static final long serialVersionUID = 1922159305255311505L;
>
>    public CommandServlet() {}
>
>    protected void doGet(HttpServletRequest arg0, HttpServletResponse
> arg1)
> throws ServletException, IOException {
>        DataObject items = test(getConnection(), "SELECT id FROM item
> WHERE
> id = 1;");
>        System.out.println("id = " + items.getInt("ITEM[1]/ID"));
>
>    }
>
>    public DataObject test(java.sql.Connection conn, String readSql) {
>        DAS das = DAS.FACTORY.createDAS(conn);
>
>        Command command = das.createCommand();
>        DataObject allItems = command.executeQuery();
>
>        return allItems;
>
>    }
>
>    }
>
> }
>
> Adriano Crestani
>
> On 2/8/07, Kevin Williams <[EMAIL PROTECTED]> wrote:
>
>>
>> You could actually start significantly simpler by making the following
>> assumptions:
>>
>>    1. Read of a single table
>>    2. User provides SQL programatically
>>    3. User provides Connection programatically
>>
>> With these restrictions you can get something useful working without
the
>> classes required for config-file support.
>>
>> --
>> Kevin
>>
>>
>> Adriano Crestani wrote:
>>
>> > Luciano suggested to implement at first, the necessary classes to
>> > create a
>> > simple app that only reads from a database using the das c++. I was
>> > checking
>> > on the das java that these classes below are essential to create this
>> > app.
>> >
>> > DAS
>> > DASFactory
>> > DASImpl
>> > ConfigFactory
>> > ConfigFactoryImpl
>> > Config
>> > MappingWrapper
>> > config.Command
>> > ReadCommandImpl
>> > Command
>> > CommandImpl
>> > ConnectionInfo
>> >
>> >
>> > All these classes may be found in das java. I'm needing some
>> > volunteers to
>> > help implement these classes in c++. Actually, these classes are
>> > implemented, but are not compiling yet. So we need these classes
>> > compiling
>> > and implement a simple read app with these classes.
>> >
>> > Any suggestion will be appreciated.
>> >
>> > Adriano Crestani
>> >
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to