cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Gentry" <blackn...@gmail.com>
Subject Re: show table status
Date Fri, 20 Jul 2007 14:50:21 GMT
That is a confusing aspect of Cayenne.  The Artist.class helps Cayenne
know which DataNode to use, which is your connection to your database.
 If all of your classes/objects are contained in a single database
(which is the most common case), you can use any of of your classes
and they'll connect you to the proper DataNode.  (Keep in mind that a
single DataContext can manage objects from different databases, so the
DataContext needs to know how to do the database routing -- and it
uses the Java class to determine this.)

HTH ...

/dev/mrg


On 7/20/07, Jack O'Connor <jo4185@bristol.ac.uk> wrote:
> Thanks for the reply, but all the SQLTemplates on that page require a
> class/table to refer to (all the examples are for Artist.class). The
> MySQL command "show table status" doesn't apply to any particular class...
>
> Jack
>
> Michael Gentry wrote:
> > I would think you'd be able to use an SQLTemplate to perform that kind
> > of query:
> >
> > http://cayenne.apache.org/doc20/sqltemplate-query.html
> >
> > You'll want to call setFetchingDataRows(true) on your SQLTemplate
> > object, too, otherwise Cayenne will try to make CayenneDataObjects out
> > of it.  Do this before you run performQuery().
> >
> > /dev/mrg
> >
> >
> > On 7/19/07, Jack O'Connor <jo4185@bristol.ac.uk> wrote:
> >> Hi all, in my project I need to extract the total db size(kb). Im using
> >> Cayenne 1.2.3 and MySQL and I found the SQL command "show table status
> >> from <db name>" which displays a table of information about all of the
> >> tables in a certain db. This table has columns like "Name"(of table),
> >> "Data_length" and "Index_length", and apparently the best way to extract
> >> the size(kb) of a db is to sum the Data_length and Index_length columns
> >> of this table.
> >>
> >> Does anyone know how I can get the results of this query into java?
> >>
> >> Many Thanks
> >> Jack
> >>
>

Mime
View raw message