/// <summary> /// Helper to retrieve data. /// </summary> /// <param name="statement"></param> /// <param name="position"></param> /// <returns></returns> private object GetObject(SQLiteStatement statement, int position) { try { return(statement.GetText(position)); } catch (Exception e) { } try { return(statement.GetInteger(position)); } catch (Exception e) { } try { return(statement.GetFloat(position)); } catch (Exception e) { } return(null); }
private object GetObject(SQLiteStatement statement, int position) { if (statement[position] == null) { return(null); } if (statement[position].GetType().Name == "String") { return(statement.GetText(position)); } if (intTypes.Contains(statement[position].GetType().Name)) { return(statement.GetInteger(position)); } // //fallback try to detect type using exceptions // try { return(statement.GetText(position)); } catch (Exception e) { PlatformAdapter.SendToCustomLogger(e, LoggingLevel.Error); } try { return(statement.GetInteger(position)); } catch (Exception e) { PlatformAdapter.SendToCustomLogger(e, LoggingLevel.Error); } try { return(statement.GetFloat(position)); } catch (Exception e) { PlatformAdapter.SendToCustomLogger(e, LoggingLevel.Error); } return(null); }