블로그 이미지
fiadot_old

칼퇴근을 위한 게임 서버 개발 방법론에 대한 심도있는 고찰 및 성찰을 위한 블로그!

Rss feed Tistory
Technical Article/펌 2003. 5. 9. 21:04

[OLEDB] 초간단 샘플

http://www.codeguru.com/mfc/comments/8227.shtml


  

OLE DB Templates - A light and simple Data Access Method
Rating: none

Dick Warg (view profile)
July 3, 1999  

I was amazed and delighted to see how simple database access has become thanks to OLE DB. I've been reading the hype and so I went out and found the Microsoft Book on OLE DB. It's a great idea as it's explained there but still rather complex to code. I noticed that Visual C++ 6 has some new templates for Data Consumers so I started looking at the documentation. Wow! Is this simple stuff or what??

Here's a sample, a CONSOLE application at that, using the NWind database that comes with the DASDK. It's only 99 lines of code including comments and it compiles into a 60K executable.


--------------------------------------------------------------------------------


//file: olsamp.cpp
//auth: dick warg
//date: 6/25/99
//func: minimal oledb program

#include <atldbcli.h>
#include <iostream>
using namespace std;

// define a class to hold the data from the table
class myNwCust
{
public:
    // data elements
    TCHAR m_CustomerID[6];
    TCHAR m_CompanyName[41];
    TCHAR m_ContactName[31];
    TCHAR m_Phone[25];

    // column binding  -- I only want these 4 fields
    BEGIN_COLUMN_MAP(myNwCust)
        COLUMN_ENTRY(1, m_CustomerID)
        COLUMN_ENTRY(2, m_CompanyName)
        COLUMN_ENTRY(3, m_ContactName)
        COLUMN_ENTRY(4, m_Phone)
    END_COLUMN_MAP()
};

// declare the OLEDB objects
CDataSource ds;
CSession    session;
CCommand <CAccessor<myNwCust> > cust;

int main()
{

try{
    // fire up COM
    HRESULT hr = CoInitialize(0);
    if(FAILED(hr))
    {
        cout << "Can't start COM!? " << endl;
        return -1;
    }
    
    // connect to the database
    hr = ds.Open(_T("MSDASQL"), "OLE_DB_NWind_Jet", "sa", "");
    if(FAILED(hr))
    {
        cout << "Can't open Nwind" << endl;
        return -1;
    }

    // start the session
    hr = session.Open(ds);
    if(FAILED(hr))
    {
        cout << "Can't open Nwind SESSION" << endl;
        ds.Close();
        return -1;
    }

    // construct the query string
    TCHAR mySQL[] = "SELECT CustomerID, CompanyName, ContactName, \
    Phone FROM Customers";

    // open the dataset
    hr = cust.Open(session, mySQL);
    if(FAILED(hr))
    {
        cout << "Can't open Nwind TABLE" << endl;
        session.Close();
        ds.Close();
        return -1;
    }

    // read all the data
    while(cust.MoveNext() == S_OK)
    {
        cout << cust.m_CustomerID << ", " << cust.m_CompanyName << ", ";

        cout << cust.m_ContactName << ", " << cust.m_Phone << endl;
    }

    cust.Close();
    session.Close();
    ds.Close();

    cout << "That's All Folks" << endl;

    return 1;
}
catch(...)
{
    cout << "Unknown failure" << endl;
    return -1;
}
}


--------------------------------------------------------------------------------
The Microsoft documentation and samples are in the MSDN pages "Visual C++ Documentation \ References \ Microsoft Foundation Class Library and Templates\OLE DB Templates"
,
Technical Article/펌 2003. 5. 7. 21:58

Null@Root 신규멤버 모집 문제.....

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력해주세요.

Technical Article/펌 2003. 5. 1. 13:20

웹스케너

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력해주세요.

Technical Article/펌 2003. 4. 14. 23:33

분석자료 5. 암호화 소스

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력해주세요.

Technical Article/펌 2003. 4. 11. 01:56

분석자료 4. Encryption 완성 소스

아직 뭔가 문제가 있음 ㅡㅡ;
,
Technical Article/펌 2003. 4. 10. 12:00

분석자료 3. Encryption Key List Src

결과>

[ 0] : 41 41
[ 1] : 41 51
[ 2] : 41 67
[ 3] : 41 77
[ 4] : 42 41
[ 5] : 42 51
[ 6] : 42 67
[ 7] : 42 77
[ 8] : 43 41
[ 9] : 43 51
[ a] : 43 67
[ b] : 43 77
[ c] : 44 41
[ d] : 44 51
[ e] : 44 67
[ f] : 44 77
10] : 45 41
11] : 45 51
12] : 45 67
13] : 45 77
14] : 46 41
15] : 46 51
16] : 46 67
17] : 46 77
18] : 47 41
19] : 47 51
1a] : 47 67
1b] : 47 77
[1c] : 48 41
[1d] : 48 51
[1e] : 48 67
[1f] : 48 77
[20] : 49 41
[21] : 49 51
[22] : 49 67
[23] : 49 77
[24] : 4a 41
[25] : 4a 51
[26] : 4a 67
[27] : 4a 77
[28] : 4b 41
[29] : 4b 51
[2a] : 4b 67
[2b] : 4b 77
[2c] : 4c 41
[2d] : 4c 51
[2e] : 4c 67
[2f] : 4c 77
[30] : 4d 41  - 0
[31] : 4d 51
[32] : 4d 67
[33] : 4d 77
[34] : 4e 41
[35] : 4e 51
[36] : 4e 67
[37] : 4e 77
[38] : 4f 41
[39] : 4f 51
[3a] : 4f 67
[3b] : 4f 77
[3c] : 50 41
[3d] : 50 51
[3e] : 50 67
[3f] : 50 77
[40] : 51 41
[41] : 51 51 - A
[42] : 51 67
[43] : 51 77
[44] : 52 41
[45] : 52 51
[46] : 52 67
[47] : 52 77
[48] : 53 41
[49] : 53 51
[4a] : 53 67
[4b] : 53 77
[4c] : 54 41
[4d] : 54 51
[4e] : 54 67
[4f] : 54 77
[50] : 55 41
[51] : 55 51
[52] : 55 67
[53] : 55 77
[54] : 56 41
[55] : 56 51
[56] : 56 67
[57] : 56 77
[58] : 57 41
[59] : 57 51
[5a] : 57 67
[5b] : 57 77
[5c] : 58 41
[5d] : 58 51
[5e] : 58 67
[5f] : 58 77
[60] : 59 41
[61] : 59 51 - A
[62] : 59 67
[63] : 59 77
[64] : 5a 41
[65] : 5a 51
[66] : 5a 67
[67] : 5a 77
[68] : 5b 41
[69] : 5b 51
[6a] : 5b 67
[6b] : 5b 77
[6c] : 5c 41
[6d] : 5c 51
[6e] : 5c 67
[6f] : 5c 77
[70] : 5d 41
[71] : 5d 51
[72] : 5d 67
[73] : 5d 77
[74] : 5e 41
[75] : 5e 51
[76] : 5e 67
[77] : 5e 77
[78] : 5f 41
[79] : 5f 51
[7a] : 5f 67
[7b] : 5f 77
[7c] : 60 41
[7d] : 60 51
[7e] : 60 67
[7f] : 60 77
[80] : 61 41
[81] : 61 51
[82] : 61 67
[83] : 61 77
[84] : 62 41
[85] : 62 51
[86] : 62 67
[87] : 62 77
[88] : 63 41
[89] : 63 51
[8a] : 63 67
[8b] : 63 77
[8c] : 64 41
[8d] : 64 51
[8e] : 64 67
[8f] : 64 77
[90] : 65 41
[91] : 65 51
[92] : 65 67
[93] : 65 77
[94] : 66 41
[95] : 66 51
[96] : 66 67
[97] : 66 77
[98] : 67 41
[99] : 67 51
[9a] : 67 67
[9b] : 67 77
[9c] : 68 41
[9d] : 68 51
[9e] : 68 67
[9f] : 68 77
[a0] : 69 41
[a1] : 69 51
[a2] : 69 67
[a3] : 69 77
[a4] : 6a 41
[a5] : 6a 51
[a6] : 6a 67
[a7] : 6a 77
[a8] : 6b 41
[a9] : 6b 51
[aa] : 6b 67
[ab] : 6b 77
[ac] : 6c 41
[ad] : 6c 51
[ae] : 6c 67
[af] : 6c 77
[b0] : 6d 41
[b1] : 6d 51
[b2] : 6d 67
[b3] : 6d 77
[b4] : 6e 41
[b5] : 6e 51
[b6] : 6e 67
[b7] : 6e 77
[b8] : 6f 41
[b9] : 6f 51
[ba] : 6f 67
[bb] : 6f 77
[bc] : 70 41
[bd] : 70 51
[be] : 70 67
[bf] : 70 77
[c0] : 71 41
[c1] : 71 51
[c2] : 71 67
[c3] : 71 77
[c4] : 72 41
[c5] : 72 51
[c6] : 72 67
[c7] : 72 77
[c8] : 73 41
[c9] : 73 51
[ca] : 73 67
[cb] : 73 77
[cc] : 74 41
[cd] : 74 51
[ce] : 74 67
[cf] : 74 77
[d0] : 75 41
[d1] : 75 51
[d2] : 75 67
[d3] : 75 77
[d4] : 76 41
[d5] : 76 51
[d6] : 76 67
[d7] : 76 77
[d8] : 77 41
[d9] : 77 51
[da] : 77 67
[db] : 77 77
[dc] : 78 41
[dd] : 78 51
[de] : 78 67
[df] : 78 77
[e0] : 79 41
[e1] : 79 51
[e2] : 79 67
[e3] : 79 77
[e4] : 7a 41
[e5] : 7a 51
[e6] : 7a 67
[e7] : 7a 77
[e8] : 7b 41
[e9] : 7b 51
[ea] : 7b 67
[eb] : 7b 77
[ec] : 7c 41
[ed] : 7c 51
[ee] : 7c 67
[ef] : 7c 77
[f0] : 7d 41
[f1] : 7d 51
[f2] : 7d 67
[f3] : 7d 77
[f4] : 7e 41
[f5] : 7e 51
[f6] : 7e 67
[f7] : 7e 77
[f8] : 7f 41
[f9] : 7f 51
[fa] : 7f 67
[fb] : 7f 77
[fc] : 80 41
[fd] : 80 51
[fe] : 80 67
,
Technical Article/펌 2003. 4. 9. 14:55

