List:MySQL++« Previous MessageNext Message »
From:Jay Rajput Date:November 20 2008 3:48am
Subject:SSQLs - doing a SQL where clause query without specifying the columns
View as plain text  
I want to use SSQLs to do query without specifying the columns. This will
again help in my code to hide the database column name. This way if the
table column names changes anytime I just need to update my SSQLs and I will
be good.

What I have in my mind is something like this.

stock item;
item.id = "5";
item.getById();

or something like this

query << "SELECT " << stock.cols() << " FROM stock " << "WHERE id
= 5 ";
StoreQueryResult res = query.store();
stock item = res[0];

I do know that there is nothing like cols(), but I was thinking if there is
some function like that which can give me the column names for the table. It
will be good if I can even replace the id in the SQL where clause with
something from the SSQLS.

And then I should be expecting all the members in the item structure to be
populated with the values. I know the code which I have in mind does not
have error handling. I have really not thought about the error scenarios
like what will happen if there is no But what I am searching is something
which helps me hide the column names. The column names are already in the
SSQLS. Cannot those be somehow re-used.

Thanks & Regards,
Jay.

Thread
SSQLs - doing a SQL where clause query without specifying the columnsJay Rajput20 Nov
  • Re: SSQLs - doing a SQL where clause query without specifying thecolumnsWarren Young20 Nov