SQLite는 MySQL나 PostgreSQL와 같은 데이터베이스 관리 시스템이지만, 서버가 아니라 응용 프로그램에 넣어 사용하는 비교적 가벼운 데이터베이스이다. 
일반적인 RDBMS에 비해 대규모 작업에는 적합하지 않지만, 중소 규모라면 속도에 손색이 없다. 또 API는 단순히 라이브러리를 호출하는 것만 있으며, 데이터를 저장하는 데 하나의 파일만을 사용하는 것이 특징이다. 버전 3.3.8에서는 풀텍스트 검색 기능을 가진 FTS1 모듈이 지원된다. 컬럼을 삭제하거나 변경하는 것 등이 제한된다.
구글 안드로이드 운영 체제에 기본 탑재된 데이터베이스이기도 하다.

RDBMS( oracle, mssql, sysbase, mysql, mariadb 등)와 동일하게 ansi sql을 사용할 수 있다.
다른 RDBMS와의 가장 큰 차이점은 아래와 같다.
데이터베이스별로 파일1개로 구성된다.
로컬에 파일로 저장하므로 원격접속이 안된다. 
( 웹서버와 DB서버를 별도로 구성 X, 다른 대안은 찾아보면 있다. 다른아이피의 PC를 마운트 해서 사용한다던가..등)
접속아이디나 패스워드가 없다.
다중 접속이 많아질 경우 예기치 않은 문제가 발생할 수 있다.
구글 안드로이드 운영 체제에 기본 탑재되어 있어 앱을 만들어본 경험이 있다면, 누구나 한번쯤은 사용해보고 들어봤을 것이다.
윈도우PC에서도 설치하여 사용할 수 있으며, 간단한 웹페이지를 구현할때도 별도의 설치과정이 없이 실행파일만 있으면 바로 사용할 수 있다.


1. SQLite 다운로드
http://www.sqlite.org/download.html 에 접속하여 sqllite-tools-win32-3340000.zip 파일을 다운로드 받는다.

2. 압축해제 후 sqlite3.exe 실행
적당한 곳(ex. C:\SQLite)에 압축을 푼 다음 sqlite.exe파일을 실행한다.
간혹 아래와 같이 Windows의 PC 보호라고 알림 창이 뜰 경우 "추가 정보"를 클릭 후 나타나는 "실행" 버튼을 클릭하면 된다.

3. sqlite 명령프롬프트
실행하면 윈도우 명령 프롬프트가 실행되면서 sqlite 상태로 들어간다.

5. 데이터베이스 생성
실행했으니 데이터베이스를 하나 만들고 테이블도 하나 만들어서 값을 입력하고 결과를 조회해보자

데이터베이스를 만드는 법은 2가지가 있는데, 명령 프롬프트에서 sqlite3를 실행하면서 만드는 방법과 sqlite3 안에 들어가서 만드는 방법이 있다.
방법1. sqlite3 실행과 동시에 만들기

6. 생성된 데이터베이스에 테이블 만들기
일반적인 DDL 문법으로 TEST_TABLE 이라는 테이블을 만들고 .table 명령으로 테이블 목록을 조회

7. 생성된 테이블에 데이터 넣고 조회 해보기

8. GUI 툴을 사용하여 편하게 입력한다.
  sqlitebrowser.org/dl/


개인작업내용)
SQLite를 사용하여 C#에서 테이블을 생성하고 데이터를 입력 및 조회하는 예제를 아래에 제공하겠습니다. 이 예제에서는 System.Data.SQLite를 사용합니다.

먼저, NuGet 패키지 관리자를 통해 System.Data.SQLite 패키지를 설치해야 합니다.
먼저, NuGet 패키지 관리자를 통해 System.Data.SQLite 패키지를 설치해야 합니다.

