17
17
#include < q3listbox.h>
18
18
#include < QMessageBox>
19
19
#include " qgspgquerybuilder.h"
20
+ #include < qgslogger.h>
20
21
// default constructor
21
22
QgsPgQueryBuilder::QgsPgQueryBuilder (QWidget *parent, Qt::WFlags fl)
22
23
: QDialog(parent, fl)
@@ -102,7 +103,7 @@ void QgsPgQueryBuilder::populateFields()
102
103
// field name, type, length, and precision (if numeric)
103
104
QString sql = " select * from \" " + mUri ->schema + " \" .\" " + mUri ->table + " \" limit 1" ;
104
105
PGresult *result = PQexec (mPgConnection , (const char *) (sql.utf8 ()));
105
- qWarning (( " Query executed: " + sql). toLocal8Bit (). data () );
106
+ QgsLogger::debug ( " Query executed: " + sql);
106
107
if (PQresultStatus (result) == PGRES_TUPLES_OK)
107
108
{
108
109
// --std::cout << "Field: Name, Type, Size, Modifier:" << std::endl;
@@ -111,26 +112,26 @@ void QgsPgQueryBuilder::populateFields()
111
112
QString fieldName = PQfname (result, i);
112
113
int fldtyp = PQftype (result, i);
113
114
QString typOid = QString ().setNum (fldtyp);
114
- std::cerr << " typOid is: " << typOid. toLocal8Bit (). data () << std::endl ;
115
+ QgsLogger::debug ( " typOid is: " + typOid) ;
115
116
int fieldModifier = PQfmod (result, i);
116
117
QString sql = " select typelem from pg_type where typelem = " + typOid + " and typlen = -1" ;
117
118
// //--std::cout << sql << std::endl;
118
119
PGresult *oidResult = PQexec (mPgConnection ,
119
120
(const char *) (sql.utf8 ()));
120
121
if (PQresultStatus (oidResult) == PGRES_TUPLES_OK)
121
- std::cerr << " Ok fetching typelem using\n " << sql. toLocal8Bit (). data () << std::endl ;
122
+ QgsLogger::debug ( " Ok fetching typelem using\n " + sql) ;
122
123
123
124
// get the oid of the "real" type
124
125
QString poid = QString::fromUtf8 (PQgetvalue (oidResult, 0 ,
125
126
PQfnumber (oidResult,
126
127
" typelem" )));
127
- std::cerr << " poid is: " << poid. toLocal8Bit (). data () << std::endl ;
128
+ QgsLogger::debug ( " poid is: " + poid) ;
128
129
PQclear (oidResult);
129
130
sql = " select typname, typlen from pg_type where oid = " + poid;
130
131
// //--std::cout << sql << std::endl;
131
132
oidResult = PQexec (mPgConnection , (const char *) (sql.utf8 ()));
132
133
if (PQresultStatus (oidResult) == PGRES_TUPLES_OK)
133
- std::cerr << " Ok fetching typenam,etc\n " ;
134
+ QgsLogger::debug ( " Ok fetching typenam,etc\n " ) ;
134
135
135
136
QString fieldType = QString::fromUtf8 (PQgetvalue (oidResult, 0 , 0 ));
136
137
QString fieldSize = QString::fromUtf8 (PQgetvalue (oidResult, 0 , 1 ));
0 commit comments