<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7653.38">
<TITLE>tablereader /tablewriter</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>hi,<BR>
<BR>
i had written a simple c++ program given below for writing to a table from a table.it dint work ,but there are no errors .i think this is either logical / syntax error from my part .i'm new to libpqxx .can somebody tell me what is the problem with this program?<BR>
<BR>
<BR>
<BR>
#include<iostream><BR>
#include<pqxx/pqxx><BR>
<BR>
using namespace std;<BR>
using namespace pqxx;<BR>
<BR>
int main()<BR>
{<BR>
<BR>
try<BR>
{<BR>
const string connstring("host=127.0.0.1 dbname=template1 user=pgsql password=");<BR>
string m_Table("employee_copy");<BR>
connection conn(connstring);<BR>
transaction<serializable> T(conn);<BR>
T.exec(("CREATE TABLE " + m_Table + "(NAME VARCHAR(20),DESIGNATION VARCHAR(15),EMPLOYEE_NUMBER INTEGER)").c_str());<BR>
tablereader read_orig(T,"employee");<BR>
read_orig.complete();<BR>
tablewriter copy_dest(T,m_Table);<BR>
copy_dest<<read_orig;<BR>
copy_dest.complete();<BR>
T.commit();<BR>
<BR>
}<BR>
catch(const sql_error &e)<BR>
{<BR>
cerr<<"exception:"<<e.what()<<endl;<BR>
}<BR>
catch(const exception &e)<BR>
{<BR>
cerr<<"exception:"<<e.what()<<endl;<BR>
}<BR>
<BR>
<BR>
}<BR>
<BR>
void on_commit()<BR>
{<BR>
cout<<"\n\ntable copied";<BR>
}<BR>
<BR>
<BR>
Thanks and regards,<BR>
Roshni</FONT>
</P>
</BODY>
</HTML>