Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 28105 Details for
Bug 45807
Impossible to compile c++ applications
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
MySQL++ Example
mysql++_example.cpp (text/plain), 1.56 KB, created by
Curtis Magyar
on 2004-03-26 14:15:59 UTC
(
hide
)
Description:
MySQL++ Example
Filename:
MIME Type:
Creator:
Curtis Magyar
Created:
2004-03-26 14:15:59 UTC
Size:
1.56 KB
patch
obsolete
>#include <iostream> >#include <iomanip> >#include <sqlplus.hh> > >using namespace std; > >int main() { > Connection con("mysql_cpp_data"); > // The full format for the Connection constructor is > // Connection(cchar *db, cchar *host="", > // cchar *user="", cchar *passwd="") > // You may need to specify some of them if the database is not on > // the local machine or you database username is not the same as your > // login name, etc.. > >// Query query = con.query(); > // This creates a query object that is bound to con. > > con.query() << "select * from stock"; > // You can write to the query object like you would any other ostrem > > Result res = con.query().store(); > // Query::store() executes the query and returns the results > > cout << "Query: " << con.query().preview() << endl; > // Query::preview() simply returns a string with the current query > // string in it. > > cout << "Records Found: " << res.size() << endl << endl; > > Row row; > cout.setf(ios::left); > cout << setw(17) << "Item" > << setw(4) << "Num" > << setw(7) << "Weight" > << setw(7) << "Price" > << "Date" << endl > << endl; > > Result::iterator i; > // The Result class has a read-only Random Access Iterator > for (i = res.begin(); i != res.end(); i++) { > row = *i; > cout << setw(17) << row[0] > << setw(4) << row[1] > << setw(7) << row["weight"] > // you can use either the index number or column name when > // retrieving the colume data as demonstrated above. > << setw(7) << row[3] > << row[4] << endl; > } > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 45807
: 28105