분석자료 2. Str

[비밀번호 변경 주의사항]
영문자, 숫자, 특수문자 8개(! @ # $ % ^ & * ) 중 임의로 조합,
사용하실 수 있으며 4~8자리로 만들어야 합니다

비밀번호 dreamms / 5A 48 4A 6C 59 57 31 74 63 77


패리티 -  A부터 시작 + 16단계 마다......... 1 씩 상승

1번   - A부터 16씩 증가... A-Z a-z 0~9 를 넘어가면
        패리티 1 증가하고 무조건 A로 돌아옴..

2번   - A부터 4씩 증가. (아스키 1번기준)   단 A-Z a-z 0-9 를 넘어가면
         (암호1번 글자)에  한턴넘김에 대해서 +1 씩함..

3번   - A부터 1씩 증가    A-Z a-z 0~9 + / 순으로...   를 넘어가면
         (암호2번 글자)에 한턴 넘김에 대해서 +1씩함..


한문자는 2바이트로 표현됨

아스키 코드표의 순서대로 !(21)시작

1바이트는 49 부터 4개가 한단위. 한단위 증가당 +1
2바이트는 51 부터 67, 77, 41 로   41부터 77까지 16씩 증가 반복!


문자                암호화        16진                
                된        코드    
                문자열          
                          
!(21)                IQ        49 51  
.
.
#(23)                     Iw        49 77
$(24)                     JA        4A 41
%(25)                     JQ        4A 51
&(26)                     Jg        4A 67
                                   
((28)                     KA        4B 41
)(29)                     KQ        4B 51
*(2A)                     Kg        4B 67
                                   
.(2E)                     Lg        4C 67
                                   
0(30)                     MA        4D 41
1                   MQ        4D 51        
2                   Mg        4D 67        
3                     Mw        4D 77
4                     NA        4E 41
5                   NQ        4E 51        
6                   Ng        4E 67        
7                     Nw        4E 77
8                   OA        4F 41        
9(39)                   OQ        4F 51        
                                   
@                     QA        51 41

A(41)                  QQ        51 51                
B(42)+1                  Qg        51 67                
C(43)+2           Qw        51 77                
D(44)+3                  RA        52 41                
E(45)+4                  RQ        52 51                
F(46)+5                  Rg        52 67                
G(47)+6                  Rw        52 77                
H(48)+7                  SA        53 41                
I(49)+8                      SQ        53 51                        
J(4A)+9                      Sg         53 67                        
K(4B)+10              Sw        53 77                        
L(4C)+11              TA        54 41                        
M(4D)+12 *             TQ        54 51                        
N(4E)+13(1)           Tg        54 67                        
O(4F)+14(2)          Tw        54 77                        
P(50)+15(3)           UA        55 41                        
Q(51)+16(4)         UQ        55 51                        
R(52)+17(5)        Ug        55 67                                          
S(53)+18(6)        Uw        55 77                                          
T(54)+19(7)        VA        56 41                                          
U(55)+20(8)        VQ        56 51                                          
V(56)+21(9)        Vg        56 67                                          
W(57)+22(10)        Vw        56 77                                          
X(58)+23(11)        WA        57 41                                          
Y(59)+24(12)        WQ        57 51                                          
Z(5A)+25(13)        Wg        57 67


^(5E)                Xg        58 67        
_(5F)
`(60)                          
a(61)                  YQ        59 51
b(62)+1                  Yg        59 67
c(63)+2           Yw        59 77
d(64)+3                  ZA        5A 41
e(65)+4                  ZQ        5A 51
f(66)+5                  Zg        5A 67
g(67)+6                  Zw        5A 77
h(68)+7                  aA        61 41
i(69)+8                      aQ        61 51
j(6A)+9                      ag        61 67
k(6B)+10              aw        61 77
l(6C)+11              bA        62 41
m(6D)+12 *             bQ        62 51
n(6E)+13(1)           bg        62 67
o(6F)+14(2)          bw        62 77
p(70)+15(3)           cA        63 41
q(71)+16(4)         cQ        63 51
r(72)+17(5)        cg        63 67
s(73)+18(6)        cw        63 77
t(74)+19(7)        dA        64 41
u(75)+20(8)        dQ        64 51
v(76)+21(9)        dg        64 67
w(77)+22(10)        dw        64 77
x(78)+23(11)        eA        65 41
y(79)+24(12)        eQ        65 51
z(7A)+25(13)        eg        65 67
                          
,
Technical Article/펌 2003. 4. 9. 14:54

분석자료 1. Char

[비밀번호 변경 주의사항]
영문자, 숫자, 특수문자 8개(! @ # $ % ^ & * ) 중 임의로 조합,
사용하실 수 있으며 4~8자리로 만들어야 합니다

비밀번호 dreamms / 5A 48 4A 6C 59 57 31 74 63 77


패리티 -  A부터 시작 + 16단계 마다......... 1 씩 상승

1번   - A부터 16씩 증가... A-Z a-z 0~9 를 넘어가면
        패리티 1 증가하고 무조건 A로 돌아옴..

2번   - A부터 4씩 증가. (아스키 1번기준)   단 A-Z a-z 0-9 를 넘어가면
         (암호1번 글자)에  한턴넘김에 대해서 +1 씩함..

3번   - A부터 1씩 증가    A-Z a-z 0~9 + / 순으로...   를 넘어가면
         (암호2번 글자)에 한턴 넘김에 대해서 +1씩함..


한문자는 2바이트로 표현됨

아스키 코드표의 순서대로 !(21)시작

1바이트는 49 부터 4개가 한단위. 한단위 증가당 +1
2바이트는 51 부터 67, 77, 41 로   41부터 77까지 16씩 증가 반복!


문자                암호화        16진                
                된        코드    
                문자열          
                          
!(21)                IQ        49 51  
.
.
#(23)                     Iw        49 77
$(24)                     JA        4A 41
%(25)                     JQ        4A 51
&(26)                     Jg        4A 67
                                   
((28)                     KA        4B 41
)(29)                     KQ        4B 51
*(2A)                     Kg        4B 67
                                   
.(2E)                     Lg        4C 67
                                   
0(30)                     MA        4D 41
1                   MQ        4D 51        
2                   Mg        4D 67        
3                     Mw        4D 77
4                     NA        4E 41
5                   NQ        4E 51        
6                   Ng        4E 67        
7                     Nw        4E 77
8                   OA        4F 41        
9(39)                   OQ        4F 51        
                                   
@                     QA        51 41

A(41)                  QQ        51 51                
B(42)+1                  Qg        51 67                
C(43)+2           Qw        51 77                
D(44)+3                  RA        52 41                
E(45)+4                  RQ        52 51                
F(46)+5                  Rg        52 67                
G(47)+6                  Rw        52 77                
H(48)+7                  SA        53 41                
I(49)+8                      SQ        53 51                        
J(4A)+9                      Sg         53 67                        
K(4B)+10              Sw        53 77                        
L(4C)+11              TA        54 41                        
M(4D)+12 *             TQ        54 51                        
N(4E)+13(1)           Tg        54 67                        
O(4F)+14(2)          Tw        54 77                        
P(50)+15(3)           UA        55 41                        
Q(51)+16(4)         UQ        55 51                        
R(52)+17(5)        Ug        55 67                                          
S(53)+18(6)        Uw        55 77                                          
T(54)+19(7)        VA        56 41                                          
U(55)+20(8)        VQ        56 51                                          
V(56)+21(9)        Vg        56 67                                          
W(57)+22(10)        Vw        56 77                                          
X(58)+23(11)        WA        57 41                                          
Y(59)+24(12)        WQ        57 51                                          
Z(5A)+25(13)        Wg        57 67                                          
                          
^                Xg        58 67        
                          
a(61)                  YQ        59 51
b(62)+1                  Yg        59 67
c(63)+2           Yw        59 77
d(64)+3                  ZA        5A 41
e(65)+4                  ZQ        5A 51
f(66)+5                  Zg        5A 67
g(67)+6                  Zw        5A 77
h(68)+7                  aA        61 41
i(69)+8                      aQ        61 51
j(6A)+9                      ag        61 67
k(6B)+10              aw        61 77
l(6C)+11              bA        62 41
m(6D)+12 *             bQ        62 51
n(6E)+13(1)           bg        62 67
o(6F)+14(2)          bw        62 77
p(70)+15(3)           cA        63 41
q(71)+16(4)         cQ        63 51
r(72)+17(5)        cg        63 67
s(73)+18(6)        cw        63 77
t(74)+19(7)        dA        64 41
u(75)+20(8)        dQ        64 51
v(76)+21(9)        dg        64 67
w(77)+22(10)        dw        64 77
x(78)+23(11)        eA        65 41
y(79)+24(12)        eQ        65 51
z(7A)+25(13)        eg        65 67
                          
,
Technical Article/펌 2003. 4. 4. 12:27

[펌] malloc과 free를 직접 구현한 소스.

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력해주세요.

Technical Article/펌 2003. 4. 4. 12:15

Dictionary of Algorithms, Data Structures, and Problems

알고리즘 사전

http://hissa.nist.gov/dads/#B
,
TOTAL TODAY