----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
> > We built a class library that allows people to do:
> > yourdb.insertRow("yourtable",hashtableofvalues);
> > and
>
> KeyDef kd = new KeyDef().attAttrib("key_col_name");
> TableDataSet tds = new TableDataSet(conn,"table_name", kd);
> Record rec = tds.addRecord();
> rec.setValue ("colname1", value );
> rec.setValue ("colname2", value );
> rec.setValue ("colname3", value );
> rec.setValue ("colname4", value );
> rec.save()
> tds.close();
I think Village is a great start.
But there are still 5 lines of code compared to 1. Hash tables are very
powerful, people should use them more often.
I would just suggest adding another layer on top of Village to really stream
line things.
Just be sure to use the meta information to deduce which columns are in the
table, ie make sure the appropriate setValues happen.
The trouble with using setValue's is that apparent in this situation. After
months of development, another column is added to a table. You now have to
add additional setValues for the new columns, every time there is an update
or insert.
We try to built our database manipulation routines to accept Hashtables.
This allows the function to pass along column values it doesn't care about.
Consequently, when new columns are added to a table, nothing breaks and that
column is passed along gracefully.
Of course you could just make an object for every table. But at times that
becomes overkill. And even then, you have to worry about not preserving
additional columns.
>
> >
> yourdb.updateRow("yourtable","primarykey1,primarykey2",hashtab
> leofvalues);
> > and so forth.
>
> KeyDef kd = new KeyDef().attAttrib("key_col_name");
> TableDataSet tds = new TableDataSet(conn,"table_name", kd);
> tds.where ("foo=bar");
> tds.fetchRecords(1);
>
> Record rec = tds.getRecord(0);
> rec.setValue ("colname1", value );
> rec.setValue ("colname2", value );
> rec.setValue ("colname3", value );
> rec.setValue ("colname4", value );
>
> rec.save()
> tds.close();
>
> of course value can be any java object that will get
> auto-translated into
> the appropriate type for the column.
>
> > Does Village allow you do to that?
>
> Of course. Yes.
>
> -jon
>
>
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Archives and Other: <http://java.apache.org/main/mail.html>
> Problems?: [EMAIL PROTECTED]
>
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]