Select to view content in your preferred language

Detecting the presence of an attribute index on a runtime geodatabase class

450
1
02-21-2017 05:38 AM
EdwardBlair
Regular Contributor

Am working with a (SQLite) runtime Geodatabase with an app that relies on the presence of several attribute indexes to provide good performance.  Is there a way in the ArcGIS runtime .net SDK to detect the presence of an index so I can take some action if its not there?

Thanks,

Ed

0 Kudos
1 Reply
EdwardBlair
Regular Contributor

Found my solution.  Just added System.Data.SQLite to my project and performed a query directly to the SQLite database to get the indexes present.

Ed

string dataSource = @"c:\MyDatabase.geodatabase";

SQLiteConnection sqlCon = new SQLiteConnection("Data Source=" + dataSource + ";Version=3;");

sqlCon.Open();

string sqlQuery = "Select sql FROM SQLite_master WHERE type = 'index' AND tbl_name = 'MYTABLE'";

SQLiteCommand sqlCmd = new SQLiteCommand(sqlQuery, sqlCon);

SQLiteDataReader sqlRead = sqlCmd.ExecuteReader();

string result = "";

while (sqlRead.Read())

{

result += sqlRead[0].ToString() + Environment.NewLine;

}

0 Kudos