C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[17239] Re:[답] SQL로 SELECT * 하거나 아니면 Table에서 Filter했을때 다른 Table에 가장빠른게 쓰는법?
허재연 [hurjiwoo] 966 읽음    2002-04-05 12:35
계속 해서 Table를 가지고 놀다 보니(백수 이므로 놀고 있음)
또 계속해서 복사 문제와 씨름을 하다 보니
(이번 복사하는 것은 61초 정도 걸리네요)

이래서 또 도움말은 보고 있는데,,,,

도움말 제목이  " Importing data from another table "
Importing라고 가져오기 그래,, 이거다..

해서 쭈~~~~욱 보니 마지막 줄에,

see "Using TBatchMove.   ==> 이렇게 써 있는요....

그래서 클릭해서 봤더니
역시, 해서

속도가 13초 정도가 나옵니다.

원본 Table에는
레코드 : 369563
필드   : 19

대상   :
필드   : 5

[소스]
void ... (void);
{
  int CallCount;
  AnsiString temp, DBFileName;


  CallCount =0;

  while( true ) {
    temp  = "SELECT re_inx, re_member, re_barcode, ";
    temp += "re_barcode AS re_title, re_rentDate, re_rentTime FROM brent ";
    temp += "WHERE re_member>=:stt AND re_member<:ett ORDER BY re_member ASC";

    Query1->Close();
    Query1->SQL->Clear();
    Query1->SQL->Add(temp);
    Query1->ParamByName("stt")->AsInteger =  NumberCount*CallCount;
    Query1->ParamByName("ett")->AsInteger = (NumberCount*(CallCount+1))-1;
    Query1->Open();
    Query1->First();

    if( Query1->Eof ) {
      break;
    }

    DBFileName = DBFileName.sprintf("M%05d-%05d", NumberCount*CallCount, (NumberCount*(CallCount+1))-1);

    MakeTable("", DBFileName);

    Table2->Close();
    Table2->TableName = DBFileName;
    Table2->Open();

    BatchMove1->Execute();

    ++CallCount;
  }
}

void __fastcall TForm1::MakeTable(const AnsiString &TableName, const AnsiString &FileName)
{
  Table2->Active = false;
  Table2->DatabaseName = "book_View";
  Table2->TableName    = FileName;
  Table2->TableType    = ttParadox;

  Table2->FieldDefs->Clear();

  TFieldDef *NewField;

  NewField = Table2->FieldDefs->AddFieldDef(); // define first field
  NewField->DataType = ftInteger;
  NewField->Name = "Inx";

  NewField = Table2->FieldDefs->AddFieldDef(); // define first field
  NewField->DataType = ftInteger;
  NewField->Name = "Member";

  NewField = Table2->FieldDefs->AddFieldDef(); // define first field
  NewField->DataType = ftInteger;
  NewField->Name = "Barcode";

  NewField = Table2->FieldDefs->AddFieldDef(); // define second field
  NewField->DataType = ftString;
  NewField->Size = 40;
  NewField->Name = "Title";

  NewField = Table2->FieldDefs->AddFieldDef(); // define second field
  NewField->DataType = ftString;
  NewField->Size = 10;
  NewField->Name = "RentDate";

  NewField = Table2->FieldDefs->AddFieldDef(); // define second field
  NewField->DataType = ftString;
  NewField->Size = 5;
  NewField->Name = "RentTime";

  Table2->IndexDefs->Clear();

  TIndexDef *NewIndex;

  NewIndex = Table2->IndexDefs->AddIndexDef(); // add an index
  NewIndex->Name = "PrimaryIndex";
  NewIndex->Fields = "Inx";
  NewIndex->Options << ixPrimary << ixUnique;

  Table2->CreateTable(); // create the table
}

+ -

관련 글 리스트
15928 [질문] SQL로 SELECT * 하거나 아니면 Table에서 Filter했을때 다른 Table에 가장빠른게 쓰는법? 허재연 722 2002/03/02
17239     Re:[답] SQL로 SELECT * 하거나 아니면 Table에서 Filter했을때 다른 Table에 가장빠른게 쓰는법? 허재연 966 2002/04/05
15929     음 파라독스나 인터베이스등이 아니면 될수 있으면 TDataSet 말고 TADODataSet을 쓰십시오. 에보니.^0^ 998 2002/03/02
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.