< 이전 | 다음 >

학습 5에서 완성된 printCustomerOrders.egl 및 records.egl 파일

이 코드는 학습 5에서 완성된 printCustomerOrders.egl 및 records.egl 파일입니다. 파일에 빨간색 X 기호로 표시된 오류가 있으면 사용자의 코드가 다음 코드와 일치하는지 확인하십시오.

[data/records.egl]

package data;

record OrderCustomerJoin type SQLRecord
  {tableNames = [["EGL.CUSTOMER", "C"], ["EGL.ORDERS", "O"]], 
  keyItems=[CUSTOMER_ID, ORDER_ID],
  defaultSelectCondition = #sqlCondition{ O.CUSTOMER_ID = C.CUSTOMER_ID }}

  CUSTOMER_ID int
    {column="C.CUSTOMER_ID", isReadOnly=yes};
  FIRST_NAME string
    {column="C.FIRST_NAME", isReadOnly=yes, 
      isSqlNullable=yes, sqlVariableLen=yes, maxLen=30};
  LAST_NAME string
    {column="C.LAST_NAME", isReadOnly=yes, 
      isSqlNullable=yes, sqlVariableLen=yes, maxLen=30};
  PASSWORD string
    {column="C.PASSWORD", isReadOnly=yes, 
      isSqlNullable=yes, maxLen=8};
  PHONE string
    {column="C.PHONE", isReadOnly=yes, isSqlNullable=yes, 
      sqlVariableLen=yes, maxLen=14};
  EMAIL_ADDRESS string
    {column="C.EMAIL_ADDRESS", isReadOnly=yes, 
      isSqlNullable=yes, sqlVariableLen=yes, maxLen=50};
  STREET string
    {column="C.STREET", isReadOnly=yes, 
      isSqlNullable=yes, sqlVariableLen=yes, maxLen=30};
  APARTMENT string
    {column="C.APARTMENT", isReadOnly=yes, 
      isSqlNullable=yes, sqlVariableLen=yes, maxLen=10};
  CITY string
    {column="C.CITY", isReadOnly=yes, isSqlNullable=yes, 
      sqlVariableLen=yes, maxLen=30};
  STATE string
    {column="C.STATE", isReadOnly=yes, 
      isSqlNullable=yes, maxLen=2};
  POSTALCODE string
    {column="C.POSTALCODE", isReadOnly=yes, 
      isSqlNullable=yes, sqlVariableLen=yes, maxLen=10};
  DIRECTIONS string
    {column="C.DIRECTIONS", isReadOnly=yes, 
      isSqlNullable=yes, sqlVariableLen=yes, maxLen=255};
  ORDER_ID int
    {column="O.ORDER_ID", isReadOnly=yes};
  orders_CUSTOMER_ID int
    {column="O.CUSTOMER_ID", isReadOnly=yes, 
      isSqlNullable=yes};
  ORDER_AMOUNT decimal(8,2)
    {column="O.ORDER_AMOUNT", isReadOnly=yes, 
      isSqlNullable=yes};
  ORDER_DETAILS string
    {column="O.ORDER_DETAILS", isReadOnly=yes, 
      isSqlNullable=yes, sqlVariableLen=yes, maxLen=111};
  ORDER_DATE date
    {column="O.ORDER_DATE", isReadOnly=yes, 
      isSqlNullable=yes};
  ORDER_STATUS string
    {column="O.ORDER_STATUS", isReadOnly=yes, 
      isSqlNullable=yes, maxLen=12};
end

[programs/printCustomerOrders.egl]

package programs;

import data.OrderCustomerJoin;

program printCustomerOrders type BasicProgram {}
  
  function main()
    
    allCustomerOrders OrderCustomerJoin[0];
    
    tempRec OrderCustomerJoin;
    open resultSet for tempRec;
    forEach (tempRec)
      SysLib.writeStdout(tempRec.CUSTOMER_ID :: " " 
        :: tempRec.LAST_NAME :: " " :: tempRec.ORDER_ID);
    end
    
  end
  
end

학습 5: 테이블 결합을 사용하여 더욱 복잡한 데이터 검색으로 되돌아가십시오.

< 이전 | 다음 >