Exemplo n.º 1
0
        /// <summary>
        /// Обновляет полный текст новости в БД. Новость отмечается как обработанная.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="fullText"></param>
        public static void UpdateNewspaperFullText(Int32 id, String fullText)
        {
            SQLiteConnection connection = DatabaseConnectionHandler.InvokeMultiple();
            String           sql        = $"update {TableNames.NewspaperFullText} set " +
                                          $"s_text='{fullText}', i_is_parsed=1 where id={id}";

            connection.Execute(sql);

            //DatabaseConnectionHandler.SafeExecute(sql, connection);
        }
Exemplo n.º 2
0
        public static void SaveImage(ImageDB image)
        {
            SQLiteConnection connection = DatabaseConnectionHandler.InvokeMultiple();

            string sql = $"insert into {TableNames.NetworkAddress} (s_url) values ('{image.s_url}')";

            connection.Execute(sql);

            int networkId = connection.QueryFirst <int>(
                $"select id from {TableNames.NetworkAddress} where s_url='{image.s_url}'");

            connection.Execute($"insert into {TableNames.LocalFileAddress} " +
                               $"(s_path) values ('{image.s_path}')");

            int localId = connection.QueryFirst <int>(
                $"select id from {TableNames.LocalFileAddress} where s_path='{image.s_path}'");

            connection.Execute($"insert into {TableNames.Images} (i_newspaper_id, " +
                               $"i_local_address_id, i_network_address_id) values " +
                               $"({image.i_newspaper_id}, {localId}, {networkId})");
        }