Apply a number of kexi patches

This closes Bug 777
pull/1/head
Timothy Pearson 12 years ago
parent 5ec453c258
commit c91e96258b

@ -30,7 +30,7 @@ class KexiDBConnectionSetPrivate
{
public:
KexiDBConnectionSetPrivate()
: dataForFilenames(101)
: dataForFilenames(1009)
{
list.setAutoDelete(true);
maxid=-1;

@ -55,7 +55,7 @@ class WidgetLibraryPrivate
{
public:
WidgetLibraryPrivate()
: widgets(101)
: widgets(1009)
// , alternateWidgets(101)
, services(101, false)
, supportedFactoryGroups(17, false)

@ -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;

@ -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()
{

@ -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
{

@ -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);

@ -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;

@ -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 );

@ -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;

@ -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;

@ -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);
}
//--------------------------------------------------------------------------------

@ -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(

@ -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),

@ -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 {

@ -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;

@ -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();

@ -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) {

@ -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);

@ -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)

@ -22,7 +22,7 @@
#include <kaction.h>
KexiSharedActionClient::KexiSharedActionClient()
: m_sharedActions(101, false)
: m_sharedActions(1009, false)
{
}

Loading…
Cancel
Save