달력

5

« 2024/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

'NSFDbInfoParse'에 해당되는 글 1

  1. 2010.01.27 [ 도미노 / 노츠 6.5.6 ] C API 텍스트 추출 샘플

http://suite.tistory.com/  fs 2010 01 

가. 도미노 6.5 버전대에 C++ 로 툴킷이 없는건지 컴파일을 못한건지해서  --;
아마 C++ 로 했다면 일반 DIIOP 방식과 비슷해서 개발은 양호할것으로 생각됨~~~

어찌되었든 C 버전으로  IBM사이트에서 무료로 제공해주는 툴킷(C10QYEN.tar.Z)에있는 샘플로 테스트 해보았다.

일반 필드 출력 , 내용출력(mime,등) ,
첨부파일 다운로드?(로컬에저장)  (<- 이건 툴킷에 샘플이 없어서 중국어느 사이트 참고
                                                참고 중국사이트 : http://topic.csdn.net/t/20040609/10/3076169.html

나. 도미노가 설치된 서버에서  수정한 툴킷 샘플은

/notesapi/samples/misc/nsf_dump

수정 예제 및 Makefile ( solrais gcc version ) :

Makefile

                                                                  

nsf_dump.c

 
                                                             
주요 함수 사용함수는 NSFSearch , NSFItemScan , NSFDbInfoParse , NSFNoteExtractFile ( 파일 다운로드 )  


다. UniversalID  - UNID  가져오기

C sample

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sprintf(UNID,"%08x%08x%08x%08x",SearchMatch.OriginatorID.File.Innards[1],SearchMatch.OriginatorID.File.Innards[0],
                        SearchMatch.OriginatorID.Note.Innards[1],SearchMatch.OriginatorID.Note.Innards[0]);

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C++ sample
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DWORD a=unid->File.Innards[0];
   DWORD b=unid->File.Innards[1];
   //printf("aaaa1:%x," , a);
   //printf("aaaa2:%x\n" , b);

   cout.width(8);
   cout.fill('0');
   cout <<  hex <<b ;
   cout.width(8);
   cout.fill('0');
   cout<< hex<<toupper(a);

   a=unid->Note.Innards[0];
   b=unid->Note.Innards[1];
 
   cout <<  hex <<b;
   cout.width(8);
   cout.fill('0');
   cout<< hex<<toupper(a);

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


라.  도미노 연계시에는

DIIOP(JAVA) > C++ API (함수prefix LN*)  > C API (함수prefix NSF*)

좋아보임 (C API로 세그먼트 뽈트 에러나면 도미노 죽어버림 ~.~)

아래 참고 C, C++ 차이 링크 원본 : 
http://lotusdesk.blogspot.com/2009/11/differences-between-lotus-notes-c-api.html


Differences between Lotus Notes C API and C++ API

We always have few options if we need to do with Lotus Notes something externally. Here I'll try to provide a brief comparison chart of Lotus Notes CAPI and CppAPI. I hope this brochure can help to do the right choice before going deep into the water.

 

Lotus Notes CAPI
Lotus Notes CppAPI
Complex code, requires high attention during development because it works with raw memory pointers. So without experience it's very easy to produce memory leaks and access violations.
Simple code, it's very similar to Lotus Script and Java APIs.
Procedural code.
Object oriented code.
Notes uses it internally, so no dependency files required to install.
CppAPI requires lcppnXX.dll, there XX is a version of CppAPI. While this dll has versioning info most functionality is compatible across Lotus Notes versions. So lcppn70.dll is working with Lotus Notes 6.5 and Lotus Notes 8.5.1 Standard.
Can be coded anything so it can work much like it was a built-in feature of Lotus Notes.
There are limitations introduced by CppAPI implementation. It's obvious because CppAPI built on CAPI. In most cases it's the same limitations as in LotusScript or Java API. So if you can't do something in LotusScript and you like to move to a lower level than CppAPI is not your option. A good example of such limitations is a memo with attachment. While it's only few lines of code using CppAPI, this memo doesn't look good in Notes because there is no icon thumbnail, just a gray rectangle. With CAPI there will be 300-400 lines of code to add an attachment and to represent it as an icon inside of memo body. It's complex, but memo will look like the one created in Lotus Notes by a real user.
Strings represented in form of special LN Multibyte string (LMBCS). While in the code it looks like a normal ANSI string of type "char *" it can contain zeros inside and encoded non ANSI symbols. It's very easy to miss a large part of text and break international symbols if you apply standard C functions like strcat or strcpy. I'll write in the next post how to work with Lotus strings in CAPI to preserve international symbols and handle zeros in the middle of the string.
LNString class handles lotus strings just perfect. It has methods for string concatenation, searches, substring extraction, etc. It can return a pointer to the platform one byte character set encoding of the string. However it's still better to convert LMBCS to Unicode if you need to pass it outside of Lotus, and it's missing in CppAPI.

Here is a sample code of the same functionality in Lotus CAPI and CppAPI. The code opens Lotus database.

void CppApiCode()
{
 LNNotesSession session;
 session.Init();
 LNString databasePath = "special\\testdb.nsf";
 LNString serverPath;
 LNDatabase docDB;
 session.GetDatabase(databasePath, &docDB, serverPath);
 // Open the database.
 docDB.Open();
 ...
 docDB.Close();
}

void CApiCode()
{
 STATUS error = NotesInitExtended();
 DBHANDLE hDB = 0;
 char szFileName[] = "special\\testdb.nsf";
 char szServerName[] = "";
 char szDbPath[MAXPATH+1];
 error = OSPathNetConstruct(0, szServerName, szFileName, szDbPath);
 // Open the database.
 error = NSFDbOpen(szDbPath, &hDB);
 ...
 NSFDbClose(hDB);
}



 
:
Posted by mastar