@@ -73,7 +73,7 @@ dut_pqxx::dut_pqxx(std::string conninfo)
7373void dut_pqxx::test (const std::string &stmt)
7474{
7575 try {
76- #ifndef HAVE_LIBPQXX7
76+ #if !defined( HAVE_LIBPQXX7) && !defined(HAVE_LIBPQXX8)
7777 if (!c.is_open ())
7878 c.activate ();
7979#endif
@@ -120,13 +120,24 @@ schema_pqxx::schema_pqxx(std::string &conninfo, bool no_catalog) : c(conninfo)
120120 " from pg_type " );
121121
122122 for (auto row = r.begin (); row != r.end (); ++row) {
123+ #ifdef HAVE_LIBPQXX8
124+ pqxx::row_ref row_ref = row[0 ];
125+ string name (row_ref[0 ].as <string>());
126+ OID oid (row_ref[1 ].as <OID>());
127+ string typdelim (row_ref[2 ].as <string>());
128+ OID typrelid (row_ref[3 ].as <OID>());
129+ OID typelem (row_ref[4 ].as <OID>());
130+ OID typarray (row_ref[5 ].as <OID>());
131+ string typtype (row_ref[6 ].as <string>());
132+ #else
123133 string name (row[0 ].as <string>());
124134 OID oid (row[1 ].as <OID>());
125135 string typdelim (row[2 ].as <string>());
126136 OID typrelid (row[3 ].as <OID>());
127137 OID typelem (row[4 ].as <OID>());
128138 OID typarray (row[5 ].as <OID>());
129139 string typtype (row[6 ].as <string>());
140+ #endif
130141 // if (schema == "pg_catalog")
131142 // continue;
132143 // if (schema == "information_schema")
@@ -154,14 +165,26 @@ schema_pqxx::schema_pqxx(std::string &conninfo, bool no_catalog) : c(conninfo)
154165 " from information_schema.tables" );
155166
156167 for (auto row = r.begin (); row != r.end (); ++row) {
168+ #ifdef HAVE_LIBPQXX8
169+ pqxx::row_ref row_ref = row[0 ];
170+ string schema (row_ref[1 ].as <string>());
171+ string insertable (row_ref[2 ].as <string>());
172+ string table_type (row_ref[3 ].as <string>());
173+ #else
157174 string schema (row[1 ].as <string>());
158175 string insertable (row[2 ].as <string>());
159176 string table_type (row[3 ].as <string>());
177+ #endif
160178
161179 if (no_catalog && ((schema == " pg_catalog" ) || (schema == " information_schema" )))
162180 continue ;
163181
164- tables.push_back (table (row[0 ].as <string>(),
182+ tables.push_back (
183+ #ifdef HAVE_LIBPQXX8
184+ table (row[0 ][0 ].as <string>(),
185+ #else
186+ table (row[0 ].as <string>(),
187+ #endif
165188 schema,
166189 ((insertable == " YES" ) ? true : false ),
167190 ((table_type == " BASE TABLE" ) ? true : false )));
@@ -288,7 +311,7 @@ schema_pqxx::schema_pqxx(std::string &conninfo, bool no_catalog) : c(conninfo)
288311 }
289312 }
290313 cerr << " done." << endl;
291- #ifdef HAVE_LIBPQXX7
314+ #if defined( HAVE_LIBPQXX7) || defined(HAVE_LIBPQXX8)
292315 c.close ();
293316#else
294317 c.disconnect ();
0 commit comments