List:MySQL++« Previous MessageNext Message »
From:Jim Langston Date:June 28 2006 8:55am
Subject:Re: Large class to table
View as plain text  
On 6/21/06, Warren Young <mysqlpp@stripped> wrote:
> Warren Young wrote:
> >
> > Read up on template queries in the user manual.
> One other thing: you'll have to change the value at the top of
> and re-run the script, since the default limit is 25 fields.

I've been giving this some thought, and have come up with a way to design a
class that will work in the way I want.  I see no reason, other than a few
more calls, that a class couldn't build the SQL string itself.   The biggest
part, of course, would be the field names, but that already exists in the
INFORMATION_SCHEMA_COLUMNS table and even seems to be exposed in MySQL++ in
the return.

My main question then becomes, why hasn't anyone done this yet, or has
someone?  I see this to be very benifitial, where I would be able to do
something like (and this would not be exactly the way it woudl be, more like
pseudo code):

Connection con(use_exceptions);
if ( ! connect_to_db( argc, argv, con ))
  return 1;

TableSet UserTable( con, "abyssal.user" );
// This would actually build the field information and store it in a
TableSet class.

UserTable.insert() << MyString << MyFloat << MyInt << MyOtherInt
<< MyBool;

Query query = con.query();
query << UserTable.insertquery();

// rest standard MySQL++ stuff

The main disadvantage I see is the time required to build the table
information for the table.  But this should only have to be done once for
each table, and be reusable over and over for many queries, inserts,
changes, etc... in the particular table.

Does anyone think this would be a Good Thing or a Bad Thing?  If people
think it would be a Good Thing (and I personally do) then I will go and
write it.  It is something I really want that makes queries a little more
dynamic IMO.

Large class to tableJim Langston21 Jun
  • RE: Large class to tableSteve Orton21 Jun
  • Re: Large class to tableWarren Young21 Jun
    • Re: Large class to tableWarren Young21 Jun
      • Re: Large class to tableJim Langston28 Jun
        • Re: Large class to tableWarren Young29 Jun