mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 12:34:39 +03:00
singnal queryTextChanged(const QString& queryName, const QString& queryText) has been added to QueryDesc
singnal queryTextChanged(const QString& queryName, const QString& queryText) has been added to QueryDesc
This commit is contained in:
parent
bf6adc13c3
commit
885cd91daa
@ -158,6 +158,7 @@ void QueryHolder::fillParams(QSqlQuery *query)
|
||||
void QueryHolder::extractParams()
|
||||
{
|
||||
m_preparedSQL = replaceVariables(m_queryText);
|
||||
m_prepared = true;
|
||||
}
|
||||
|
||||
QString QueryHolder::replaceVariables(QString query)
|
||||
@ -195,6 +196,11 @@ QString QueryHolder::queryText()
|
||||
void QueryHolder::setQueryText(QString queryText)
|
||||
{
|
||||
m_queryText=queryText;
|
||||
m_prepared = false;
|
||||
if (m_query) {
|
||||
delete m_query;
|
||||
m_query = 0;
|
||||
}
|
||||
}
|
||||
|
||||
IDataSource* QueryHolder::dataSource(IDataSource::DatasourceMode mode)
|
||||
@ -364,7 +370,7 @@ void ConnectionDesc::setName(const QString &value)
|
||||
}
|
||||
|
||||
QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection)
|
||||
:m_queryName(queryName), m_query(queryText), m_connectionName(connection)
|
||||
:m_queryName(queryName), m_queryText(queryText), m_connectionName(connection)
|
||||
{}
|
||||
|
||||
SubQueryHolder::SubQueryHolder(QString queryText, QString connectionName, QString masterDatasource, DataSourceManager* dataManager)
|
||||
|
@ -159,13 +159,15 @@ public:
|
||||
explicit QueryDesc(QObject* parent=0):QObject(parent){}
|
||||
void setQueryName(QString value){m_queryName=value;}
|
||||
QString queryName(){return m_queryName;}
|
||||
void setQueryText(QString value){m_query=value;}
|
||||
QString queryText(){return m_query;}
|
||||
void setQueryText(QString value){m_queryText=value; emit queryTextChanged(m_queryName, m_queryText);}
|
||||
QString queryText(){return m_queryText;}
|
||||
void setConnectionName(QString value){m_connectionName=value;}
|
||||
QString connectionName(){return m_connectionName;}
|
||||
signals:
|
||||
void queryTextChanged(const QString& queryName, const QString& queryText);
|
||||
private:
|
||||
QString m_queryName;
|
||||
QString m_query;
|
||||
QString m_queryText;
|
||||
QString m_connectionName;
|
||||
};
|
||||
|
||||
|
@ -620,13 +620,7 @@ bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection)
|
||||
return false;
|
||||
}
|
||||
|
||||
void DataSourceManager::addQueryDesc(QueryDesc *query)
|
||||
{
|
||||
m_queries.append(query);
|
||||
addQuery(query->queryName(), query->queryText(), query->connectionName());
|
||||
}
|
||||
|
||||
void DataSourceManager::putHolder(QString name, IDataSourceHolder *dataSource)
|
||||
void DataSourceManager::putHolder(const QString& name, IDataSourceHolder *dataSource)
|
||||
{
|
||||
if (!m_datasources.contains(name.toLower())){
|
||||
m_datasources.insert(
|
||||
@ -640,6 +634,8 @@ void DataSourceManager::putQueryDesc(QueryDesc* queryDesc)
|
||||
{
|
||||
if (!containsDatasource(queryDesc->queryName())){
|
||||
m_queries.append(queryDesc);
|
||||
connect(queryDesc, SIGNAL(queryTextChanged(QString,QString)),
|
||||
this, SLOT(slotQueryTextChanged(QString,QString)));
|
||||
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(queryDesc->queryName()));
|
||||
}
|
||||
|
||||
@ -647,6 +643,8 @@ void DataSourceManager::putSubQueryDesc(SubQueryDesc *subQueryDesc)
|
||||
{
|
||||
if (!containsDatasource(subQueryDesc->queryName())){
|
||||
m_subqueries.append(subQueryDesc);
|
||||
connect(subQueryDesc, SIGNAL(queryTextChanged(QString,QString)),
|
||||
this, SLOT(slotQueryTextChanged(QString,QString)));
|
||||
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(subQueryDesc->queryName()));
|
||||
}
|
||||
|
||||
@ -1058,6 +1056,14 @@ void DataSourceManager::slotConnectionRenamed(const QString &oldName, const QStr
|
||||
}
|
||||
}
|
||||
|
||||
void DataSourceManager::slotQueryTextChanged(const QString &queryName, const QString &queryText)
|
||||
{
|
||||
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(queryName));
|
||||
if (holder){
|
||||
holder->setQueryText(queryText);
|
||||
}
|
||||
}
|
||||
|
||||
void DataSourceManager::clear(ClearMethod method)
|
||||
{
|
||||
DataSourcesMap::iterator dit;
|
||||
|
@ -195,8 +195,7 @@ signals:
|
||||
void cleared();
|
||||
void datasourcesChanged();
|
||||
protected:
|
||||
void addQueryDesc(QueryDesc *);
|
||||
void putHolder(QString name, LimeReport::IDataSourceHolder* dataSource);
|
||||
void putHolder(const QString& name, LimeReport::IDataSourceHolder* dataSource);
|
||||
void putQueryDesc(QueryDesc *queryDesc);
|
||||
void putSubQueryDesc(SubQueryDesc *subQueryDesc);
|
||||
void putProxyDesc(ProxyDesc *proxyDesc);
|
||||
@ -217,6 +216,7 @@ protected:
|
||||
|
||||
private slots:
|
||||
void slotConnectionRenamed(const QString& oldName,const QString& newName);
|
||||
void slotQueryTextChanged(const QString& queryName, const QString& queryText);
|
||||
private:
|
||||
explicit DataSourceManager(QObject *parent = 0);
|
||||
Q_DISABLE_COPY(DataSourceManager)
|
||||
|
Loading…
Reference in New Issue
Block a user