[성현모] TRA Extract
This commit is contained in:
6
CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/App.config
Normal file
6
CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/App.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
|
||||
</startup>
|
||||
</configuration>
|
||||
76
CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/DBService.cs
Normal file
76
CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/DBService.cs
Normal file
@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SystemX.Product.CP.TRA.Extract
|
||||
{
|
||||
|
||||
public class DBService
|
||||
{
|
||||
private string connectionString = "Server=192.168.0.69;Database=CPXV2ShortTermLogJson;User Id=Alis;Password=Kefico!@34;";
|
||||
|
||||
public void GetLargeData()
|
||||
{
|
||||
// 1. 연결 생성
|
||||
using (SqlConnection conn = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
// 2. 실행할 쿼리 작성 (JOIN 포함)
|
||||
string sql = @"SELECT [TestListFileNo]
|
||||
,[StepID]
|
||||
,[StepVersion]
|
||||
,[StepDesc]
|
||||
,[SpecMin]
|
||||
,[SpecMax]
|
||||
,[Dim]
|
||||
FROM [CPXV2].[dbo].[VRFY_TestListFileRelease] where StepDesc like 'an10_off' order by testlistfileno";
|
||||
|
||||
SqlCommand cmd = new SqlCommand(sql, conn);
|
||||
// 타임아웃 설정 (600만 건은 시간이 걸릴 수 있으므로 0(무제한) 또는 넉넉하게 설정)
|
||||
cmd.CommandTimeout = 300;
|
||||
conn.Open();
|
||||
|
||||
// 3. DataReader로 데이터 읽기
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
// 예: 데이터 처리 로직
|
||||
var val = Decompression(reader["LogData"].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
//sql = @"SELECT * FROM HIST_LogSummary_2025 as Summary with(nolock) JOIN HIST_TestResult_2025 as Result with(nolock) ON Summary.No = Result.No";
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
Console.WriteLine("DB 오류 발생: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string Decompression(string compressedDataStr)
|
||||
{
|
||||
string result = null;
|
||||
byte[] buffer = Convert.FromBase64String(compressedDataStr);
|
||||
using (MemoryStream stream = new MemoryStream(buffer))
|
||||
{
|
||||
using (GZipStream stream2 = new GZipStream(stream, CompressionMode.Decompress))
|
||||
{
|
||||
using (StreamReader streamReader = new StreamReader(stream2))
|
||||
{
|
||||
result = streamReader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/Program.cs
Normal file
17
CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SystemX.Product.CP.TRA.Extract
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
DBService dbS = new DBService();
|
||||
dbS.GetLargeData();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
|
||||
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이러한 특성 값을 변경하세요.
|
||||
[assembly: AssemblyTitle("SystemX.Product.CP.TRA.Extract")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SystemX.Product.CP.TRA.Extract")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2026")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("59074fb3-4828-42de-afb0-77b1cb629511")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{59074FB3-4828-42DE-AFB0-77B1CB629511}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>SystemX.Product.CP.TRA.Extract</RootNamespace>
|
||||
<AssemblyName>SystemX.Product.CP.TRA.Extract</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DBService.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user