NSString *query = [NSString stringWithFormat:@" \

//                               with t_dfct as ( \

//                               select a.cd_dong, a.cd_flor, a.ho, \

//                               sum(case b.cd_hndl_stat when 'B' then 1 else 0 end ) as cnt_b, \

//                               sum(case b.cd_hndl_stat when 'E' then 1 else 0 end ) as cnt_e, \

//                               sum(case b.cd_hndl_stat when 'X' then 1 else 0 end ) as cnt_x from ddtbt_hosh a \

//                               left outer join ddtbt_dfct b \

//                               on b.cd_dong = a.cd_dong \

//                               and b.nohs = a.nohs \

//                               and b.id_dfct_ctyp like '%@' \

//                               where a.cd_dong = '%@' \

//                               group by a.cd_dong, a.cd_flor, a.ho \

//                               ) \

//                               select cd_dong, cd_flor, ho, \

//                               case when (cnt_b + cnt_e) > 0 \

//                               then case cnt_x when 0 then 'R' else 'Y' end \

//                               else 'G' \

//                               end cl_stat \

//                               from t_dfct \

//                               order by cd_flor desc, ho asc;"

//                               //                               ,dongCd, nohs,yn

//                               //                               ,mode, hndlStatCd

//                               ,ctyp

//                               ,[GlobalVar loadFromUserDefaults:@"current_cd_dong"]

//                               ];

 

select a.cd_dong, a.cd_flor, a.ho, ifnull(cl_stat, 'G') as cl_stat 

from ddtbt_hosh a
left outer join ddtbt_status b 

on b.cd_dong = a.cd_dong
and b.nohs = a.nohs
and b.id_dfct_ctyp = 0 --공종 전체일때 0 

where a.cd_dong = '0301' -- 동
order by a.cd_flor desc, a.ho, id_dfct_ctyp ; 

with t_stat as 

(
select a.cd_dong, a.cd_flor, a.ho, 

ifnull(cl_stat, 'G') as cl_stat from ddtbt_hosh a 

left outer join ddtbt_status b
on b.cd_dong = a.cd_dong
and b.nohs = a.nohs
and b.id_dfct_ctyp = 0 --공종 전체일때 0 

where a.cd_dong = '0301' -- 동 ) 

select count(cd_dong) as cl_all,
sum(case cl_stat when 'R' then 1 else 0 end) as cl_r, sum(case cl_stat when 'Y' then 1 else 0 end) as cl_y, sum(case cl_stat when 'G' then 1 else 0 end) as cl_g 

from t_stat 

 

 

—————————————————————BEGIN;

 

CREATE TABLE "DDTBT_STATUS" (

   "cd_dong" varchar(4) NOT NULL

 , "nohs" varchar(5) NOT NULL

 , "id_dfct_ctyp" INTEGER NOT NULL

 , "cl_stat" varchar(10)

 , PRIMARY KEY("cd_dong", "nohs", "id_dfct_ctyp")

);

 

COMMIT;

 

서버 명세 수신 서버 담당자에게 수신

—————————————————————

METHOD 명 ‘getstatus’ 

Parameter = cd_site 

 

다운로드 기능 삽입

—————————————————————————

 

HttpRequest *httpJob = nil; //Request 객체 지정용 인스턴스 변수 생성 = 포인터 선언

 

전송 SQL문자열을 생성

 

XMLRequest* xmlRequest = [[XMLRequest alloc]init];

            

            [xmlRequest addFetchSQL:[NSString stringWithFormat:@"<reqhead method='getstatus' id='%@'><devicespec platform='ios' line1number='' deviceid='' ver='%@' /></reqhead><reqbody><data cd_site='%@'  /></reqbody>"

                                     ,GlobalVar.globalVar.userInfo.userId

                                     ,[GlobalVar currentBundleVersion]

                                     ,[GlobalVar loadFromUserDefaults:@"udglobalCDSite"]

                                     ]];

            

 

XML 생성

            NSString* sRequestXML = [xmlRequest makeXML];

                    NSLog(@"sRequestXML:%@", sRequestXML);

            

            서버로 전송

            httpJob = [[HttpRequest alloc] initWithURL:SERVERURL timeOut:60];

응답 수신

 

            NSString* sReceivedXML = [httpJob requestUrl:sRequestXML];

 

 

 

 

@interface DDTBT_STATUS : NSObject { }

 

@property (nonatomic, strong) NSString *cd_dong;

@property (nonatomic, strong) NSString *nohs;

@property (assign) NSInteger id_dfct_ctyp;

@property (nonatomic, strong) NSString *cl_stat;

 

@end

 

 

 

 

 

 

@implementation DDTBT_STATUS

 

@synthesize cd_dong;

@synthesize nohs;

@synthesize id_dfct_ctyp;

@synthesize cl_stat;

 

- (id)init {

    if (self = [super init]) {

        self.cd_dong = @"";

        self.nohs = @"";

        self.id_dfct_ctyp = 0;

        self.cl_stat = @"";

      return self;

    }

}

 

#include <stdio.h>

 

typedef struct twoInt {

   int one;

   int two;

} twoInt;

 

int main()

{

   int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

 

   for(int i=0; i<10;i++) { printf("array[i] = %d\n", i, array[i]);

}

 

or

 

twoInt *temp = (twoInt *)array;

for (int i=0; i<5; i++) {

   printf("temp = %d, %d\n", temp->one, temp->two);

    temp++ };

 

구조체, 포인터, 배열 모두 메모리 구조 생각하면 됨.

'Blog History' 카테고리의 다른 글

236  (0) 2020.05.11
235  (0) 2020.05.11
233  (0) 2020.05.11
232  (0) 2020.05.11
231  (0) 2020.05.04

+ Recent posts