|
|
Choosing A Webhost: |
RE: closing connection to a database: msg#00005db.mysql.c++
I tried using query << sCommand.c_str(); only, but it doesn't work....and if I'll go with query.execute(); only, then it won't work coz there's no command that would be queried.... do I need to use query.update(x,x2); query.execute(); instead of doing query << sCommand.c_str(); query.execute(); ? Thanks! -aldrin ---- When each day is the same as the next, it's because people fail to recognize the good things that happen in their lives everyday that the sun rises... -The Alchemist -----Original Message----- From: Sinisa Milivojevic [mailto:sinisa@xxxxxxxxx] Sent: Tuesday, June 01, 2004 6:16 PM To: aldrin Cc: plusplus@xxxxxxxxxxxxxxx Subject: Re: closing connection to a database aldrin wrote: > I have this code inside a function: > > > > try{ > > Connection con( "conversar", "localhost", g_sUsername.c_str(), > g_sPassword.c_str() ); > > Query query = con.query(); > > query << sCommand.c_str(); > > query.execute(); > > }catch( BadQuery er) > > { > > fprintf( stderr, "Error in query: %s\n", sCommand.c_str() ); > > fprintf( stderr, "Error message: %s\n", er.error.c_str() ); > > return false; > > } > > > > If the program exits the function, will the connection to the database be > closed automatically? Or is there a special command to close the database > connection? > > Coz I am not sure if this illegal disconnection from database causes the > multiple instances of mysql in my Linux server. > > > > Thanks a lot! > > > > -Aldrin ;) > > It will be done automatically. That is basic C++. No multiple instances. Also do not use both a stream or execute. Use only one of those. Read the manual and examples. -- Sincerely, -- For technical support contracts, go to https://order.mysql.com/?ref=msmi __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic <sinisa@xxxxxxxxx> / /|_/ / // /\ \/ /_/ / /__ MySQL AB /_/ /_/\_, /___/\___\_\___/ Full time Developer and Support Coordinator <___/ www.mysql.com Larnaca, Cyprus -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=aldrin@xxxxxxxxxxxxxx -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=gcdmc-plusplus@xxxxxxxxxxx
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: linking problem: my_compress.o undefined, Darryl Rodden |
|---|---|
| Next by Date: | VC++ 6, Duncan, Daimen |
| Previous by Thread: | Re: closing connection to a database, Sinisa Milivojevic |
| Next by Thread: | Re: closing connection to a database, Sinisa Milivojevic |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |