0

Error:

The inferior stopped because it received a signal from the Operating System.

Signal name : SIGABRT Signal meaning : Aborted

Code Snippet:

#include "postgresql.h"
#include <QtSql>
QString config_host,config_dbname,config_dbuser,config_dbpassword, config_dbport;
PostgreSQL::PostgreSQL()
{

}
void PostgreSQL::config(QString dbHost, QString dbName, QString dbUser, QString dbPassword, QString dbPort){
 config_host = dbHost;
 config_dbname = dbName;
 config_dbuser = dbUser;
 config_dbpassword = dbPassword;
 config_dbport = dbPort;
}
void PostgreSQL::connect(QSqlDatabase db){
 db.setHostName(config_host);
 db.setDatabaseName(config_dbname);
 db.setUserName(config_dbuser);
 db.setPassword(config_dbpassword);
 db.setPort(config_dbport.toInt());
}

QSqlQuery* PostgreSQL::query(QString sql, int con){
 QString connect = QString::number(con);
 QSqlDatabase db;
 if(QSqlDatabase::contains(connect)){
 db = QSqlDatabase::database(connect);
 qDebug() « db.connectionName();
 }else{
 db = QSqlDatabase::addDatabase("QPSQL", connect);
 this->connect(db);
 qDebug() « db.connectionNames();
 qDebug() « "PostgreSQL connect ?: " « (db.open() ? "YES" : "NO");
 }

 QSqlQuery *query;
 query = new QSqlQuery(db);
 query->exec(sql);
 return query;
}

38 line... query->exec(sql);

  • 2
    The right tool to solve such problems is your debugger. You should step through your code line-by-line *before* asking on Stack Overflow. For more help, please read [How to debug small programs (by Eric Lippert)](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/). At a minimum, you should \[edit] your question to include a [Minimal, Complete, and Verifiable](http://stackoverflow.com/help/mcve) example that reproduces your problem, along with the observations you made in the debugger. – πάντα ῥεῖ Oct 12 '16 at 15:49
  • Only SIGABRT no other errors ? what are you getting from those qDebug() – Marco Oct 12 '16 at 15:50
  • @Marco only. log qt - [link](http://ru-ms.ru/log.txt) – Dmitriy Klimov Oct 12 '16 at 15:52

0 Answers0