Re: [sqlite] how to restore the column values into the structure.
HI Dinesh, You just given the classes. You didn't give actual work the functions do. Can you tell me how i can do in C. Regards, Bhaskar. Dinesh Behl wrote: > > Hi Bhaskar, > > I wrote the code to store the result of SELECT query. > > I treated the resultset as a table where each cell is the column value and > row is set of cells, and table is set of rows. > > > Below is the snippet of the class structure. You can modify it as per ur > requirement. > > Hope it helps. > > Dinesh > > class SwCell > > { > > private: > > string m_strName; > > string m_strValue; > > string m_strType; > > public : > > string getName(); > > string getValue(); > > int getType(); > > void setType(int type); > > void setName(string name); > > void setValue(string value); > > }; > > class SwRow { > > vector m_Row; > > public: > > void addCell(SwCell val); > > void addCell(vector cells); > > SWDBI_API SwCell getCell(int index); > > SWDBI_API SwCell getCell(string cellName); > > SWDBI_API int size(); > > SWDBI_API vector getRow(); > > }; > > class SwRowset > > { > > vector m_Rowset; > > public: > > void addRow(SwRow val); > > SWDBI_API SwRow getRow(int index); > > SWDBI_API int size(); > > }; > > > On Fri, Jan 20, 2012 at 2:52 AM, bhaskarReddywrote: > >> >> Hi Friends, >> >>How to store the values of a columns in to the appropriate >> variables. >> >> struct ABC >> { >> int a; >> int b; >> char *str; >> }; >> >>a bname >>1 2 ABCD >>2 4 WXYZ >> >> >> Now i am taking a variable to a structure, and i want to load the >> column >> values of a particular row. >> >> ex: struct ABC st; >> >>st.a = //store the record 1's 'a' value. >>st.b = // store the record 1's 'b' value. >> st.str = // store the record 1's'name' value. >> >> Regards, >> Bhaskar Reddy. >> -- >> View this message in context: >> http://old.nabble.com/how-to-restore-the-column-values-into-the-structure.-tp33172778p33172778.html >> Sent from the SQLite mailing list archive at Nabble.com. >> >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://old.nabble.com/how-to-restore-the-column-values-into-the-structure.-tp33172778p33186337.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] how to restore the column values into the structure.
Hi Bhaskar, I wrote the code to store the result of SELECT query. I treated the resultset as a table where each cell is the column value and row is set of cells, and table is set of rows. Below is the snippet of the class structure. You can modify it as per ur requirement. Hope it helps. Dinesh class SwCell { private: string m_strName; string m_strValue; string m_strType; public : string getName(); string getValue(); int getType(); void setType(int type); void setName(string name); void setValue(string value); }; class SwRow { vector m_Row; public: void addCell(SwCell val); void addCell(vector cells); SWDBI_API SwCell getCell(int index); SWDBI_API SwCell getCell(string cellName); SWDBI_API int size(); SWDBI_API vector getRow(); }; class SwRowset { vector m_Rowset; public: void addRow(SwRow val); SWDBI_API SwRow getRow(int index); SWDBI_API int size(); }; On Fri, Jan 20, 2012 at 2:52 AM, bhaskarReddywrote: > > Hi Friends, > >How to store the values of a columns in to the appropriate > variables. > > struct ABC > { > int a; > int b; > char *str; > }; > >a bname >1 2 ABCD >2 4 WXYZ > > > Now i am taking a variable to a structure, and i want to load the column > values of a particular row. > > ex: struct ABC st; > >st.a = //store the record 1's 'a' value. >st.b = // store the record 1's 'b' value. > st.str = // store the record 1's'name' value. > > Regards, > Bhaskar Reddy. > -- > View this message in context: > http://old.nabble.com/how-to-restore-the-column-values-into-the-structure.-tp33172778p33172778.html > Sent from the SQLite mailing list archive at Nabble.com. > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] how to restore the column values into the structure.
Hi Friends, How to store the values of a columns in to the appropriate variables. struct ABC { int a; int b; char *str; }; a bname 1 2 ABCD 2 4 WXYZ Now i am taking a variable to a structure, and i want to load the column values of a particular row. ex: struct ABC st; st.a = //store the record 1's 'a' value. st.b = // store the record 1's 'b' value. st.str = // store the record 1's'name' value. Regards, Bhaskar Reddy. -- View this message in context: http://old.nabble.com/how-to-restore-the-column-values-into-the-structure.-tp33172778p33172778.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users