Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4H1RNA95062 for ; Wed, 16 May 2001 21:27:23 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f4H14gS85530 for pgsql-interfaces@postgresql.org; Wed, 16 May 2001 21:04:42 -0400 (EDT) (envelope-from news) From: Carlos Moreno X-Newsgroups: comp.databases.postgresql.interfaces Subject: libpq++ and strings. Date: Wed, 16 May 2001 21:04:26 -0400 Organization: Mochima Software / AudioSystems Lines: 42 Message-ID: <3B03239A.E4685125@mochima.com> References: <20010514151702.F14645@cistron.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: scrappy@hub.org X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en To: pgsql-interfaces@postgresql.org X-Archive-Number: 200105/80 X-Sequence-Number: 1607 I wonder why all the string parameters and return values are expressed in the form of char * or const char * ? After some time sticking to C++ and learning to hate (even more :-)) C strings, I find myself annoyed by not being able to do this: if (db.ExecTuplesOk ("select * from products")) { for loop ...... if (db.GetValue(row, "discontinued") == "t") { cout << "Disconinued"; } Or something like this: // Get results from one query and use one field to // produce another query: string query = "select * from table where ID='" + db.GetValue (row, "prodID") + "'"; Don't you just hate it? At least the second one is not that bad, because the compiler won't let you add two pointers. But the first one slips through the compiler, who doesn't have a problem with comparing two pointers -- it can not even know that the comparison will be unconditionally false to warn you... :-( Why not just changing all the parameters and return values to `const string &' and/or `string' ? Any thoughts? Carlos --