Re: [Cppcms-users] cppdb::result::get problem
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2012-04-30 07:10:42
|
Hi There is full support of colum names But you should refer to your engine documentation to see what the actual name is: In general the drivers use following API: sqlite3: sqlite3_column_name postgresql: PQfnumber mysql: mysql_fetch_fields odbc: SQLDescribeCol So if you do not get expected result you can debug it by converting column indexes to names and see what names are actually in use. cppdb::result::name would give you then names and then see what is wrong. In general using column names is much slower then using index, as it requires name - to index lookup. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: "ke...@co..." <ke...@co...> >To: cpp...@li... >Sent: Monday, April 30, 2012 9:40 AM >Subject: Re: [Cppcms-users] cppdb::result::get problem > > >At first. Never use select * >http://stackoverflow.com/questions/1433971/select-from-table-or-select-id-field1-field2-field3-from-table-best-practi >If you solve that problem then you can access them via integer index. > >The other one. Good question. Maybe artyom can say something about it. >-- >Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet. > > > > >ele...@ex... schrieb: >Hello, >> >>Supposing I have a SELECT * FROM sometable st LEFT OUTER JOIN othertable >>ot ON (st.ot_id=ot.id) ... >> >>Then looping through the results using result::next() >> >>Why can't I access the results this way? >> >>r.get<string>("st.columnA") ? >> >>Imagine you want to get all the columns from both tables and some have >>duplicate column names such as - id or name >> >>Petr >> >> >>>>________________________________ >> >>Live Security Virtual Conference >>Exclusive live event will cover all the ways today's security and >>threat landscape has changed and how IT managers can respond. Discussions >>will include endpoint security, mobile security and the latest in malware >>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>>>________________________________ >> >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >------------------------------------------------------------------------------ >Live Security Virtual Conference >Exclusive live event will cover all the ways today's security and >threat landscape has changed and how IT managers can respond. Discussions >will include endpoint security, mobile security and the latest in malware >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |