Re: C++ client libs
| От | Bruce Momjian |
|---|---|
| Тема | Re: C++ client libs |
| Дата | |
| Msg-id | 200010090736.DAA05495@candle.pha.pa.us обсуждение исходный текст |
| Ответ на | Re: C++ client libs (Randy Jonasz <rjonasz@click2net.com>) |
| Список | pgsql-hackers |
> > > 2) Implement results as a returned object from pg_database
> > > result = db.exec();
> > > result >> field1 >> field2 >> field3;
> > > and
> > > field = result["field"];
> > > field = result[fieldnum];
Rogue Wave Software has an SQL C++ interface in dbtools.h++. It is
similar to what you describe. Here is a sample program:
#include <rw/db/db.h>
int main () { 1. RWDBDatabase enterpriseDB = RWDBManager :: database ("SYBASE",
"SYBASESERVER","ME", "PASSWORD", "DATA");
RWDBTable table1 = enterpriseDB.table("Actual_Sales");
2. RWDBReader table1Reader = table1.reader();
RWDBDatabase spreadsheet = RWDBManager :: database ("ODBC", "MS_EXCEL", "ME", "PASSWORD", "C:\mydir");
3. spreadsheet.createTable ("TMPSALES", table1.schema()); RWDBTable spreadsheetTable =
spreadsheet.table("TMPSALES");
4. RWDBInserter localInserter = spreadsheetTable.inserter(); while (table1Reader()) { localInserter <<
table1Reader;localInserter.execute(); }
...
5. /* Insert DDE code to plot your sales forecast, stored in the second spreadsheet, versus actual sales
now stored in the TMPSALES spreadsheet. */ }
There are white-papers describing the interface. It may be helpful for
ideas. You can see more at:
http://www.roguewave.com/products/xplatform/dbtools/
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026
В списке pgsql-hackers по дате отправления: