/// <summary> /// Get the IPList for the specified account /// </summary> /// <param name="accID">The account dir</param> /// <returns>DataSet containing IP records</returns> public void GetIPListByAccDir(DamDataSet.IPListDataTable dsTable, string accDir) { SQLiteDataAdapter adpt = new SQLiteDataAdapter("SELECT * FROM IPList WHERE AccDir ='" + accDir + "' ORDER BY AccessTime DESC, IP", GetConnection()); dsTable.Clear(); adpt.Fill(dsTable); }
/// <summary> /// Get the IPList for the specified IP and fragment of IP. /// </summary> /// <param name="accID">The IPs to search for.</param> /// <returns>DataSet containing IP records</returns> public void GetIPListByIP(DamDataSet.IPListDataTable dsTable, string ipFrag) { dsTable.Clear(); string query = "SELECT * FROM IPList WHERE IP LIKE '" + SafeSqlLiteral(ipFrag) + "%'"; SQLiteDataAdapter adpt = new SQLiteDataAdapter(query, GetConnection()); adpt.Fill(dsTable); }
/// <summary> /// Get the IPList for the specified array of IP addresses /// </summary> /// <param name="accID">The IPs to search for.</param> /// <returns>DataSet containing IP records</returns> public void GetIPListByIP(DamDataSet.IPListDataTable dsTable, string[] IPs) { dsTable.Clear(); if (IPs.Length == 0) { return; } string query = "SELECT * FROM IPList WHERE"; for (int i = 0; i < IPs.Length; i++) { if (i != 0) { query += " OR"; } query += " IP = '" + IPs[i] + "'"; } SQLiteDataAdapter adpt = new SQLiteDataAdapter(query, GetConnection()); adpt.Fill(dsTable); }