BUILD & ALL
$ find ./ -name "*Interop*.dll"
./frm/WinFrmTicker/packages/Microsoft.Office.Interop.Excel.15.0.4795.1001/lib/net20/Microsoft.Office.Interop.Excel.dll
./frm/WinFrmTicker/packages/Microsoft.Office.Interop.Excel.15.0.4795.1001/lib/netstandard2.0/Microsoft.Office.Interop.Excel.dll
./frm/WinFrmTicker/packages/MSOffice.Interop.16.0.55555/lib/Microsoft.Office.Interop.Access.Dao.dll
./frm/WinFrmTicker/packages/MSOffice.Interop.16.0.55555/lib/Microsoft.Office.Interop.Access.dll
./frm/WinFrmTicker/packages/MSOffice.Interop.16.0.55555/lib/Microsoft.Office.Interop.Excel.dll
./frm/WinFrmTicker/packages/MSOffice.Interop.16.0.55555/lib/Microsoft.Office.Interop.Visio.WorkflowAuthoring.dll
./frm/WinFrmTicker/WinFrmTicker/bin/Debug/Microsoft.Office.Interop.Visio.WorkflowAuthoring.dll
./frm/WinFrmTicker/WinFrmTicker/bin/Release/Microsoft.Office.Interop.Visio.WorkflowAuthoring.dll
./mdifrm/packages/Stub.Systehttp://m.Data.SQLite.Core.NetFramework.1.0.118.0/build/net20/x64/SQLite.Interop.dll
./mdifrm/packages/Stub.Systehttp://m.Data.SQLite.Core.NetFramework.1.0.118.0/build/net20/x86/SQLite.Interop.dll

dotnet40에서, 64비트)
dotnet40에서, 64비트)

./mdifrm/packages/Stub.Systehttp://m.Data.SQLite.Core.NetFramework.1.0.118.0/build/net40/x64/SQLite.Interop.dll

./mdifrm/packages/Stub.Systehttp://m.Data.SQLite.Core.NetFramework.1.0.118.0/build/net40/x86/SQLite.Interop.dll

dotnet45에서 , 64비트)
dotnet45에서 , 64비트)

./mdifrm/packages/Stub.Systehttp://m.Data.SQLite.Core.NetFramework.1.0.118.0/build/net45/x64/SQLite.Interop.dll



./mdifrm/packages/Stub.Systehttp://m.Data.SQLite.Core.NetFramework.1.0.118.0/build/net45/x86/SQLite.Interop.dll
./mdifrm/packages/Stub.Systehttp://m.Data.SQLite.Core.NetFramework.1.0.118.0/build/net451/x64/SQLite.Interop.dll
./mdifrm/packages/Stub.Systehttp://m.Data.SQLite.Core.NetFramework.1.0.118.0/build/net451/x86/SQLite.Interop.dll
./mdifrm/packages/Stub.Systehttp://m.Data.SQLite.Core.NetFramework.1.0.118.0/build/net46/x64/SQLite.Interop.dll
./mdifrm/packages/Stub.Systehttp://m.Data.SQLite.Core.NetFramework.1.0.118.0/build/net46/x86/SQLite.Interop.dll
./mdifrm/WINCalcMdi/bin/Release/x64/SQLite.Interop.dll
./mdifrm/WINCalcMdi/bin/Release/x86/SQLite.Interop.dll



1. SQLite 데이터베이스 및 테이블 생성

using System;
using Systehttp://m.Data.SQLite;

class Program
{
    static void Main()
    {
        string connectionString = "Data Source=sample.db;Version=3;";

        using (SQLiteConnection connection = new SQLiteConnection(connectionString))
        {
            connection.Open();

            string createTableQuery = @"
                CREATE TABLE IF NOT EXISTS users (
                    id INTEGER PRIMARY KEY AUTOINCREMENT,
                    name TEXT NOT NULL,
                    age INTEGER NOT NULL
                )";

            using (SQLiteCommand command = new SQLiteCommand(createTableQuery, connection))
            {
                command.ExecuteNonQuery();
            }

            connection.Close();
        }

        Console.WriteLine("Table created successfully.");
    }
}

2. 데이터 입력

using System;
using Systehttp://m.Data.SQLite;

class Program
{
    static void Main()
    {
        string connectionString = "Data Source=sample.db;Version=3;";

        using (SQLiteConnection connection = new SQLiteConnection(connectionString))
        {
            connection.Open();

            string insertQuery = "INSERT INTO users (name, age) VALUES (@name, @age)";

            using (SQLiteCommand command = new SQLiteCommand(insertQuery, connection))
            {
                command.Parameters.AddWithValue("@name", "Alice");
                command.Parameters.AddWithValue("@age", 30);
                command.ExecuteNonQuery();
            }

            connection.Close();
        }

        Console.WriteLine("Data inserted successfully.");
    }
}

3. 데이터 조회

using System;
using Systehttp://m.Data.SQLite;

