Skip to content
Permalink
Browse files

Merge branch 'master' of https://github.com/qgis/Quantum-GIS

  • Loading branch information
Sergey Yakushev
Sergey Yakushev committed Jan 15, 2012
2 parents aa323ae + a6df30c commit c56d02fb66299cfd7cdb102e72ce91ce3464db69
@@ -737,6 +737,7 @@ void QgsRasterLayerProperties::sync()
cboRed->setCurrentIndex( cboRed->findText( mRasterLayer->redBandName() ) );
cboGreen->setCurrentIndex( cboGreen->findText( mRasterLayer->greenBandName() ) );
cboBlue->setCurrentIndex( cboBlue->findText( mRasterLayer->blueBandName() ) );
cboGray->setCurrentIndex( cboGray->findText( mRasterLayer->grayBandName() ) );

//Display the current default contrast enhancement algorithm
mDefaultContrastEnhancementAlgorithm = myQSettings.value( "/Raster/defaultContrastEnhancementAlgorithm", "NoEnhancement" ).toString();
@@ -64,9 +64,9 @@ bool QgsAttributeTableModel::featureAtId( QgsFeatureId fid ) const
else if ( mLayer->featureAtId( fid, mFeat, false, true ) )
{
QSettings settings;
int cacheSize = settings.value( "/qgis/attributeTableRowCache", "10000" ).toInt();
int cacheSize = qMax( 1, settings.value( "/qgis/attributeTableRowCache", "10000" ).toInt() );

if ( mFeatureQueue.size() == cacheSize )
while ( mFeatureQueue.size() >= cacheSize )
{
mFeatureMap.remove( mFeatureQueue.dequeue() );
}
@@ -443,7 +443,7 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
return;
}
enabledCapabilities = QgsVectorDataProvider::SelectAtId | QgsVectorDataProvider::SelectGeometryAtId;
if ( mTableBased && !mReadOnly )
if (( mTableBased | mViewBased ) && !mReadOnly )
{
// enabling editing only for Tables [excluding Views and VirtualShapes]
enabledCapabilities |= QgsVectorDataProvider::DeleteFeatures;
@@ -650,6 +650,23 @@ void QgsSpatiaLiteProvider::loadFields()
}
}

bool QgsSpatiaLiteProvider::hasTriggers()
{
int ret;
char **results;
int rows;
int columns;
char *errMsg = NULL;
QString sql;

sql = QString( "SELECT * FROM sqlite_master WHERE type='trigger' AND tbl_name=%1" )
.arg( quotedIdentifier( mTableName ) );

ret = sqlite3_get_table( sqliteHandle, sql.toUtf8().constData(), &results, &rows, &columns, &errMsg );
sqlite3_free_table( results );
return ( ret == SQLITE_OK && rows > 0 );
}


QString QgsSpatiaLiteProvider::storageType() const
{
@@ -4217,7 +4234,7 @@ bool QgsSpatiaLiteProvider::checkLayerType()
else if ( type == "view" )
{
mViewBased = true;
mReadOnly = true;
mReadOnly = !hasTriggers();
}
count++;
}
@@ -4321,7 +4338,7 @@ bool QgsSpatiaLiteProvider::checkLayerType()
if ( ret == SQLITE_OK && rows == 1 )
{
mViewBased = true;
mReadOnly = true;
mReadOnly = !hasTriggers();
count++;
}
if ( errMsg )
@@ -276,6 +276,9 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
/** loads fields from input file to member attributeFields */
void loadFields();

/** Check if a table/view has any triggers. Triggers can be used on views to make them editable.*/
bool hasTriggers();

/** convert a QgsField to work with SL */
static bool convertField( QgsField &field );

@@ -464,6 +464,9 @@
</item>
<item>
<widget class="QSpinBox" name="spinBoxAttrTableRowCache">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000</number>
</property>

0 comments on commit c56d02f

Please sign in to comment.
You can’t perform that action at this time.