Skip to content

Commit

Permalink
Move various debugging outputs to QgsLogger::debug so as to reduce
Browse files Browse the repository at this point in the history
the amount of user-confusing output on the console.


git-svn-id: http://svn.osgeo.org/qgis/trunk@5777 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Sep 7, 2006
1 parent a398f68 commit 69d99b1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/gui/qgspgquerybuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <q3listbox.h>
#include <QMessageBox>
#include "qgspgquerybuilder.h"
#include <qgslogger.h>
// default constructor
QgsPgQueryBuilder::QgsPgQueryBuilder(QWidget *parent, Qt::WFlags fl)
: QDialog(parent, fl)
Expand Down Expand Up @@ -102,7 +103,7 @@ void QgsPgQueryBuilder::populateFields()
// field name, type, length, and precision (if numeric)
QString sql = "select * from \"" + mUri->schema + "\".\"" + mUri->table + "\" limit 1";
PGresult *result = PQexec(mPgConnection, (const char *) (sql.utf8()));
qWarning(("Query executed: " + sql).toLocal8Bit().data());
QgsLogger::debug("Query executed: " + sql);
if (PQresultStatus(result) == PGRES_TUPLES_OK)
{
//--std::cout << "Field: Name, Type, Size, Modifier:" << std::endl;
Expand All @@ -111,26 +112,26 @@ void QgsPgQueryBuilder::populateFields()
QString fieldName = PQfname(result, i);
int fldtyp = PQftype(result, i);
QString typOid = QString().setNum(fldtyp);
std::cerr << "typOid is: " << typOid.toLocal8Bit().data() << std::endl;
QgsLogger::debug("typOid is: " + typOid);
int fieldModifier = PQfmod(result, i);
QString sql = "select typelem from pg_type where typelem = " + typOid + " and typlen = -1";
// //--std::cout << sql << std::endl;
PGresult *oidResult = PQexec(mPgConnection,
(const char *) (sql.utf8()));
if (PQresultStatus(oidResult) == PGRES_TUPLES_OK)
std::cerr << "Ok fetching typelem using\n" << sql.toLocal8Bit().data() << std::endl;
QgsLogger::debug("Ok fetching typelem using\n" + sql);

// get the oid of the "real" type
QString poid = QString::fromUtf8(PQgetvalue(oidResult, 0,
PQfnumber(oidResult,
"typelem")));
std::cerr << "poid is: " << poid.toLocal8Bit().data() << std::endl;
QgsLogger::debug("poid is: " + poid);
PQclear(oidResult);
sql = "select typname, typlen from pg_type where oid = " + poid;
// //--std::cout << sql << std::endl;
oidResult = PQexec(mPgConnection, (const char *) (sql.utf8()));
if (PQresultStatus(oidResult) == PGRES_TUPLES_OK)
std::cerr << "Ok fetching typenam,etc\n";
QgsLogger::debug("Ok fetching typenam,etc\n");

QString fieldType = QString::fromUtf8(PQgetvalue(oidResult, 0, 0));
QString fieldSize = QString::fromUtf8(PQgetvalue(oidResult, 0, 1));
Expand Down

0 comments on commit 69d99b1

Please sign in to comment.