class Program
{
    static void Main()
    {
        string connectionString = "Data Source=sample.db;Version=3;";

        using (SQLiteConnection connection = new SQLiteConnection(connectionString))
        {
            connection.Open();

            string selectQuery = "SELECT * FROM users";

            using (SQLiteCommand command = new SQLiteCommand(selectQuery, connection))
            {
                using (SQLiteDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Console.WriteLine("ID: " + reader["id"]);
                        Console.WriteLine("Name: " + reader["name"]);
                        Console.WriteLine("Age: " + reader["age"]);
                        Console.WriteLine();
                    }
                }
            }

            connection.Close();
        }
    }
}

전체 코드 예제

using System;
using Systehttp://m.Data.SQLite;

class Program
{
    static void Main()
    {
        string connectionString = "Data Source=sample.db;Version=3;";

        // 테이블 생성
        using (SQLiteConnection connection = new SQLiteConnection(connectionString))
        {
            connection.Open();

            string createTableQuery = @"
                CREATE TABLE IF NOT EXISTS users (
                    id INTEGER PRIMARY KEY AUTOINCREMENT,
                    name TEXT NOT NULL,
                    age INTEGER NOT NULL
                )";

            using (SQLiteCommand command = new SQLiteCommand(createTableQuery, connection))
            {
                command.ExecuteNonQuery();
            }

            connection.Close();
        }

        Console.WriteLine("Table created successfully.");

        // 데이터 입력
        using (SQLiteConnection connection = new SQLiteConnection(connectionString))
        {
            connection.Open();

            string insertQuery = "INSERT INTO users (name, age) VALUES (@name, @age)";

            using (SQLiteCommand command = new SQLiteCommand(insertQuery, connection))
            {
                command.Parameters.AddWithValue("@name", "Alice");
                command.Parameters.AddWithValue("@age", 30);
                command.ExecuteNonQuery();
            }

            connection.Close();
        }

        Console.WriteLine("Data inserted successfully.");

        // 데이터 조회
        using (SQLiteConnection connection = new SQLiteConnection(connectionString))
        {
            connection.Open();

            string selectQuery = "SELECT * FROM users";

            using (SQLiteCommand command = new SQLiteCommand(selectQuery, connection))
            {
                using (SQLiteDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Console.WriteLine("ID: " + reader["id"]);
                        Console.WriteLine("Name: " + reader["name"]);
                        Console.WriteLine("Age: " + reader["age"]);
                        Console.WriteLine();
                    }
                }
            }

            connection.Close();
        }
    }
}

이 코드는 SQLite 데이터베이스를 생성하고, 테이블을 생성한 후, 데이터를 입력하고 조회하는 예제입니다. SQLite 데이터베이스 파일(sample.db)이 실행 디렉토리에 생성됩니다.


(정보분배)TCP로 받은 증권데이타를 파싱해서 DataGridView에 표시해봅니다.



1. SDI 방식
2. MDI 방식

1. 데이타의 정합성체크(소수점등)에 활용될수 있다.
2. *.db 파일에 저장되므로, 메모리의 크기에 대한 걱정을 안해도 된다.(무한정 데이타룰 수신가능)


접속표준서(정보분배-UDP_TCP실시간)에 정의되어진 콤마가 있는항목을 따로 표시해 봅니다.
누적거래량은 콤마3으로 표시되어지므로, ".000" 부분을 잘라서 사용해야 합니다.
"."까지 포함되어졌으므로, 4자리를 잘라서 사용해야 할것 같습니다.(주의할점)

 

TCP로 받은 호가데이타를 파싱해서 DataGridView에 표시해봅니다.

통합본)

 

 

c#/windows.pre.foundation/원리금균등상환.금리비교시.대출상환포함
c#/windows.pre.foundation/원리금균등상환.금리비교시.대출상환포함

Install Win.Form)



FiancialNM.msi
2.05MB


Install Win.Pre.Foundation)

FiancialCalc.msi
1.38MB



0. 메모장에서 코딩후 빌드 & 런

1. Win Form과 Win Presentaion Foundation과의 비교화면)

 

 


2. 대출상환정보가 없을경우)

3. 대출상환정보가 있을경우)

 

4. 대출상환정보가 있을경우>데이타선택시에, 해당월 일별 데이타 리스트출력

1. 기존 Windows Form방식)
- 기존 Form방식에서 사용되어진 Form 화면디자인을 WPF방식에는 이용할수 없다는점이 아쉽다.
- Form과 WPF를 동시에 코딩을 원한다면, 화면과 로직을 분리하는 설계를 잘해야한다.
- 즉 Form Class에 로직코드에 해당되는 부분은 클래스파일을 따로 만들어서 작성하도록 한다.

2. Windows.Presentation.Foundation(WPF) 방식
- 디자인파트
- 코드파트로 나눌수 있다는점에서 웹프로그래밍과 일맥상통하다.(xaml/cs)

FiancialCalc.msi
0.71MB


<Window x:Class="WINPAYCalcM.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WINPAYCalcM"
        mc:Ignorable="d"
        Title="원리금균등상환계산기(대출상환포함)" Height="1000" Width="1400"
KeyDown="Window_KeyDown">
    <Window.Resources>
        <Style TargetType="DataGrid">
            <Setter Property="ColumnHeaderHeight" Value="40"/>
            <Setter Property="RowHeight" Value="30"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="HorizontalGridLinesBrush" Value="LightGray"/>
            <Setter Property="VerticalGridLinesBrush" Value="LightGray"/>
            <Setter Property="AlternatingRowBackground" Value="LightCyan"/>
            <Setter Property="Background" Value="White"/>
        </Style>
        <Style TargetType="DataGridColumnHeader">
            <Setter Property="Background" Value="SlateGray"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
        </Style>
        <Style TargetType="DataGridRow">
            <EventSetter Event="MouseEnter" Handler="DataGridRow_MouseEnter"/>
            <EventSetter Event="MouseLeave" Handler="DataGridRow_MouseLeave"/>
            <Setter Property="Background" Value="White"/>
        </Style>
    </Window.Resources>
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_Information">
                <MenuItem Header="기초정보입력" Click="BasicInfoMenuItem_Click"/>
                <MenuItem Header="상환정보입력(자동)" Click="RepayMenuItem_Click"/>
                <MenuItem Header="상환정보입력(수동)" Click="RepayManualMenuItem_Click"/>
                <Separator/>
                <MenuItem Header="_Exit" Click="ExitMenuItem_Click"/>
            </MenuItem>
            <MenuItem Header="_File">
                <MenuItem Header="_Save" Click="SaveFileMenuItem_Click"/>
                <MenuItem Header="_Open" Click="OpenFileMenuItem_Click"/>
            </MenuItem>
            <MenuItem Header="_Help">
                <MenuItem Header="_About" Click="AboutMenuItem_Click"/>
            </MenuItem>
        </Menu>
        <!-- 다른 컨텐츠 -->
        <Grid>
            <DataGrid x:Name="dataGrid" AutoGenerateColumns="False" IsReadOnly="False" CanUserAddRows="True"
                  CanUserDeleteRows="True" CanUserResizeColumns="True" CanUserSortColumns="True" Margin="10">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="번호" Binding="{Binding index}" Width="*"/>
                    <DataGridTextColumn Header="상환방법" Binding="{Binding repaymethod}" Width="*"/>
                    <DataGridTextColumn Header="날짜" Binding="{Binding date}" Width="*"/>
                    <DataGridTextColumn Header="이자금액" Binding="{Binding rate_real_to_bank}" Width="*"/>
                    <DataGridTextColumn Header="원금금액" Binding="{Binding reapy_real_to_bank}" Width="*"/>
                    <DataGridTextColumn Header="이자상환합계" Binding="{Binding rate_real_to_bank_sum}" Width="*"/>
                    <DataGridTextColumn Header="현재원금" Binding="{Binding remain_original_pay}" Width="*"/>
    <DataGridTextColumn Header="원리금균등상환금액(일정)" Binding="{Binding original_rent_pay}" Width="*"/>
                    <DataGridTextColumn Header="이자+원금합계" Binding="{Binding calc_pricipal_plus_interest_sum}" Width="*"/>
                    <DataGridTextColumn Header="상환금액합계(원금+매달일정상환)" Binding="{Binding remain_repay_except_interest_sum}" Width="*"/>
                </DataGrid.Columns>

            </DataGrid>
        </Grid>
    </DockPanel>
</Window>


//11.txt
//{"param":{"loginid":"admin","pwd":"admin123"},"proto":"r","sender":"/cli/admin/10.1.181.79/25216","id":"login_client.0000919860.001","ts":"1713428639","method":"login_client"}

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

class Program
{
    public static void Main(string[] args)
    {
        if (args.Length == 1)
        {
            CHKNM nmm = new CHKNM();
            nmm.RUN(args[0]);
        }
        else
        {
            CHKNM nmm = new CHKNM();
            nmm.RUN();
        }
    }
}
class CHKNM
{
    public void RUN(string fileText)
    {
        string lines = File.ReadAllText(fileText);

        Console.WriteLine(lines);

        byte[] bytes = Encoding.UTF8.GetBytes(lines);
        PrintByteArray(bytes);
    }
    public void RUN()
    {
        byte[] buffer = new byte[] { 123, 34, 112, 97, 114, 97, 109, 34, 58, 123, 34, 108, 111, 103, 105, 110, 105, 100, 34, 58, 34, 97, 100, 109, 105, 110, 34, 44, 34, 112, 119, 100, 34, 58, 34, 97, 100, 109, 105, 110, 49, 50, 51, 34, 125, 44, 34, 112, 114, 111, 116, 111, 34, 58, 34, 114, 34, 44, 34, 115, 101, 110, 100, 101, 114, 34, 58, 34, 47, 99, 108, 105, 47, 97, 100, 109, 105, 110, 47, 49, 48, 46, 49, 46, 49, 56, 49, 46, 55, 57, 47, 50, 53, 50, 49, 54, 34, 44, 34, 105, 100, 34, 58, 34, 108, 111, 103, 105, 110, 95, 99, 108, 105, 101, 110, 116, 46, 48, 48, 48, 48, 57, 49, 57, 56, 54, 48, 46, 48, 48, 49, 34, 44, 34, 116, 115, 34, 58, 34, 49, 55, 49, 51, 52, 50, 56, 54, 51, 57, 34, 44, 34, 109, 101, 116, 104, 111, 100, 34, 58, 34, 108, 111, 103, 105, 110, 95, 99, 108, 105, 101, 110, 116, 34, 125, 13, 10, };
        string strText = Encoding.Default.GetString(buffer);

        Console.WriteLine(strText);
    }
    public void PrintByteArray(byte[] bytes)
    {
        var sb = new StringBuilder("new byte[] { ");
        foreach (var b in bytes)
        {
            sb.Append(b + ", ");
        }
        sb.Append("}");
        Console.WriteLine(sb.ToString());
    }
}







1.
Component ONE 최신버젼, 도구모음 등록안되는 형상(?)


2.
license.licx 증명서가 삭제되었을때에, 다시 발급받아야 하는가,ㅡ,ㅡ(?)


3.
참조) 라이선스 에러 발생시 대처 방법 안내 - 마이그레이션 방법

license.licx 를 여러개의 프로젝트에서 사용할때에, 즉 여러개의 license.licx가 존재할경우에,

삭제된 프로젝트에 다른 프로젝트의 license.licx를 가져와서 복사 & 붙여넣기해서 재사용이 가능한가,ㅡ,ㅡ(?)


4. 프로젝트의 참조에 사용중인 DLL버젼과 도구모음에 등록되어진 DLL버젼이 틀린경우에 어떤 현상이 나타나는가(?)

단순 편집만 안되는지, 실행하는데는 문제는 없는가,ㅡ,ㅡ(?) 일단 편집은 안되는걸로 확인이 됩니다.

https://dev.mescius.co.kr/bbs/board.php?bo_table=component_faq&wr_id=25&page=1











GC(Garbage Collection)는 객체가 더 이상 사용되지 않을 때 자동으로 메모리에서 제거하는 기능입니다. 하지만 GC에도 몇 가지 문제점이 있습니다.

  1. 성능 저하: GC는 메모리를 정리하기 위해 일정 시간 동안 애플리케이션의 실행을 중단 시키며, 이로 인해 애플리케이션의 성능이 저하 될 수 있습니다. 특히 대용량 데이터를 처리하는 경우에는 GC로 인한 성능 저하가 더욱 두드러질 수 있습니다.
  2. 메모리 누수: GC가 모든 객체를 완벽하게 제거하지 못할 경우 메모리 누수가 발생할 수 있습니다. 메모리 누수는 애플리케이션이 사용할 수 있는 메모리를 감소시키고, 시스템의 성능을 저하시킬 수 있습니다.
  3. 예측 불가능성: GC의 실행 시점은 예측하기 어렵습니다. 이로 인해 애플리케이션의 안정성이 떨어질 수 있습니다.
  4. 과도한 메모리 사용: GC는 메모리를 자동으로 관리하기 때문에 개발자가 메모리 사용량을 정확하게 제어하기 어렵습니다. 이로 인해 과도한 메모리 사용이 발생할 수 있습니다.

이러한 문제점을 해결하기 위해서는 적절한 GC 알고리즘을 선택하고, 메모리 사용량을 모니터링하고, 메모리 관리 전략을 수립하는 등의 노력이 필요합니다.

+ Recent posts