diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-11 16:53:26 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-11 16:53:26 -0600 |
commit | c91e96258b6c127201397dd5309c4433655e63b2 (patch) | |
tree | 85682ed6f7056b51a95e85cf1711ffcc74588d34 /kexi | |
parent | 5ec453c2580654ef1d9c019964fa3b9cf3c601a9 (diff) | |
download | koffice-c91e96258b6c127201397dd5309c4433655e63b2.tar.gz koffice-c91e96258b6c127201397dd5309c4433655e63b2.zip |
Apply a number of kexi patches
This closes Bug 777
Diffstat (limited to 'kexi')
-rw-r--r-- | kexi/core/kexidbconnectionset.cpp | 2 | ||||
-rw-r--r-- | kexi/formeditor/widgetlibrary.cpp | 2 | ||||
-rw-r--r-- | kexi/kexidb/alter.cpp | 2 | ||||
-rw-r--r-- | kexi/kexidb/connection.cpp | 10 | ||||
-rw-r--r-- | kexi/kexidb/drivers/pqxx/pqxxcursor.cpp | 8 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqlitecursor.cpp | 8 | ||||
-rw-r--r-- | kexi/kexidb/expression.cpp | 8 | ||||
-rw-r--r-- | kexi/kexidb/fieldlist.cpp | 2 | ||||
-rw-r--r-- | kexi/kexidb/fieldvalidator.cpp | 2 | ||||
-rw-r--r-- | kexi/kexidb/queryschema.cpp | 2 | ||||
-rw-r--r-- | kexi/kexiutils/utils.cpp | 5 | ||||
-rw-r--r-- | kexi/main/keximainwindowimpl.cpp | 9 | ||||
-rw-r--r-- | kexi/migration/keximigrate.cpp | 3 | ||||
-rw-r--r-- | kexi/migration/mysql/mysqlmigrate.cpp | 4 | ||||
-rw-r--r-- | kexi/migration/pqxx/pqxxmigrate.cpp | 10 | ||||
-rw-r--r-- | kexi/plugins/forms/kexidataprovider.cpp | 4 | ||||
-rw-r--r-- | kexi/plugins/queries/kexiquerydesignerguieditor.cpp | 8 | ||||
-rw-r--r-- | kexi/plugins/tables/kexitabledesignerview.cpp | 2 | ||||
-rw-r--r-- | kexi/widget/tableview/kexidataawarepropertyset.cpp | 2 | ||||
-rw-r--r-- | kexi/widget/utils/kexisharedactionclient.cpp | 2 |
20 files changed, 55 insertions, 40 deletions
diff --git a/kexi/core/kexidbconnectionset.cpp b/kexi/core/kexidbconnectionset.cpp index d76ed3f4..492e779d 100644 --- a/kexi/core/kexidbconnectionset.cpp +++ b/kexi/core/kexidbconnectionset.cpp @@ -30,7 +30,7 @@ class KexiDBConnectionSetPrivate { public: KexiDBConnectionSetPrivate() - : dataForFilenames(101) + : dataForFilenames(1009) { list.setAutoDelete(true); maxid=-1; diff --git a/kexi/formeditor/widgetlibrary.cpp b/kexi/formeditor/widgetlibrary.cpp index 55f8cde6..559b72ff 100644 --- a/kexi/formeditor/widgetlibrary.cpp +++ b/kexi/formeditor/widgetlibrary.cpp @@ -55,7 +55,7 @@ class WidgetLibraryPrivate { public: WidgetLibraryPrivate() - : widgets(101) + : widgets(1009) // , alternateWidgets(101) , services(101, false) , supportedFactoryGroups(17, false) diff --git a/kexi/kexidb/alter.cpp b/kexi/kexidb/alter.cpp index f4a1346f..8566d4df 100644 --- a/kexi/kexidb/alter.cpp +++ b/kexi/kexidb/alter.cpp @@ -223,7 +223,7 @@ TQString AlterTableHandler::ChangeFieldPropertyAction::debugString(const DebugOp static AlterTableHandler::ActionDict* createActionDict( AlterTableHandler::ActionDictDict &fieldActions, int forFieldUID ) { - AlterTableHandler::ActionDict* dict = new AlterTableHandler::ActionDict(101, false); + AlterTableHandler::ActionDict* dict = new AlterTableHandler::ActionDict(1009, false); dict->setAutoDelete(true); fieldActions.insert( forFieldUID, dict ); return dict; diff --git a/kexi/kexidb/connection.cpp b/kexi/kexidb/connection.cpp index 017e75e4..a5b962da 100644 --- a/kexi/kexidb/connection.cpp +++ b/kexi/kexidb/connection.cpp @@ -83,10 +83,10 @@ class ConnectionPrivate ConnectionPrivate(Connection* const conn, ConnectionData &conn_data) : conn(conn) , conn_data(&conn_data) - , tableSchemaChangeListeners(101) + , tableSchemaChangeListeners(1009) , m_parser(0) - , tables_byname(101, false) - , queries_byname(101, false) + , tables_byname(1009, false) + , queries_byname(1009, false) , kexiDBSystemTables(101) , dont_remove_transactions(false) , skip_databaseExists_check_in_useDatabase(false) @@ -104,8 +104,8 @@ class ConnectionPrivate queries_byname.setAutoDelete(false);//queries is owner, not me //reasonable sizes: TODO - tables.resize(101); - queries.resize(101); + tables.resize(1009); + queries.resize(1009); } ~ConnectionPrivate() { diff --git a/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp b/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp index afcad047..3b5de6f9 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp +++ b/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp @@ -237,12 +237,20 @@ TQVariant pqxxSqlCursor::pValue(uint pos)const { return (*m_res)[at()][pos].as(double()); } + else if (f->type() == Field::Boolean ) + { + return QString((*m_res)[at()][pos].c_str()).lower() == "t" ? QVariant(true, 1) : QVariant(false, 1); + } else if (f->typeGroup() == Field::BLOBGroup) { // pqxx::result::field r = (*m_res)[at()][pos]; // kdDebug() << r.name() << ", " << r.c_str() << ", " << r.type() << ", " << r.size() << endl; return ::pgsqlByteaToByteArray((*m_res)[at()][pos]); } + else + { + return pgsqlCStrToVariant((*m_res)[at()][pos]); + } } else // We probably have a raw type query so use pqxx to determin the column type { diff --git a/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp b/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp index 20d80f9c..fe6a78ea 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp @@ -324,19 +324,21 @@ void SQLiteCursor::drv_getNextRecord() } //debug -/* - if (m_result == FetchOK && d->curr_coldata) { +/* if (((int)m_result == (int)FetchOK) && d->curr_coldata) { for (uint i=0;i<m_fieldCount;i++) { KexiDBDrvDbg<<"col."<< i<<": "<< d->curr_colname[i]<<" "<< d->curr_colname[m_fieldCount+i] << " = " << (d->curr_coldata[i] ? TQString::fromLocal8Bit(d->curr_coldata[i]) : "(NULL)") <<endl; } -// KexiDBDrvDbg << "SQLiteCursor::drv_getNextRecord(): "<<m_fieldCount<<" col(s) fetched"<<endl; + KexiDBDrvDbg << "SQLiteCursor::drv_getNextRecord(): "<<m_fieldCount<<" col(s) fetched"<<endl; }*/ } void SQLiteCursor::drv_appendCurrentRecordToBuffer() { // KexiDBDrvDbg << "SQLiteCursor::drv_appendCurrentRecordToBuffer():" <<endl; + if (!d->curr_coldata) + return; + if (!d->cols_pointers_mem_size) d->cols_pointers_mem_size = m_fieldCount * sizeof(char*); const char **record = (const char**)malloc(d->cols_pointers_mem_size); diff --git a/kexi/kexidb/expression.cpp b/kexi/kexidb/expression.cpp index d9a33b4c..b60cd505 100644 --- a/kexi/kexidb/expression.cpp +++ b/kexi/kexidb/expression.cpp @@ -400,13 +400,9 @@ Field::Type BinaryExpr::type() if (ltInt && rtInt) return KexiDB::maximumForIntegerTypes(lt, rt); - if (Field::isFPNumericType(lt) && rtInt) + if (Field::isFPNumericType(lt) && (rtInt || lt==rt)) return lt; - if (Field::isFPNumericType(rt) && ltInt) - return rt; - if ((lt==Field::Double || lt==Field::Float) && rtInt) - return lt; - if ((rt==Field::Double || rt==Field::Float) && ltInt) + if (Field::isFPNumericType(rt) && (ltInt || lt==rt)) return rt; return Field::Boolean; diff --git a/kexi/kexidb/fieldlist.cpp b/kexi/kexidb/fieldlist.cpp index 292ba75e..7304ed37 100644 --- a/kexi/kexidb/fieldlist.cpp +++ b/kexi/kexidb/fieldlist.cpp @@ -28,7 +28,7 @@ using namespace KexiDB; FieldList::FieldList(bool owner) //reasonable sizes: TODO - : m_fields_by_name(101, false) + : m_fields_by_name(1009, false) { m_fields.setAutoDelete( owner ); m_fields_by_name.setAutoDelete( false ); diff --git a/kexi/kexidb/fieldvalidator.cpp b/kexi/kexidb/fieldvalidator.cpp index 57f8bd8d..3b08301c 100644 --- a/kexi/kexidb/fieldvalidator.cpp +++ b/kexi/kexidb/fieldvalidator.cpp @@ -36,7 +36,7 @@ FieldValidator::FieldValidator( const Field &field, TQWidget * parent, const cha if (field.isIntegerType()) { TQValidator *validator = 0; const bool u = field.isUnsigned(); - int bottom, top; + int bottom = 0, top = 0; if (t==Field::Byte) { bottom = u ? 0 : -0x80; top = u ? 0xff : 0x7f; diff --git a/kexi/kexidb/queryschema.cpp b/kexi/kexidb/queryschema.cpp index 47e5d95c..8c5f1a1f 100644 --- a/kexi/kexidb/queryschema.cpp +++ b/kexi/kexidb/queryschema.cpp @@ -1439,7 +1439,7 @@ void QuerySchema::computeFieldsExpanded() } //remove duplicates for lookup fields - TQDict<uint> lookup_dict(101); //used to fight duplicates and to update QueryColumnInfo::indexForVisibleLookupValue() + TQDict<uint> lookup_dict(1009); //used to fight duplicates and to update QueryColumnInfo::indexForVisibleLookupValue() // (a mapping from table.name string to uint* lookupFieldIndex lookup_dict.setAutoDelete(true); i=0; diff --git a/kexi/kexiutils/utils.cpp b/kexi/kexiutils/utils.cpp index dca4998b..125e4783 100644 --- a/kexi/kexiutils/utils.cpp +++ b/kexi/kexiutils/utils.cpp @@ -57,7 +57,7 @@ void DelayedCursorHandler::stop() { TQApplication::restoreOverrideCursor(); } void DelayedCursorHandler::show() { - TQApplication::setOverrideCursor( KCursor::waitCursor() ); + TQApplication::setOverrideCursor( KCursor::waitCursor(), true/*replace*/ ); } DelayedCursorHandler _delayedCursorHandler; @@ -89,7 +89,8 @@ WaitCursorRemover::WaitCursorRemover() WaitCursorRemover::~WaitCursorRemover() { - _delayedCursorHandler.start(true); + if (m_reactivateCursor) + _delayedCursorHandler.start(true); } //-------------------------------------------------------------------------------- diff --git a/kexi/main/keximainwindowimpl.cpp b/kexi/main/keximainwindowimpl.cpp index 5e39ab13..f6be589a 100644 --- a/kexi/main/keximainwindowimpl.cpp +++ b/kexi/main/keximainwindowimpl.cpp @@ -4203,8 +4203,10 @@ void KexiMainWindowImpl::slotToolsCompactDatabase() data = new KexiProjectData(*d->prj->data()); // a copy drv = d->prj->dbConnection()->driver(); const tristate res = closeProject(); - if (~res || !res) + if (~res || !res) { + delete data; return; + } } if (!drv->adminTools().vacuum(*data->connectionData(), data->databaseName())) { @@ -4212,10 +4214,9 @@ void KexiMainWindowImpl::slotToolsCompactDatabase() showErrorMessage( &drv->adminTools() ); } - if (data && projectWasOpened) { + if (projectWasOpened) openProject(*data); - delete data; - } + delete data; } tristate KexiMainWindowImpl::showProjectMigrationWizard( diff --git a/kexi/migration/keximigrate.cpp b/kexi/migration/keximigrate.cpp index 1c3295b6..5783d11c 100644 --- a/kexi/migration/keximigrate.cpp +++ b/kexi/migration/keximigrate.cpp @@ -491,7 +491,6 @@ void KexiMigrate::updateProgress(TQ_ULLONG step) { // Prompt the user to choose a field type KexiDB::Field::Type KexiMigrate::userType(const TQString& fname) { - KInputDialog *dlg; TQStringList types; TQString res; @@ -509,7 +508,7 @@ KexiDB::Field::Type KexiMigrate::userType(const TQString& fname) types << "Long Text"; types << "Binary Large Object"; - res = dlg->getItem( i18n("Field Type"), + res = KInputDialog::getItem( i18n("Field Type"), i18n("The data type for %1 could not be determined. " "Please select one of the following data " "types").arg(fname), diff --git a/kexi/migration/mysql/mysqlmigrate.cpp b/kexi/migration/mysql/mysqlmigrate.cpp index 78671241..1025f1f3 100644 --- a/kexi/migration/mysql/mysqlmigrate.cpp +++ b/kexi/migration/mysql/mysqlmigrate.cpp @@ -420,9 +420,9 @@ KexiDB::Field::Type MySQLMigrate::examineBlobField(const TQString& table, if(mysqlType.contains("blob", false) != 0) { // Doesn't matter how big it is, it's binary kexiType = KexiDB::Field::BLOB; - } else if(mysqlType.contains("text", false) != 0) { +/* } else if(mysqlType.contains("text", false) != 0) { // All the TEXT types are too big for Kexi text. - kexiType = KexiDB::Field::BLOB; + kexiType = KexiDB::Field::BLOB;*/ } else if(fld->length < 200) { kexiType = KexiDB::Field::Text; } else { diff --git a/kexi/migration/pqxx/pqxxmigrate.cpp b/kexi/migration/pqxx/pqxxmigrate.cpp index 904e0c92..2ca476d4 100644 --- a/kexi/migration/pqxx/pqxxmigrate.cpp +++ b/kexi/migration/pqxx/pqxxmigrate.cpp @@ -538,10 +538,18 @@ bool PqxxMigrate::drv_copyTable(const TQString& srcTable, KexiDB::Connection *de int index = 0; for ( i = R.begin(); i != end; ++i, index++) { if (fieldsExpanded.at(index)->field->type()==KexiDB::Field::BLOB || fieldsExpanded.at(index)->field->type()==KexiDB::Field::LongText) + { vals.append( KexiDB::pgsqlByteaToByteArray((*i).c_str(), (*i).size()) ); - else + } + else if (fieldsExpanded.at(index)->field->type()==KexiDB::Field::Boolean ) + { + vals.append(QString((*i).c_str()).lower() == "t" ? QVariant(true, 1) : QVariant(false, 1)); + } + else + { vals.append( KexiDB::cstringToVariant((*i).c_str(), fieldsExpanded.at(index)->field, (*i).size()) ); + } } if (!destConn->insertRecord(*dstTable, vals)) return false; diff --git a/kexi/plugins/forms/kexidataprovider.cpp b/kexi/plugins/forms/kexidataprovider.cpp index 1a6df899..35e51dc1 100644 --- a/kexi/plugins/forms/kexidataprovider.cpp +++ b/kexi/plugins/forms/kexidataprovider.cpp @@ -153,7 +153,7 @@ void KexiFormDataProvider::fillDuplicatedDataItems( count = it_dup.data(); tmpDuplicatedItems.insert( it.current()->columnInfo()->field, ++count ); } - m_duplicatedItems = new TQPtrDict<char>(101); + m_duplicatedItems = new TQPtrDict<char>(1009); for (it_dup = tmpDuplicatedItems.begin(); it_dup!=tmpDuplicatedItems.end(); ++it_dup) { if (it_dup.data() > 1) { m_duplicatedItems->insert( it_dup.key(), (char*)1 ); @@ -260,7 +260,7 @@ void KexiFormDataProvider::invalidateDataSources( const TQDict<char>& invalidSou // m_fieldNumbersForDataItems = newFieldNumbersForDataItems; //update data sources set (some of them may be removed) - TQDict<char> tmpUsedDataSources(1013); + TQDict<char> tmpUsedDataSources(1009); if (query) query->debug(); diff --git a/kexi/plugins/queries/kexiquerydesignerguieditor.cpp b/kexi/plugins/queries/kexiquerydesignerguieditor.cpp index 1b4a3301..9da1a92a 100644 --- a/kexi/plugins/queries/kexiquerydesignerguieditor.cpp +++ b/kexi/plugins/queries/kexiquerydesignerguieditor.cpp @@ -77,7 +77,7 @@ class KexiQueryDesignerGuiEditor::Private { public: Private() - : fieldColumnIdentifiers(101, false/*case insens.*/) + : fieldColumnIdentifiers(1009, false/*case insens.*/) { droppedNewItem = 0; slotTableAdded_enabled = true; @@ -809,7 +809,7 @@ void KexiQueryDesignerGuiEditor::showFieldsOrRelationsForQueryInternal( //2. Collect information about criterias // --this must be top level chain of AND's // --this will also show joins as: [table1.]field1 = [table2.]field2 - TQDict<KexiDB::BaseExpr> criterias(101, false); + TQDict<KexiDB::BaseExpr> criterias(1009, false); KexiDB::BaseExpr* e = query->whereExpression(); KexiDB::BaseExpr* eItem = 0; while (e) { @@ -877,7 +877,7 @@ void KexiQueryDesignerGuiEditor::showFieldsOrRelationsForQueryInternal( //3. show fields (including * and table.*) uint row_num = 0; KexiDB::Field *field; - TQPtrDict<char> usedCriterias(101); // <-- used criterias will be saved here + TQPtrDict<char> usedCriterias(1009); // <-- used criterias will be saved here // so in step 4. we will be able to add // remaining invisible columns with criterias for (KexiDB::Field::ListIterator it(*query->fields()); @@ -1270,7 +1270,7 @@ TQCString KexiQueryDesignerGuiEditor::generateUniqueAlias() const const TQCString expStr = i18n("short for 'expression' word (only latin letters, please)", "expr").latin1(); //TODO: optimization: cache it? - TQAsciiDict<char> aliases(101); + TQAsciiDict<char> aliases(1009); for (int r = 0; r<(int)d->sets->size(); r++) { KoProperty::Set *set = d->sets->at(r); if (set) { diff --git a/kexi/plugins/tables/kexitabledesignerview.cpp b/kexi/plugins/tables/kexitabledesignerview.cpp index ea337d36..6130a93f 100644 --- a/kexi/plugins/tables/kexitabledesignerview.cpp +++ b/kexi/plugins/tables/kexitabledesignerview.cpp @@ -1262,7 +1262,7 @@ tristate KexiTableDesignerView::buildSchema(KexiDB::TableSchema &schema, bool be KoProperty::Set *b = 0; bool no_fields = true; int i; - TQDict<char> names(101, false); + TQDict<char> names(1009, false); char dummy; for (i=0;i<(int)d->sets->size();i++) { b = d->sets->at(i); diff --git a/kexi/widget/tableview/kexidataawarepropertyset.cpp b/kexi/widget/tableview/kexidataawarepropertyset.cpp index 3b9fe3af..8b0fdff7 100644 --- a/kexi/widget/tableview/kexidataawarepropertyset.cpp +++ b/kexi/widget/tableview/kexidataawarepropertyset.cpp @@ -24,7 +24,7 @@ #include <koproperty/property.h> #include <kexiviewbase.h> -#define MAX_FIELDS 101 //nice prime number (default prop. set vector size) +#define MAX_FIELDS 1009 //nice prime number (default prop. set vector size) KexiDataAwarePropertySet::KexiDataAwarePropertySet(KexiViewBase *view, KexiDataAwareObjectInterface* dataObject) diff --git a/kexi/widget/utils/kexisharedactionclient.cpp b/kexi/widget/utils/kexisharedactionclient.cpp index 4dbd9299..7436b9f5 100644 --- a/kexi/widget/utils/kexisharedactionclient.cpp +++ b/kexi/widget/utils/kexisharedactionclient.cpp @@ -22,7 +22,7 @@ #include <kaction.h> KexiSharedActionClient::KexiSharedActionClient() - : m_sharedActions(101, false) + : m_sharedActions(1009, false) { } |