private Task <bool> NextResultAsyncCore(CancellationToken cancellationToken) { VerifyNotDisposed(); Reset(); m_currentStatementIndex++; m_currentStatement = m_statementPreparer.Get(m_currentStatementIndex, cancellationToken); if (m_currentStatement == null) { return(s_falseTask); } bool success = false; try { for (int i = 0; i < m_command.Parameters.Count; i++) { SQLiteParameter parameter = m_command.Parameters[i]; string parameterName = parameter.ParameterName; int index; if (parameterName != null) { if (parameterName[0] != '@') { parameterName = "@" + parameterName; } index = NativeMethods.sqlite3_bind_parameter_index(m_currentStatement, SQLiteConnection.ToNullTerminatedUtf8(parameterName)); } else { index = i + 1; } if (index > 0) { object value = parameter.Value; if (value == null || value.Equals(DBNull.Value)) { ThrowOnError(NativeMethods.sqlite3_bind_null(m_currentStatement, index)); } else if (value is int || (value is Enum && Enum.GetUnderlyingType(value.GetType()) == typeof(int))) { ThrowOnError(NativeMethods.sqlite3_bind_int(m_currentStatement, index, (int)value)); } else if (value is bool) { ThrowOnError(NativeMethods.sqlite3_bind_int(m_currentStatement, index, ((bool)value) ? 1 : 0)); } else if (value is string) { BindText(index, (string)value); } else if (value is byte[]) { BindBlob(index, (byte[])value); } else if (value is long) { ThrowOnError(NativeMethods.sqlite3_bind_int64(m_currentStatement, index, (long)value)); } else if (value is float) { ThrowOnError(NativeMethods.sqlite3_bind_double(m_currentStatement, index, (float)value)); } else if (value is double) { ThrowOnError(NativeMethods.sqlite3_bind_double(m_currentStatement, index, (double)value)); } else if (value is DateTime) { BindText(index, ToString((DateTime)value)); } else if (value is Guid) { BindBlob(index, ((Guid)value).ToByteArray()); } else if (value is byte) { ThrowOnError(NativeMethods.sqlite3_bind_int(m_currentStatement, index, (byte)value)); } else if (value is short) { ThrowOnError(NativeMethods.sqlite3_bind_int(m_currentStatement, index, (short)value)); } else { BindText(index, Convert.ToString(value, CultureInfo.InvariantCulture)); } } } success = true; } finally { if (!success) { ThrowOnError(NativeMethods.sqlite3_reset(m_currentStatement)); } } return(s_trueTask); }