@@ -507,6 +507,8 @@ bool QgsSpatiaLiteSourceSelect::getTableInfo( sqlite3 * handle )
507
507
{
508
508
for ( i = 1 ; i <= rows; i++ )
509
509
{
510
+ if ( isRasterlite1Datasource ( handle, results[( i * columns ) + 0 ] ) )
511
+ continue ;
510
512
QString tableName = QString::fromUtf8 ( results[( i * columns ) + 0 ] );
511
513
QString column = QString::fromUtf8 ( results[( i * columns ) + 1 ] );
512
514
QString type = results[( i * columns ) + 2 ];
@@ -698,6 +700,52 @@ bool QgsSpatiaLiteSourceSelect::checkVirtsGeometryColumns( sqlite3 * handle )
698
700
return exists;
699
701
}
700
702
703
+ bool QgsSpatiaLiteSourceSelect::isRasterlite1Datasource (sqlite3 * handle, const char *table)
704
+ {
705
+ // testing for RasterLite-1 datasources
706
+ int ret;
707
+ int i;
708
+ char **results;
709
+ int rows;
710
+ int columns;
711
+ bool exists = false ;
712
+ int len;
713
+ char table_raster[4192 ];
714
+ char sql[4192 ];
715
+
716
+ strcpy ( table_raster, table );
717
+ len = strlen ( table_raster );
718
+ if (strlen ( table_raster ) < 9 )
719
+ return false ;
720
+ if (strcmp ( table_raster + len - 9 , " _metadata" ) != 0 )
721
+ return false ;
722
+ // ok, possible candidate
723
+ strcpy ( table_raster + len - 9 , " _rasters" );
724
+
725
+ // checking if the related "_RASTERS table exists
726
+ sprintf ( sql, " SELECT name FROM sqlite_master WHERE type = 'table' AND name = '%s'" , table_raster );
727
+
728
+ ret = sqlite3_get_table ( handle, sql, &results, &rows, &columns, NULL );
729
+ if ( ret != SQLITE_OK )
730
+ return false ;
731
+ if ( rows < 1 )
732
+ ;
733
+ else
734
+ {
735
+ for ( i = 1 ; i <= rows; i++ )
736
+ {
737
+ if ( results[( i * columns ) + 0 ] != NULL )
738
+ {
739
+ const char *name = results[( i * columns ) + 0 ];
740
+ if ( name )
741
+ exists = true ;
742
+ }
743
+ }
744
+ }
745
+ sqlite3_free_table ( results );
746
+ return exists;
747
+ }
748
+
701
749
bool QgsSpatiaLiteSourceSelect::isDeclaredHidden ( sqlite3 * handle, QString table, QString geom )
702
750
{
703
751
int ret;
0 commit comments