Пример #1
0
        public byte[] ReadData(UInt64 PESEL, DataReader.DataType dataType, uint offset = 0)
        {
            string typeString = ((byte)dataType).ToString();

            string query = "SELECT d.data_blob FROM data d JOIN session s ON s.session_id = d.session_id WHERE d.start_date = (SELECT start_date FROM data WHERE data_type = " + typeString + " ORDER BY start_date DESC LIMIT 1 OFFSET "+offset+")";

            defaultLog.Write("Executing query: " + query);

            MySqlCommand cmd = new MySqlCommand(query, connection);

            MySqlDataReader data = cmd.ExecuteReader();

            byte[] outData = new byte[0];

            while (data.Read())
            {
                outData = (byte[])data["data_blob"];
            }

            data.Close();

            defaultLog.Write("...finished: ");
            return outData;
        }
Пример #2
0
        public byte[] ReadHistory(UInt64 PESEL, DataReader.DataType type)
        {
            byte[] outHistory = new byte[0];

            string typeString = ((byte)type).ToString();
            string query = "SELECT d.data_blob FROM data d JOIN session s ON s.session_id = d.session_id WHERE data_type = " + typeString +" ORDER BY start_date ASC";
            defaultLog.Write("Executing query: " + query);
            MySqlCommand cmd = new MySqlCommand(query, connection);
            MySqlDataReader data = cmd.ExecuteReader();

            while (data.Read())
            {
                outHistory.Concat( (byte[])data["data_blob"] );
            }

            data.Close();

            return outHistory;
        }