source: svn/trunk/zasc/app_c/DST_WinDebugSQL.c @ 40

Last change on this file since 40 was 29, checked in by phkim, 10 years ago
  1. phkim
  2. app
  3. 변경 내용
    • 채널 편집 기능 활성화
    • 프로그램ID, RF 기능을 Major, Minor 로 변경
    • Skip_list 저장 위치를 TVCT_SUB 아래로 변경
    • define 이름 변경 -> SUPPORT_CHANNEL_EDIT
File size: 66.1 KB
Line 
1#include "DST_WinManager.h"
2#include "DST_OSDImage.h"
3#include "DST_UserInterface.h"
4#include "DST_DataStrings.h"
5#include "DST_DB_Engine.h"
6#include "DST_MemoryDB.h"
7
8#if 0
9____CPowerDownCautionWin___()
10#endif
11
12typedef struct 
13{
14        char* name;
15}DBNAMES;
16
17typedef struct 
18{
19        DS_U8 type;
20        char* name;
21}ATTRIBUTES;
22
23static DB_NO_LIST g_no_list;
24
25//class CDebugSQLWin : public CWindow
26//{
27//private:
28        static DS_U16 CDebugSQLWin_Pos;
29        static DS_U16 CDebugSQLWin_Top;
30        static DS_U16 CDebugSQLWin_Select;
31        static DS_U16 CDebugSQLWin_ListNum;
32        static DS_U16 CDebugSQLWin_ItemNum;
33
34        static DS_U16 CDebugSQLWin_pre_Pos;
35        static DS_U16 CDebugSQLWin_pre_Top;
36        static DS_U16 CDebugSQLWin_pre_Select;
37        static DS_U16 CDebugSQLWin_pre_ListNum;
38        static DS_U16 CDebugSQLWin_pre_ItemNum;
39
40//      static DBNAMES* CDebugSQLWin_names;
41//public:
42void CDebugSQLWin_InitValues();
43//      CDebugSQLWin(SWinEventMsg event):CWindow(event)
44        void CDebugSQLWin_Constructor(CWindow *this, SWinEventMsg event)
45        {
46                this->SetWinName(this,  "DebugSql");
47                CDebugSQLWin_InitValues();
48                this->rect.w = 576;
49                this->rect.h = 384;
50                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
51                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
52
53                this->SetTimeOut(this, 0);
54
55                this->RegisterKey(this, VK_CANCEL, true, 0, 0);
56                this->RegisterKey(this, VK_PREV, true, 0, 0);
57                this->RegisterKey(this, VK_PREV_CH, true, 0, 0);
58                this->RegisterKey(this, VK_PREV_MENU, true, 0, 0);
59                this->RegisterKey(this, VK_OK, true, 0, 0);
60                this->RegisterKey(this, VK_RIGHT, true, 0, 0);
61                this->RegisterKey(this, VK_LEFT, true, 0, 0);
62                this->RegisterKey(this, VK_UP, true, 0, 0);
63                this->RegisterKey(this, VK_DN, true, 0, 0);
64        }
65
66        void CDebugSQLWin_Destructor(CWindow *this)
67        {
68//              int i = 0;
69//              if (CDebugSQLWin_names)
70//              {
71//                      for ( i = 0; i < CDebugSQLWin_ItemNum; i++) if (CDebugSQLWin_names[i].name) DST_OS_Free(&CDebugSQLWin_names[i].name);
72//                      DST_OS_Free(&CDebugSQLWin_names);
73//              }
74
75        }
76       
77//      DBNAMES* CDebugSQLWin_GetDBTableName(DS_U16 *size)
78//      {
79//
80//              CDB db;
81//              NewCDB(&db);
82//              DBNAMES* n;
83//              int i = 0;
84//              db.GetTable(&db, "SELECT name FROM sqlite_master where type='table' order by name");
85//              *size = db.GetRow(&db);
86//              if (*size < 1)
87//              {
88//                      DeleteCDB(&db);
89//                      return 0;
90//              }
91//              n = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), *size);
92//              for ( i = 0; i < *size; i++)
93//              {
94//                      int nLen = strlen(db.GetResult(&db, (i+1)*db.GetCol(&db)+0));
95//                      n[i].name = 0;
96//                      n[i].name = (char*)DST_OS_Calloc((nLen+1)*sizeof(char),1);
97//                      memcpy(n[i].name,db.GetResult(&db, (i+1)*db.GetCol(&db)+0),nLen);
98//              }
99//              DeleteCDB(&db);
100//              return n;
101//      }       
102//     
103        void CDebugSQLWin_UpdateList()
104        {
105//              int i = 0;
106//              if (CDebugSQLWin_names)
107//              {
108//                      for ( i = 0; i < CDebugSQLWin_ItemNum; i++) if (CDebugSQLWin_names[i].name) DST_OS_Free(&CDebugSQLWin_names[i].name);
109//                      DST_OS_Free(&CDebugSQLWin_names);
110//              }
111//              CDebugSQLWin_names = CDebugSQLWin_GetDBTableName(&CDebugSQLWin_ItemNum);       
112        }
113               
114        void CDebugSQLWin_InitValues()
115        {               
116//              CDebugSQLWin_names = 0;
117                CDebugSQLWin_Pos = 0;
118                CDebugSQLWin_Top = 0;
119                CDebugSQLWin_Select = 0;
120                CDebugSQLWin_ListNum = 30;
121                CDebugSQLWin_ItemNum = NO_DB_MAX;
122
123                CDebugSQLWin_pre_Pos = CDebugSQLWin_Pos;
124                CDebugSQLWin_pre_Top = CDebugSQLWin_Top;
125                CDebugSQLWin_pre_Select = CDebugSQLWin_Select;
126                CDebugSQLWin_pre_ListNum = CDebugSQLWin_ListNum;
127                CDebugSQLWin_pre_ItemNum = CDebugSQLWin_ItemNum;
128               
129//              CDebugSQLWin_UpdateList();
130                if (CDebugSQLWin_ItemNum < CDebugSQLWin_ListNum) CDebugSQLWin_ListNum = CDebugSQLWin_ItemNum;
131        }
132
133//      virtual void Show(WinID id)
134        void CDebugSQLWin_ShowWindow(CWindow *this, WinID id)
135        {
136                DST_Printf("id=%d\n",id);
137                switch(id)
138                {
139                        case WIN_DEBUG_SQL_SUB:
140                        case WIN_DEBUG_SQL:
141                        case WIN_CHANNEL_BANNER:
142                        case WIN_ERROR:                         
143                                break;
144                        default:
145                                this->Close(this);
146                                break;
147                }
148        }
149
150        void CDebugSQLWin_DrawAll(CWindow *this)
151        {
152                int x = 0;
153                int y = 0;
154               
155                this->setFontStyle(this, 15, 0xAAC8C8C8, ALIGN_MIDDLE,ALIGN_CENTER);
156
157                this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0xAA262626));
158
159                for( x=0;x<3;x++)
160                {
161                        for( y=0;y<10;y++)
162                        {
163                                if(CDebugSQLWin_ItemNum > y+x*10)
164                                {
165                                        if(CDebugSQLWin_Select+CDebugSQLWin_Top == y+x*10)
166                                                this->DrawBox32(this, 2+x*192, 84+2+y*30, 192-4, 30-4, CONV32_16(0xAA1C3923));
167                                        else
168                                                this->DrawBox32(this, 2+x*192, 84+2+y*30, 192-4, 30-4, CONV32_16(0xAAFFA52C));
169                                        this->DrawText(this, 2+x*192, 84+2+y*30, 192-4, 30-4,db_list[y+x*10].name,&(this->font));
170                                }
171                        }
172                }
173               
174        }
175
176        void CDebugSQLWin_Draw(CWindow *this)
177        {
178                int x = 0;
179                int y = 0;
180                this->setFontStyle(this, 15, 0xAAC8C8C8, ALIGN_MIDDLE,ALIGN_CENTER);
181
182                for( x=0;x<3;x++)
183                {
184                        for( y=0;y<10;y++)
185                        {
186                                if(CDebugSQLWin_ItemNum > y+x*10)
187                                {
188                                        if(CDebugSQLWin_Select+CDebugSQLWin_Top == y+x*10)
189                                                this->DrawBox32(this, 2+x*192, 84+2+y*30, 192-4, 30-4, CONV32_16(0xAA1C3923));
190                                        else
191                                                this->DrawBox32(this, 2+x*192, 84+2+y*30, 192-4, 30-4, CONV32_16(0xAAFFA52C));
192                                        this->DrawText(this, 2+x*192, 84+2+y*30, 192-4, 30-4,db_list[y+x*10].name,&(this->font));
193                                }
194                        }
195                }
196               
197        }
198
199//      virtual void Show()
200        void CDebugSQLWin_Show(CWindow *this)
201        {
202                CDebugSQLWin_DrawAll(this);
203        }       
204
205//              virtual void OnTimer(char nID)
206        void CDebugSQLWin_OnTimer(CWindow *this, char nID)
207        {
208                switch(nID)
209                {
210                        case 1:
211                                break;
212                        default: break;
213                }
214        }       
215
216//      virtual void KeyInput(DS_U8 key,bool)
217        void CDebugSQLWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
218        {
219                switch(key)
220                {
221                        case VK_PREV_CH:
222                        case VK_PREV:
223                        case VK_PREV_MENU:
224                        case VK_CANCEL:
225                                if (DST_GetWin(WIN_ENGINEER_MODE)==0) DST_CreateWin(WIN_ENGINEER_MODE, 0, 0, 0, 0, 0);
226                                this->Close(this);
227                                break;
228                        case VK_OK:
229                                g_no_list = db_list[CDebugSQLWin_Select+CDebugSQLWin_Top].list;
230                                DST_CreateWin(WIN_DEBUG_SQL_SUB, 0, 0, 0, 0, 0);
231                                this->SetVisible(this, false);
232                                break;
233                        case VK_RIGHT: break;
234                        case VK_LEFT: break;
235                        case VK_UP:
236                        case VK_DN:
237                                if(key == VK_DN)
238                                        ItemIncrease(CDebugSQLWin_ItemNum, CDebugSQLWin_ListNum, &CDebugSQLWin_Top, &CDebugSQLWin_Select, &CDebugSQLWin_Pos, 1);
239                                else
240                                        ItemDecrease(CDebugSQLWin_ItemNum, CDebugSQLWin_ListNum, &CDebugSQLWin_Top, &CDebugSQLWin_Select, &CDebugSQLWin_Pos, 1);
241                                CDebugSQLWin_Draw(this);
242                                break;
243                        default: break;
244                }
245        }
246//};
247
248
249void DST_CreateDebugSQLWin(SWinEventMsg event)
250{
251        CWindow*pWin = NewCWindow(event);
252        pWin->Destructor        = CDebugSQLWin_Destructor;
253        pWin->KeyInput          = CDebugSQLWin_KeyInput;
254        pWin->OnTimer           = CDebugSQLWin_OnTimer;
255        pWin->ShowWindow        = CDebugSQLWin_ShowWindow;
256        pWin->Show                      = CDebugSQLWin_Show;
257        // »ý¼ºÀÚ È£Ãâ
258        CDebugSQLWin_Constructor(pWin, event);
259        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
260        DST_AddWin((WinID)(event.data[0]), pWin);
261}
262
263//class CDebugSQLSubWin : public CWindow
264//{
265//private:
266        static DS_U16 CDebugSQLSubWin_RowPos;
267        static DS_U16 CDebugSQLSubWin_RowTop;
268        static DS_U16 CDebugSQLSubWin_RowSelect;
269        static DS_U16 CDebugSQLSubWin_RowListNum;
270        static DS_U16 CDebugSQLSubWin_RowItemNum;
271
272        static DS_U16 CDebugSQLSubWin_ColPos;
273        static DS_U16 CDebugSQLSubWin_ColTop;
274        static DS_U16 CDebugSQLSubWin_ColSelect;
275        static DS_U16 CDebugSQLSubWin_ColListNum;
276        static DS_U16 CDebugSQLSubWin_ColItemNum;
277
278        static DS_U16 CDebugSQLSubWin_pre_RowPos;
279        static DS_U16 CDebugSQLSubWin_pre_RowTop;
280        static DS_U16 CDebugSQLSubWin_pre_RowSelect;
281        static DS_U16 CDebugSQLSubWin_pre_RowListNum;
282        static int CDebugSQLSubWin_pre_RowItemNum;
283
284        static DS_U16 CDebugSQLSubWin_pre_ColPos;
285        static DS_U16 CDebugSQLSubWin_pre_ColTop;
286        static DS_U16 CDebugSQLSubWin_pre_ColSelect;
287        static DS_U16 CDebugSQLSubWin_pre_ColListNum;
288        static DS_U16 CDebugSQLSubWin_pre_ColItemNum;
289
290        static DBNAMES * CDebugSQLSubWin_results;
291        static ATTRIBUTES * CDebugSQLSubWin_attributes;
292//public:
293void CDebugSQLSubWin_InitValues(void);
294
295//      CDebugSQLSubWin(SWinEventMsg event):CWindow(event)
296        void CDebugSQLSubWin_Constructor(CWindow *this, SWinEventMsg event)
297        {
298                this->SetWinName(this,  "DebugSqlSub");
299                CDebugSQLSubWin_InitValues();
300                this->rect.w = 576;
301                this->rect.h = 384;
302                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
303                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
304
305                this->SetTimeOut(this, 0);
306
307                this->RegisterKey(this, VK_CANCEL, true, 0, 0);
308                this->RegisterKey(this, VK_PREV, true, 0, 0);
309                this->RegisterKey(this, VK_PREV_CH, true, 0, 0);
310                this->RegisterKey(this, VK_PREV_MENU, true, 0, 0);
311                this->RegisterKey(this, VK_OK, true, 0, 0);
312                this->RegisterKey(this, VK_RIGHT, true, 0, 0);
313                this->RegisterKey(this, VK_LEFT, true, 0, 0);
314                this->RegisterKey(this, VK_UP, true, 0, 0);
315                this->RegisterKey(this, VK_DN, true, 0, 0);
316
317        }
318
319        void CDebugSQLSubWin_Destructor(CWindow *this)
320        {
321                int i = 0;
322                int j = 0;
323                if (CDebugSQLSubWin_results)
324                {
325                        for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
326                        {
327                                for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
328                                {
329                                        if(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name)
330                                        DST_OS_Free(&CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);
331                                }
332                        }
333                        DST_OS_Free(&CDebugSQLSubWin_results);                 
334                }
335                if(CDebugSQLSubWin_attributes)
336                {
337//                      j = 0;
338//                      for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
339//                      {
340//                              DST_Printf("   %d\n",j);
341//                              if(CDebugSQLSubWin_attributes[j].name)  DST_OS_Free(&CDebugSQLSubWin_attributes[j].name);
342//                      }
343                        DST_OS_Free(&CDebugSQLSubWin_attributes);
344                }
345        }
346
347        void CDebugSQLSubWin_GetDBResult()
348        {
349                if(g_no_list >= NO_DB_MAX) return;
350                int i = 0;
351                int j = 0;
352                char tmp_str[4096];
353                DBLock(true);
354                switch(g_no_list)
355                {
356                        case NO_PAT:
357                                CDebugSQLSubWin_RowItemNum = 0;
358                                for(i = 0; i< DB_PAT_MAX ; i++)
359                                {
360                                        if(db_pat[i].program_number == 0) continue;
361                                        CDebugSQLSubWin_RowItemNum++;
362                                }
363                                CDebugSQLSubWin_ColItemNum = 4;
364                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
365                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
366
367                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
368                                CDebugSQLSubWin_attributes[0].type = 1;
369                                CDebugSQLSubWin_attributes[1].name = (char *)"program_number";
370                                CDebugSQLSubWin_attributes[1].type = 1;
371                                CDebugSQLSubWin_attributes[2].name = (char *)"pid";
372                                CDebugSQLSubWin_attributes[2].type = 1;
373                                CDebugSQLSubWin_attributes[3].name = (char *)"crc";
374                                CDebugSQLSubWin_attributes[3].type = 1;                         
375
376                                i = 0;
377                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
378                                {
379                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
380                                        {
381                                       
382                                                memset(tmp_str, 0 ,4096*sizeof(char));
383                                                switch(j)
384                                                {
385                                                        case 0: sprintf(tmp_str,"%d",db_pat[i].rf);     break;
386                                                        case 1: sprintf(tmp_str,"%d",db_pat[i].program_number); break;
387                                                        case 2: sprintf(tmp_str,"%d",db_pat[i].pid); break;
388                                                        case 3: sprintf(tmp_str,"%d",db_pat[i].crc); break;
389                                                        default: break;
390                                                               
391                                                }
392                                                if(tmp_str != 0)
393                                                {
394                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
395                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
396//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
397                                                }
398                                        }
399                                }
400                                break;
401                        case NO_PMT:
402                                CDebugSQLSubWin_RowItemNum = 0;
403                                for(i = 0; i< DB_PMT_MAX ; i++)
404                                {
405                                        if(db_pmt[i].program_number == 0) continue;
406                                        CDebugSQLSubWin_RowItemNum++;
407                                }
408                                CDebugSQLSubWin_ColItemNum = 8;
409                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
410                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
411
412                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
413                                CDebugSQLSubWin_attributes[0].type = 1;
414                                CDebugSQLSubWin_attributes[1].name = (char *)"program_number";
415                                CDebugSQLSubWin_attributes[1].type = 1;
416                                CDebugSQLSubWin_attributes[2].name = (char *)"pcr_pid";
417                                CDebugSQLSubWin_attributes[2].type = 1;
418                                CDebugSQLSubWin_attributes[3].name = (char *)"ca_pid";
419                                CDebugSQLSubWin_attributes[3].type = 1;         
420                                CDebugSQLSubWin_attributes[4].name = (char *)"video_pid";
421                                CDebugSQLSubWin_attributes[4].type = 1; 
422                                CDebugSQLSubWin_attributes[5].name = (char *)"video_type";
423                                CDebugSQLSubWin_attributes[5].type = 1;                                 
424                                CDebugSQLSubWin_attributes[6].name = (char *)"minor";
425                                CDebugSQLSubWin_attributes[6].type = 1; 
426                                CDebugSQLSubWin_attributes[7].name = (char *)"crc";
427                                CDebugSQLSubWin_attributes[7].type = 1; 
428
429                                i = 0;
430                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
431                                {
432                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
433                                        {
434                                       
435                                                memset(tmp_str, 0 ,4096*sizeof(char));
436                                                switch(j)
437                                                {
438                                                        case 0: sprintf(tmp_str,"%d",db_pmt[i].rf);     break;
439                                                        case 1: sprintf(tmp_str,"%d",db_pmt[i].program_number); break;
440                                                        case 2: sprintf(tmp_str,"%d",db_pmt[i].pcr_pid); break;
441                                                        case 3: sprintf(tmp_str,"%d",db_pmt[i].ca_pid); break;
442                                                        case 4: sprintf(tmp_str,"%d",db_pmt[i].video_pid);      break;
443                                                        case 5: sprintf(tmp_str,"%d",db_pmt[i].video_type);     break;
444                                                        case 6: sprintf(tmp_str,"%d",db_pmt[i].minor); break;
445                                                        case 7: sprintf(tmp_str,"%d",db_pmt[i].crc); break;                                                     
446                                                        default: break;
447                                                               
448                                                }
449                                                if(tmp_str != 0)
450                                                {
451                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
452                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
453//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
454                                                }
455                                        }
456                                }
457                                break; 
458#if EPG_SUPPORT                 
459                        case NO_EIT:
460                                CDebugSQLSubWin_RowItemNum = 0;
461                                for(i = 0; i< DB_EIT_MAX ; i++)
462                                {
463                                        if(db_eit[i].rf == 0 && db_eit[i].id == 0 && db_eit[i].source_id == 0 && db_eit[i].version_number == 0 && db_eit[i].crc == 0) continue;
464                                        CDebugSQLSubWin_RowItemNum++;
465                                }
466                                CDebugSQLSubWin_ColItemNum = 5;
467                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
468                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
469
470                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
471                                CDebugSQLSubWin_attributes[0].type = 1;
472                                CDebugSQLSubWin_attributes[1].name = (char *)"id";
473                                CDebugSQLSubWin_attributes[1].type = 1;
474                                CDebugSQLSubWin_attributes[2].name = (char *)"source_id";
475                                CDebugSQLSubWin_attributes[2].type = 1;
476                                CDebugSQLSubWin_attributes[3].name = (char *)"version_number";
477                                CDebugSQLSubWin_attributes[3].type = 1;                         
478                                CDebugSQLSubWin_attributes[4].name = (char *)"crc";
479                                CDebugSQLSubWin_attributes[4].type = 1; 
480
481                                i = 0;
482                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
483                                {
484                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
485                                        {
486                                       
487                                                memset(tmp_str, 0 ,4096*sizeof(char));
488                                                switch(j)
489                                                {
490                                                        case 0: sprintf(tmp_str,"%d",db_eit[i].rf);     break;
491                                                        case 1: sprintf(tmp_str,"%d",db_eit[i].id);     break;
492                                                        case 2: sprintf(tmp_str,"%d",db_eit[i].source_id); break;
493                                                        case 3: sprintf(tmp_str,"%d",db_eit[i].version_number); break;
494                                                        case 4: sprintf(tmp_str,"%d",db_eit[i].crc); break;
495                                                        default: break;
496                                                               
497                                                }
498                                                if(tmp_str != 0)
499                                                {
500                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
501                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
502//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
503                                                }
504                                        }
505                                }
506                                break;                         
507                        case NO_EIT_SUB:
508                                CDebugSQLSubWin_RowItemNum = 0;
509                                for(i = 0; i< DB_EIT_SUB_MAX ; i++)
510                                {
511                                        if(db_eit_sub[i].rf == 0 && db_eit_sub[i].id == 0 && db_eit_sub[i].source_id == 0 && db_eit_sub[i].event_id == 0 &&
512                                                db_eit_sub[i].start_time == 0 && db_eit_sub[i].length_in_seconds == 0 && db_eit_sub[i].title==0?true:(strlen(db_eit_sub[i].title) == 0)?true:false) continue;
513                                        CDebugSQLSubWin_RowItemNum++;
514                                }
515                                CDebugSQLSubWin_ColItemNum = 7;
516                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
517                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
518
519                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
520                                CDebugSQLSubWin_attributes[0].type = 1;
521                                CDebugSQLSubWin_attributes[1].name = (char *)"id";
522                                CDebugSQLSubWin_attributes[1].type = 1;
523                                CDebugSQLSubWin_attributes[2].name = (char *)"source_id";
524                                CDebugSQLSubWin_attributes[2].type = 1;
525                                CDebugSQLSubWin_attributes[3].name = (char *)"event_id";
526                                CDebugSQLSubWin_attributes[3].type = 1;                         
527                                CDebugSQLSubWin_attributes[4].name = (char *)"start_time";
528                                CDebugSQLSubWin_attributes[4].type = 1; 
529                                CDebugSQLSubWin_attributes[5].name = (char *)"length_in_seconds";
530                                CDebugSQLSubWin_attributes[5].type = 1; 
531                                CDebugSQLSubWin_attributes[6].name = (char *)"title";
532                                CDebugSQLSubWin_attributes[6].type = 0; 
533
534                                i = 0;
535                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
536                                {
537                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
538                                        {
539                                       
540                                                memset(tmp_str, 0 ,4096*sizeof(char));
541                                                switch(j)
542                                                {
543                                                        case 0: sprintf(tmp_str,"%d",db_eit_sub[i].rf); break;
544                                                        case 1: sprintf(tmp_str,"%d",db_eit_sub[i].id); break;
545                                                        case 2: sprintf(tmp_str,"%d",db_eit_sub[i].source_id); break;
546                                                        case 3: sprintf(tmp_str,"%d",db_eit_sub[i].event_id); break;
547                                                        case 4: sprintf(tmp_str,"%d",db_eit_sub[i].start_time); break;
548                                                        case 5: sprintf(tmp_str,"%d",db_eit_sub[i].length_in_seconds); break;
549                                                        case 6: sprintf(tmp_str,"%s",db_eit_sub[i].title); break;
550                                                        default: break;
551                                                               
552                                                }
553                                                if(tmp_str != 0)
554                                                {
555                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
556                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
557//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
558                                                }
559                                        }
560                                }
561                                break;                         
562                        case NO_ETT:
563                                CDebugSQLSubWin_RowItemNum = 0;
564                                for(i = 0; i< DB_ETT_MAX ; i++)
565                                {
566                                        if(db_ett[i].rf == 0 && db_ett[i].source_id == 0 && db_ett[i].event_id == 0 && db_ett[i].title==0?true:(strlen(db_ett[i].title) == 0)?true:false  && db_ett[i].crc == 0) continue;
567                                        CDebugSQLSubWin_RowItemNum++;
568                                }
569                                CDebugSQLSubWin_ColItemNum = 5;
570                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
571                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
572
573                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
574                                CDebugSQLSubWin_attributes[0].type = 1;
575                                CDebugSQLSubWin_attributes[1].name = (char *)"source_id";
576                                CDebugSQLSubWin_attributes[1].type = 1;
577                                CDebugSQLSubWin_attributes[2].name = (char *)"event_id";
578                                CDebugSQLSubWin_attributes[2].type = 1;
579                                CDebugSQLSubWin_attributes[3].name = (char *)"title";
580                                CDebugSQLSubWin_attributes[3].type = 0;                         
581                                CDebugSQLSubWin_attributes[4].name = (char *)"crc";
582                                CDebugSQLSubWin_attributes[4].type = 1;         
583
584                                i = 0;
585                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
586                                {
587                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
588                                        {
589                                       
590                                                memset(tmp_str, 0 ,4096*sizeof(char));
591                                                switch(j)
592                                                {
593                                                        case 0: sprintf(tmp_str,"%d",db_ett[i].rf);     break;
594                                                        case 1: sprintf(tmp_str,"%d",db_ett[i].source_id);      break;
595                                                        case 2: sprintf(tmp_str,"%d",db_ett[i].event_id); break;
596                                                        case 3: sprintf(tmp_str,"%s",db_ett[i].title); break;
597                                                        case 4: sprintf(tmp_str,"%d",db_ett[i].crc); break;
598                                                        default: break;
599                                                               
600                                                }
601                                                if(tmp_str != 0)
602                                                {
603                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
604                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
605//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
606                                                }
607                                        }
608                                }
609                                break; 
610#endif
611#if SUPPORT_CHANNEL_EDIT
612                        case NO_SKIP_LIST:
613                                CDebugSQLSubWin_RowItemNum = 0;
614                                for(i = 0; i< DB_SKIP_LIST_MAX ; i++)
615                                {
616                                        if(db_skip_list[i].minor == 0 && db_skip_list[i].major == 0 ) continue;
617                                        CDebugSQLSubWin_RowItemNum++;
618                                }
619                                CDebugSQLSubWin_ColItemNum = 2;
620                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
621                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
622
623                                CDebugSQLSubWin_attributes[0].name = (char *)"Minor";
624                                CDebugSQLSubWin_attributes[0].type = 1;
625                                CDebugSQLSubWin_attributes[1].name = (char *)"Major";
626                                CDebugSQLSubWin_attributes[1].type = 1;
627
628                                i = 0;
629                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
630                                {
631                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
632                                        {
633                                       
634                                                memset(tmp_str, 0 ,4096*sizeof(char));
635                                                switch(j)
636                                                {
637                                                        case 0: sprintf(tmp_str,"%d",db_skip_list[i].minor);    break;
638                                                        case 1: sprintf(tmp_str,"%d",db_skip_list[i].major);    break;
639                                                        default: break;
640                                                               
641                                                }
642                                                if(tmp_str != 0)
643                                                {
644                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
645                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
646//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
647                                                }
648                                        }
649                                }
650                                break;         
651#endif 
652#if CVCT_SUPPORT       
653                        case NO_CVCT:
654                                CDebugSQLSubWin_RowItemNum = 0;
655                                for(i = 0; i< DB_CVCT_MAX ; i++)
656                                {
657                                        if(db_cvct[i].rf == 0 && db_cvct[i].transport_stream_id == 0 && db_cvct[i].version_number == 0 && db_cvct[i].crc == 0) continue;
658                                        CDebugSQLSubWin_RowItemNum++;
659                                }
660                                CDebugSQLSubWin_ColItemNum = 4;
661                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
662                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
663
664                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
665                                CDebugSQLSubWin_attributes[0].type = 1;
666                                CDebugSQLSubWin_attributes[1].name = (char *)"transport_stream_id";
667                                CDebugSQLSubWin_attributes[1].type = 1;
668                                CDebugSQLSubWin_attributes[2].name = (char *)"version_number";
669                                CDebugSQLSubWin_attributes[2].type = 1;
670                                CDebugSQLSubWin_attributes[3].name = (char *)"crc";
671                                CDebugSQLSubWin_attributes[3].type = 1;                         
672
673                                i = 0;
674                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
675                                {
676                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
677                                        {
678                                       
679                                                memset(tmp_str, 0 ,4096*sizeof(char));
680                                                switch(j)
681                                                {
682                                                        case 0: sprintf(tmp_str,"%d",db_cvct[i].rf);    break;
683                                                        case 1: sprintf(tmp_str,"%d",db_cvct[i].transport_stream_id);   break;
684                                                        case 2: sprintf(tmp_str,"%d",db_cvct[i].version_number); break;
685                                                        case 3: sprintf(tmp_str,"%d",db_cvct[i].crc); break;
686                                                        default: break;
687                                                               
688                                                }
689                                                if(tmp_str != 0)
690                                                {
691                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
692                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
693//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
694                                                }
695                                        }
696                                }
697                                break;                         
698                        case NO_CVCT_SUB:
699                                CDebugSQLSubWin_RowItemNum = 0;
700                                for(i = 0; i< DB_CVCT_SUB_MAX ; i++)
701                                {
702                                        if(db_cvct_sub[i].rf == 0 && db_cvct_sub[i].short_name==0?true:(strlen(db_cvct_sub[i].short_name) == 0)?true:false && db_cvct_sub[i].long_name==0?true:(strlen(db_cvct_sub[i].long_name) == 0)?true:false && db_cvct_sub[i].major_channel_number == 0 &&
703                                                db_cvct_sub[i].minor_channel_number == 0 && db_cvct_sub[i].modulation_mode== 0 && db_cvct_sub[i].carrier_frequency== 0 && db_cvct_sub[i].channel_TSID == 0 &&
704                                                db_cvct_sub[i].program_number == 0 && db_cvct_sub[i].ETM_location == 0 && db_cvct_sub[i].access_controlled == 0 && db_cvct_sub[i].hidden == 0 &&
705                                                db_cvct_sub[i].show_guide == 0 && db_cvct_sub[i].service_type == 0 && db_cvct_sub[i].source_id == 0 ) continue;
706                                        CDebugSQLSubWin_RowItemNum++;
707                                }
708                                CDebugSQLSubWin_ColItemNum = 15;
709                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
710                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
711
712                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
713                                CDebugSQLSubWin_attributes[0].type = 1;
714                                CDebugSQLSubWin_attributes[1].name = (char *)"short_name";
715                                CDebugSQLSubWin_attributes[1].type = 0;
716                                CDebugSQLSubWin_attributes[2].name = (char *)"long_name";
717                                CDebugSQLSubWin_attributes[2].type = 0;
718                                CDebugSQLSubWin_attributes[3].name = (char *)"major_channel_number";
719                                CDebugSQLSubWin_attributes[3].type = 1;                         
720                                CDebugSQLSubWin_attributes[4].name = (char *)"minor_channel_number";
721                                CDebugSQLSubWin_attributes[4].type = 1;
722                                CDebugSQLSubWin_attributes[5].name = (char *)"modulation_mode";
723                                CDebugSQLSubWin_attributes[5].type = 1;
724                                CDebugSQLSubWin_attributes[6].name = (char *)"carrier_frequency";
725                                CDebugSQLSubWin_attributes[6].type = 1;
726                                CDebugSQLSubWin_attributes[7].name = (char *)"channel_TSID";
727                                CDebugSQLSubWin_attributes[7].type = 1; 
728                                CDebugSQLSubWin_attributes[8].name = (char *)"program_number";
729                                CDebugSQLSubWin_attributes[8].type = 1;
730                                CDebugSQLSubWin_attributes[9].name = (char *)"ETM_location";
731                                CDebugSQLSubWin_attributes[9].type = 1;
732                                CDebugSQLSubWin_attributes[10].name = (char *)"access_controlled";
733                                CDebugSQLSubWin_attributes[10].type = 1;
734                                CDebugSQLSubWin_attributes[11].name = (char *)"hidden";
735                                CDebugSQLSubWin_attributes[11].type = 1;       
736                                CDebugSQLSubWin_attributes[12].name = (char *)"show_guide";
737                                CDebugSQLSubWin_attributes[12].type = 1;
738                                CDebugSQLSubWin_attributes[13].name = (char *)"service_type";
739                                CDebugSQLSubWin_attributes[13].type = 1;
740                                CDebugSQLSubWin_attributes[14].name = (char *)"source_id";
741                                CDebugSQLSubWin_attributes[14].type = 1;
742
743                                i = 0;
744                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
745                                {
746                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
747                                        {
748                                       
749                                                memset(tmp_str, 0 ,4096*sizeof(char));
750                                                switch(j)
751                                                {
752                                                        case 0: sprintf(tmp_str,"%d",db_cvct_sub[i].rf);        break;
753                                                        case 1: sprintf(tmp_str,"%s",db_cvct_sub[i].short_name);        break;
754                                                        case 2: sprintf(tmp_str,"%s",db_cvct_sub[i].long_name); break;
755                                                        case 3: sprintf(tmp_str,"%d",db_cvct_sub[i].major_channel_number); break;
756                                                        case 4: sprintf(tmp_str,"%d",db_cvct_sub[i].minor_channel_number);      break;
757                                                        case 5: sprintf(tmp_str,"%d",db_cvct_sub[i].modulation_mode);   break;
758                                                        case 6: sprintf(tmp_str,"%d",db_cvct_sub[i].carrier_frequency); break;
759                                                        case 7: sprintf(tmp_str,"%d",db_cvct_sub[i].channel_TSID); break;
760                                                        case 8: sprintf(tmp_str,"%d",db_cvct_sub[i].program_number);    break;
761                                                        case 9: sprintf(tmp_str,"%d",db_cvct_sub[i].ETM_location);      break;
762                                                        case 10: sprintf(tmp_str,"%d",db_cvct_sub[i].access_controlled); break;
763                                                        case 11: sprintf(tmp_str,"%d",db_cvct_sub[i].hidden); break;
764                                                        case 12: sprintf(tmp_str,"%d",db_cvct_sub[i].show_guide);       break;
765                                                        case 13: sprintf(tmp_str,"%d",db_cvct_sub[i].service_type);     break;
766                                                        case 14: sprintf(tmp_str,"%d",db_cvct_sub[i].source_id); break;
767
768                                                        default: break;
769                                                               
770                                                }
771                                                if(tmp_str != 0)
772                                                {
773                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
774                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
775//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
776                                                }
777                                        }
778                                }
779                                break; 
780#endif                 
781                        case NO_TVCT:
782                                CDebugSQLSubWin_RowItemNum = 0;
783                                for(i = 0; i< DB_TVCT_MAX ; i++)
784                                {
785                                        if(db_tvct[i].crc == 0) continue;
786                                        CDebugSQLSubWin_RowItemNum++;
787                                }
788                                CDebugSQLSubWin_ColItemNum = 4;
789                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
790                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
791
792                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
793                                CDebugSQLSubWin_attributes[0].type = 1;
794                                CDebugSQLSubWin_attributes[1].name = (char *)"transport_stream_id";
795                                CDebugSQLSubWin_attributes[1].type = 1;
796                                CDebugSQLSubWin_attributes[2].name = (char *)"version_number";
797                                CDebugSQLSubWin_attributes[2].type = 1;
798                                CDebugSQLSubWin_attributes[3].name = (char *)"crc";
799                                CDebugSQLSubWin_attributes[3].type = 1;                         
800
801                                i = 0;
802                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
803                                {
804                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
805                                        {
806                                       
807                                                memset(tmp_str, 0 ,4096*sizeof(char));
808                                                switch(j)
809                                                {
810                                                        case 0: sprintf(tmp_str,"%d",db_tvct[i].rf);    break;
811                                                        case 1: sprintf(tmp_str,"%d",db_tvct[i].transport_stream_id);   break;
812                                                        case 2: sprintf(tmp_str,"%d",db_tvct[i].version_number); break;
813                                                        case 3: sprintf(tmp_str,"%d",db_tvct[i].crc); break;
814                                                        default: break;
815                                                               
816                                                }
817                                                if(tmp_str != 0)
818                                                {
819                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
820                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
821//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
822                                                }
823                                        }
824                                }
825                                break;                         
826                        case NO_TVCT_SUB:
827                                CDebugSQLSubWin_RowItemNum = 0;
828                                for(i = 0; i< DB_TVCT_SUB_MAX ; i++)
829                                {
830                                        if(db_tvct_sub[i].program_number == 0) continue;
831                                        CDebugSQLSubWin_RowItemNum++;
832                                }
833                                CDebugSQLSubWin_ColItemNum = 15;
834                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
835                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
836
837                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
838                                CDebugSQLSubWin_attributes[0].type = 1;
839                                CDebugSQLSubWin_attributes[1].name = (char *)"short_name";
840                                CDebugSQLSubWin_attributes[1].type = 0;
841                                CDebugSQLSubWin_attributes[2].name = (char *)"long_name";
842                                CDebugSQLSubWin_attributes[2].type = 0;
843                                CDebugSQLSubWin_attributes[3].name = (char *)"major_channel_number";
844                                CDebugSQLSubWin_attributes[3].type = 1;                         
845                                CDebugSQLSubWin_attributes[4].name = (char *)"minor_channel_number";
846                                CDebugSQLSubWin_attributes[4].type = 1;
847                                CDebugSQLSubWin_attributes[5].name = (char *)"modulation_mode";
848                                CDebugSQLSubWin_attributes[5].type = 1;
849                                CDebugSQLSubWin_attributes[6].name = (char *)"carrier_frequency";
850                                CDebugSQLSubWin_attributes[6].type = 1;
851                                CDebugSQLSubWin_attributes[7].name = (char *)"channel_TSID";
852                                CDebugSQLSubWin_attributes[7].type = 1; 
853                                CDebugSQLSubWin_attributes[8].name = (char *)"program_number";
854                                CDebugSQLSubWin_attributes[8].type = 1;
855                                CDebugSQLSubWin_attributes[9].name = (char *)"ETM_location";
856                                CDebugSQLSubWin_attributes[9].type = 1;
857                                CDebugSQLSubWin_attributes[10].name = (char *)"access_controlled";
858                                CDebugSQLSubWin_attributes[10].type = 1;
859                                CDebugSQLSubWin_attributes[11].name = (char *)"hidden";
860                                CDebugSQLSubWin_attributes[11].type = 1;       
861                                CDebugSQLSubWin_attributes[12].name = (char *)"show_guide";
862                                CDebugSQLSubWin_attributes[12].type = 1;
863                                CDebugSQLSubWin_attributes[13].name = (char *)"service_type";
864                                CDebugSQLSubWin_attributes[13].type = 1;
865                                CDebugSQLSubWin_attributes[14].name = (char *)"source_id";
866                                CDebugSQLSubWin_attributes[14].type = 1;
867
868                                i = 0;
869                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
870                                {
871                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
872                                        {
873                                       
874                                                memset(tmp_str, 0 ,4096*sizeof(char));
875                                                switch(j)
876                                                {
877                                                        case 0: sprintf(tmp_str,"%d",db_tvct_sub[i].rf);        break;
878                                                        case 1: sprintf(tmp_str,"%s",db_tvct_sub[i].short_name);        break;
879                                                        case 2: sprintf(tmp_str,"%s",db_tvct_sub[i].long_name); break;
880                                                        case 3: sprintf(tmp_str,"%d",db_tvct_sub[i].major_channel_number); break;
881                                                        case 4: sprintf(tmp_str,"%d",db_tvct_sub[i].minor_channel_number);      break;
882                                                        case 5: sprintf(tmp_str,"%d",db_tvct_sub[i].modulation_mode);   break;
883                                                        case 6: sprintf(tmp_str,"%d",db_tvct_sub[i].carrier_frequency); break;
884                                                        case 7: sprintf(tmp_str,"%d",db_tvct_sub[i].channel_TSID); break;
885                                                        case 8: sprintf(tmp_str,"%d",db_tvct_sub[i].program_number);    break;
886                                                        case 9: sprintf(tmp_str,"%d",db_tvct_sub[i].ETM_location);      break;
887                                                        case 10: sprintf(tmp_str,"%d",db_tvct_sub[i].access_controlled); break;
888                                                        case 11: sprintf(tmp_str,"%d",db_tvct_sub[i].hidden); break;
889                                                        case 12: sprintf(tmp_str,"%d",db_tvct_sub[i].show_guide);       break;
890                                                        case 13: sprintf(tmp_str,"%d",db_tvct_sub[i].service_type);     break;
891                                                        case 14: sprintf(tmp_str,"%d",db_tvct_sub[i].source_id); break;
892
893                                                        default: break;
894                                                               
895                                                }
896                                                if(tmp_str != 0)
897                                                {
898                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
899                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
900//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
901                                                }
902                                        }
903                                }
904                                break;
905                        case NO_CONFIG:
906                                CDebugSQLSubWin_RowItemNum = 0;
907                                for(i = 0; i< DB_CONFIG_MAX ; i++)
908                                {
909                                        if(db_config[i].name==0?true:(strlen(db_config[i].name) == 0)?true:false && db_config[i].value == 0 ) continue;
910                                        CDebugSQLSubWin_RowItemNum++;
911                                }
912                                CDebugSQLSubWin_ColItemNum = 2;
913                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
914                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
915
916                                CDebugSQLSubWin_attributes[0].name = (char *)"name";
917                                CDebugSQLSubWin_attributes[0].type = 0;
918                                CDebugSQLSubWin_attributes[1].name = (char *)"value";
919                                CDebugSQLSubWin_attributes[1].type = 1;
920
921                                i = 0;
922                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
923                                {
924                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
925                                        {
926                                       
927                                                memset(tmp_str, 0 ,4096*sizeof(char));
928                                                switch(j)
929                                                {
930                                                        case 0: sprintf(tmp_str,"%s",db_config[i].name);        break;
931                                                        case 1: sprintf(tmp_str,"%d",db_config[i].value);       break;
932                                                        default: break;
933                                                               
934                                                }
935                                                if(tmp_str != 0)
936                                                {
937                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
938                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
939//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
940                                                }
941                                        }
942                                }
943                                break;                         
944                        case NO_CHANNEL_DB:
945                                CDebugSQLSubWin_RowItemNum = 0;
946                                for(i = 0; i< DB_CHANNEL_DB_MAX ; i++)
947                                {
948                                        if(db_channel_db[i].program_number == 0) continue;
949                                        CDebugSQLSubWin_RowItemNum++;
950                                }
951                                CDebugSQLSubWin_ColItemNum = 9;
952                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
953                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
954
955                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
956                                CDebugSQLSubWin_attributes[0].type = 1;
957                                CDebugSQLSubWin_attributes[1].name = (char *)"name";
958                                CDebugSQLSubWin_attributes[1].type = 0;
959                                CDebugSQLSubWin_attributes[2].name = (char *)"major";
960                                CDebugSQLSubWin_attributes[2].type = 1;
961                                CDebugSQLSubWin_attributes[3].name = (char *)"minor";
962                                CDebugSQLSubWin_attributes[3].type = 1;                         
963                                CDebugSQLSubWin_attributes[4].name = (char *)"program_number";
964                                CDebugSQLSubWin_attributes[4].type = 1;
965                                CDebugSQLSubWin_attributes[5].name = (char *)"source_id";
966                                CDebugSQLSubWin_attributes[5].type = 1;
967                                CDebugSQLSubWin_attributes[6].name = (char *)"pcr_pid";
968                                CDebugSQLSubWin_attributes[6].type = 1;
969                                CDebugSQLSubWin_attributes[7].name = (char *)"video_pid";
970                                CDebugSQLSubWin_attributes[7].type = 1;         
971                                CDebugSQLSubWin_attributes[8].name = (char *)"video_type";
972                                CDebugSQLSubWin_attributes[8].type = 1; 
973
974                                i = 0;
975                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
976                                {
977                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
978                                        {
979                                       
980                                                memset(tmp_str, 0 ,4096*sizeof(char));
981                                                switch(j)
982                                                {
983                                                        case 0: sprintf(tmp_str,"%d",db_channel_db[i].rf);      break;
984                                                        case 1: sprintf(tmp_str,"%s",db_channel_db[i].name);    break;
985                                                        case 2: sprintf(tmp_str,"%d",db_channel_db[i].major); break;
986                                                        case 3: sprintf(tmp_str,"%d",db_channel_db[i].minor); break;
987                                                        case 4: sprintf(tmp_str,"%d",db_channel_db[i].program_number);  break;
988                                                        case 5: sprintf(tmp_str,"%d",db_channel_db[i].source_id);       break;
989                                                        case 6: sprintf(tmp_str,"%d",db_channel_db[i].pcr_pid); break;
990                                                        case 7: sprintf(tmp_str,"%d",db_channel_db[i].video_pid); break;
991                                                        case 8: sprintf(tmp_str,"%d",db_channel_db[i].video_type); break;
992                                                        default: break;
993                                                               
994                                                }
995                                                if(tmp_str != 0)
996                                                {
997                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
998                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
999//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
1000                                                }
1001                                        }
1002                                }
1003                                break;                         
1004                        case NO_CHANNEL_UPDN:
1005                                CDebugSQLSubWin_RowItemNum = 0;
1006                                for(i = 0; i< DB_CHANNEL_UPDN_MAX ; i++)
1007                                {
1008                                        if(db_channel_updn[i].program_number == 0) continue;
1009                                        CDebugSQLSubWin_RowItemNum++;
1010                                }
1011                                CDebugSQLSubWin_ColItemNum = 4;
1012                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
1013                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
1014
1015                                CDebugSQLSubWin_attributes[0].name = (char *)"major";
1016                                CDebugSQLSubWin_attributes[0].type = 1;
1017                                CDebugSQLSubWin_attributes[1].name = (char *)"rf";
1018                                CDebugSQLSubWin_attributes[1].type = 1;
1019                                CDebugSQLSubWin_attributes[2].name = (char *)"minor";
1020                                CDebugSQLSubWin_attributes[2].type = 1;
1021                                CDebugSQLSubWin_attributes[3].name = (char *)"program_number";
1022                                CDebugSQLSubWin_attributes[3].type = 1;                         
1023
1024                                i = 0;
1025                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
1026                                {
1027                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
1028                                        {
1029                                       
1030                                                memset(tmp_str, 0 ,4096*sizeof(char));
1031                                                switch(j)
1032                                                {
1033                                                        case 0: sprintf(tmp_str,"%d",db_channel_updn[i].major); break;
1034                                                        case 1: sprintf(tmp_str,"%d",db_channel_updn[i].rf);    break;
1035                                                        case 2: sprintf(tmp_str,"%d",db_channel_updn[i].minor); break;
1036                                                        case 3: sprintf(tmp_str,"%d",db_channel_updn[i].program_number); break;
1037                                                        default: break;
1038                                                               
1039                                                }
1040                                                if(tmp_str != 0)
1041                                                {
1042                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
1043                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
1044//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
1045                                                }
1046                                        }
1047                                }
1048                                break;         
1049                        case NO_PMT_CC_TABLE:
1050                                CDebugSQLSubWin_RowItemNum = 0;
1051                                for(i = 0; i< MAX_PMT_AC3_TABLE_COUNT ; i++)
1052                                {
1053                                        if(pmt_cc_table[i].program_number == 0) continue;
1054                                        CDebugSQLSubWin_RowItemNum++;
1055                                }
1056                                CDebugSQLSubWin_ColItemNum = 8;
1057                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
1058                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
1059
1060                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
1061                                CDebugSQLSubWin_attributes[0].type = 1;
1062                                CDebugSQLSubWin_attributes[1].name = (char *)"program_number";
1063                                CDebugSQLSubWin_attributes[1].type = 1;
1064                                CDebugSQLSubWin_attributes[2].name = (char *)"language";
1065                                CDebugSQLSubWin_attributes[2].type = 0;
1066                                CDebugSQLSubWin_attributes[3].name = (char *)"cc_type";
1067                                CDebugSQLSubWin_attributes[3].type = 1;                         
1068                                CDebugSQLSubWin_attributes[4].name = (char *)"cc_id";
1069                                CDebugSQLSubWin_attributes[4].type = 1;
1070                                CDebugSQLSubWin_attributes[5].name = (char *)"easy_reader";
1071                                CDebugSQLSubWin_attributes[5].type = 1;
1072                                CDebugSQLSubWin_attributes[6].name = (char *)"wide_aspect_ratio";
1073                                CDebugSQLSubWin_attributes[6].type = 1;
1074                                CDebugSQLSubWin_attributes[7].name = (char *)"korean_code";
1075                                CDebugSQLSubWin_attributes[7].type = 1; 
1076
1077                                i = 0;
1078                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
1079                                {
1080                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
1081                                        {
1082                                       
1083                                                memset(tmp_str, 0 ,4096*sizeof(char));
1084                                                switch(j)
1085                                                {
1086                                                        case 0: sprintf(tmp_str,"%d",pmt_cc_table[i].rf);       break;
1087                                                        case 1: sprintf(tmp_str,"%d",pmt_cc_table[i].program_number);   break;
1088                                                        case 2: sprintf(tmp_str,"%s",pmt_cc_table[i].language); break;
1089                                                        case 3: sprintf(tmp_str,"%d",pmt_cc_table[i].cc_type); break;                                                   
1090                                                        case 4: sprintf(tmp_str,"%d",pmt_cc_table[i].cc_id);    break;
1091                                                        case 5: sprintf(tmp_str,"%d",pmt_cc_table[i].easy_reader);      break;
1092                                                        case 6: sprintf(tmp_str,"%d",pmt_cc_table[i].wide_aspect_ratio); break;
1093                                                        case 7: sprintf(tmp_str,"%d",pmt_cc_table[i].korean_code); break;
1094
1095                                                        default: break;
1096                                                               
1097                                                }
1098                                                if(tmp_str != 0)
1099                                                {
1100                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
1101                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
1102//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
1103                                                }
1104                                        }
1105                                }
1106                                break;         
1107                        case NO_PMT_AC3_TABLE:
1108                                CDebugSQLSubWin_RowItemNum = 0;
1109                                for(i = 0; i< MAX_PMT_AC3_TABLE_COUNT ; i++)
1110                                {
1111                                        if(pmt_ac3_table[i].program_number == 0) continue;
1112                                        CDebugSQLSubWin_RowItemNum++;
1113                                }
1114                                CDebugSQLSubWin_ColItemNum = 7;
1115                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
1116                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
1117
1118                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
1119                                CDebugSQLSubWin_attributes[0].type = 1;
1120                                CDebugSQLSubWin_attributes[1].name = (char *)"program_number";
1121                                CDebugSQLSubWin_attributes[1].type = 1;
1122                                CDebugSQLSubWin_attributes[2].name = (char *)"pid";
1123                                CDebugSQLSubWin_attributes[2].type = 1;
1124                                CDebugSQLSubWin_attributes[3].name = (char *)"bsmod";
1125                                CDebugSQLSubWin_attributes[3].type = 1;                         
1126                                CDebugSQLSubWin_attributes[4].name = (char *)"full_syc";
1127                                CDebugSQLSubWin_attributes[4].type = 1;
1128                                CDebugSQLSubWin_attributes[5].name = (char *)"langcod";
1129                                CDebugSQLSubWin_attributes[5].type = 1;
1130                                CDebugSQLSubWin_attributes[6].name = (char *)"language";
1131                                CDebugSQLSubWin_attributes[6].type = 0;
1132
1133                                i = 0;
1134                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
1135                                {
1136                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
1137                                        {
1138                                       
1139                                                memset(tmp_str, 0 ,4096*sizeof(char));
1140                                                switch(j)
1141                                                {
1142                                                        case 0: sprintf(tmp_str,"%d",pmt_ac3_table[i].rf);      break;
1143                                                        case 1: sprintf(tmp_str,"%d",pmt_ac3_table[i].program_number);  break;
1144                                                        case 2: sprintf(tmp_str,"%d",pmt_ac3_table[i].pid); break;
1145                                                        case 3: sprintf(tmp_str,"%d",pmt_ac3_table[i].bsmod); break;                                                   
1146                                                        case 4: sprintf(tmp_str,"%d",pmt_ac3_table[i].full_svc);        break;
1147                                                        case 5: sprintf(tmp_str,"%d",pmt_ac3_table[i].langcod); break;
1148                                                        case 6: sprintf(tmp_str,"%s",pmt_ac3_table[i].language);        break;
1149
1150                                                        default: break;
1151                                                               
1152                                                }
1153                                                if(tmp_str != 0)
1154                                                {
1155                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
1156                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
1157//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
1158                                                }
1159                                        }
1160                                }
1161                                break;         
1162                        case NO_PMT_ISO_TABLE:
1163                                CDebugSQLSubWin_RowItemNum = 0;
1164                                for(i = 0; i< MAX_PMT_ISO_TABLE_COUNT ; i++)
1165                                {
1166                                        if(pmt_iso_table[i].program_number == 0) continue;
1167                                        CDebugSQLSubWin_RowItemNum++;
1168                                }
1169                                CDebugSQLSubWin_ColItemNum = 5;
1170                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
1171                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
1172
1173                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
1174                                CDebugSQLSubWin_attributes[0].type = 1;
1175                                CDebugSQLSubWin_attributes[1].name = (char *)"program_number";
1176                                CDebugSQLSubWin_attributes[1].type = 1;
1177                                CDebugSQLSubWin_attributes[2].name = (char *)"pid";
1178                                CDebugSQLSubWin_attributes[2].type = 1;
1179                                CDebugSQLSubWin_attributes[3].name = (char *)"lang";
1180                                CDebugSQLSubWin_attributes[3].type = 0;                         
1181                                CDebugSQLSubWin_attributes[4].name = (char *)"type";
1182                                CDebugSQLSubWin_attributes[4].type = 1;
1183
1184                                i = 0;
1185                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
1186                                {
1187                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
1188                                        {
1189                                       
1190                                                memset(tmp_str, 0 ,4096*sizeof(char));
1191                                                switch(j)
1192                                                {
1193                                                        case 0: sprintf(tmp_str,"%d",pmt_iso_table[i].rf);      break;
1194                                                        case 1: sprintf(tmp_str,"%d",pmt_iso_table[i].program_number);  break;
1195                                                        case 2: sprintf(tmp_str,"%d",pmt_iso_table[i].pid); break;
1196                                                        case 3: sprintf(tmp_str,"%s",pmt_iso_table[i].lang); break;                                                     
1197                                                        case 4: sprintf(tmp_str,"%d",pmt_iso_table[i].type);    break;
1198
1199                                                        default: break;
1200                                                               
1201                                                }
1202                                                if(tmp_str != 0)
1203                                                {
1204                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
1205                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
1206//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
1207                                                }
1208                                        }
1209                                }
1210                                break;         
1211                        case NO_PMT_AUDIO_TABLE:
1212                                CDebugSQLSubWin_RowItemNum = 0;
1213                                for(i = 0; i< MAX_PMT_AUDIO_TABLE_COUNT ; i++)
1214                                {
1215                                        if(pmt_audio_table[i].program_number == 0) continue;
1216                                        CDebugSQLSubWin_RowItemNum++;
1217                                }
1218                                CDebugSQLSubWin_ColItemNum = 5;
1219                                CDebugSQLSubWin_results = (DBNAMES *)DST_OS_Calloc(sizeof(DBNAMES), CDebugSQLSubWin_RowItemNum*CDebugSQLSubWin_ColItemNum);
1220                                CDebugSQLSubWin_attributes = (ATTRIBUTES *)DST_OS_Calloc(sizeof(ATTRIBUTES), CDebugSQLSubWin_ColItemNum);                       
1221
1222                                CDebugSQLSubWin_attributes[0].name = (char *)"rf";
1223                                CDebugSQLSubWin_attributes[0].type = 1;
1224                                CDebugSQLSubWin_attributes[1].name = (char *)"program_number";
1225                                CDebugSQLSubWin_attributes[1].type = 1;
1226                                CDebugSQLSubWin_attributes[2].name = (char *)"pid";
1227                                CDebugSQLSubWin_attributes[2].type = 1;
1228                                CDebugSQLSubWin_attributes[3].name = (char *)"type";
1229                                CDebugSQLSubWin_attributes[3].type = 1;                         
1230                                CDebugSQLSubWin_attributes[4].name = (char *)"component_tag";
1231                                CDebugSQLSubWin_attributes[4].type = 1;
1232
1233                                i = 0;
1234                                for( i=0;i<CDebugSQLSubWin_RowItemNum;i++)
1235                                {
1236                                        for( j=0;j<CDebugSQLSubWin_ColItemNum;j++)
1237                                        {
1238                                       
1239                                                memset(tmp_str, 0 ,4096*sizeof(char));
1240                                                switch(j)
1241                                                {
1242                                                        case 0: sprintf(tmp_str,"%d",pmt_audio_table[i].rf);    break;
1243                                                        case 1: sprintf(tmp_str,"%d",pmt_audio_table[i].program_number);        break;
1244                                                        case 2: sprintf(tmp_str,"%d",pmt_audio_table[i].pid); break;
1245                                                        case 3: sprintf(tmp_str,"%d",pmt_audio_table[i].type); break;                                                   
1246                                                        case 4: sprintf(tmp_str,"%d",pmt_audio_table[i].component_tag); break;
1247
1248                                                        default: break;
1249                                                               
1250                                                }
1251                                                if(tmp_str != 0)
1252                                                {
1253                                                        CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name = (char*)DST_OS_Calloc((strlen(tmp_str)+1)*sizeof(char),1);
1254                                                        memcpy(CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name,tmp_str,strlen(tmp_str));
1255//                                                      DST_Printf("results[%d]=%s\n",i*CDebugSQLSubWin_ColItemNum+j,CDebugSQLSubWin_results[i*CDebugSQLSubWin_ColItemNum+j].name);                                             
1256                                                }
1257                                        }
1258                                }
1259                                break;                         
1260                        default: break;
1261                }
1262                DBLock(false);
1263                if(CDebugSQLSubWin_RowItemNum == 0) return;
1264                if(CDebugSQLSubWin_ColItemNum == 0) return;
1265               
1266//                      DST_Printf("RowItemNum = %d, ColItemNum = %d\n",RowItemNum,ColItemNum);
1267               
1268
1269
1270        }
1271
1272        void CDebugSQLSubWin_InitValues()
1273        {                                       
1274                CDebugSQLSubWin_results = 0;
1275                CDebugSQLSubWin_attributes = 0;
1276
1277                CDebugSQLSubWin_RowPos = 0;
1278                CDebugSQLSubWin_RowTop = 0;
1279                CDebugSQLSubWin_RowSelect = 0;
1280                CDebugSQLSubWin_RowListNum = 10;
1281                CDebugSQLSubWin_RowItemNum = 0;
1282               
1283                CDebugSQLSubWin_ColPos = 0;
1284                CDebugSQLSubWin_ColTop = 0;
1285                CDebugSQLSubWin_ColSelect = 0;
1286                CDebugSQLSubWin_ColListNum = 5;
1287                CDebugSQLSubWin_ColItemNum = 0;
1288
1289                CDebugSQLSubWin_pre_ColItemNum = CDebugSQLSubWin_ColItemNum;
1290                CDebugSQLSubWin_pre_ColListNum = CDebugSQLSubWin_ColListNum;
1291                CDebugSQLSubWin_pre_ColTop = CDebugSQLSubWin_ColTop;
1292                CDebugSQLSubWin_pre_ColSelect = CDebugSQLSubWin_ColSelect;
1293                CDebugSQLSubWin_pre_ColPos = CDebugSQLSubWin_ColPos;                           
1294
1295                CDebugSQLSubWin_pre_RowItemNum = CDebugSQLSubWin_RowItemNum;
1296                CDebugSQLSubWin_pre_RowListNum = CDebugSQLSubWin_RowListNum;
1297                CDebugSQLSubWin_pre_RowTop = CDebugSQLSubWin_RowTop;
1298                CDebugSQLSubWin_pre_RowSelect = CDebugSQLSubWin_RowSelect;
1299                CDebugSQLSubWin_pre_RowPos = CDebugSQLSubWin_RowPos;
1300
1301                CDebugSQLSubWin_GetDBResult();
1302
1303                if (CDebugSQLSubWin_RowItemNum < CDebugSQLSubWin_RowListNum) CDebugSQLSubWin_RowListNum = CDebugSQLSubWin_RowItemNum;
1304                if (CDebugSQLSubWin_ColItemNum < CDebugSQLSubWin_ColListNum) CDebugSQLSubWin_ColListNum = CDebugSQLSubWin_ColItemNum;
1305        }
1306
1307
1308//      virtual void Show(WinID id)
1309        void CDebugSQLSubWin_ShowWindow(CWindow *this, WinID id)
1310        {
1311//              DST_Printf("id=%d\n",id);
1312                switch(id)
1313                {
1314                        case WIN_DEBUG_SQL:
1315                        case WIN_DEBUG_SQL_SUB:
1316                        case WIN_CHANNEL_BANNER:
1317                        case WIN_ERROR:
1318                                break;
1319                        default:
1320                                this->Close(this);
1321                                break;
1322                }
1323        }
1324
1325        void CDebugSQLSubWin_DrawVerScrollBar(CWindow *this, int x, int y, int h, int total_count, int page_count, int page_start)
1326        {
1327                if (total_count <= page_count) return;
1328                // ¼±Åà ±×¸®±â
1329                int nTop = 1;
1330                int nBot = 1;
1331                int nMinHeight = nTop + nBot + 1; // ÃÖ¼Ò ³ôÀÌ
1332                int nHeight = (h * page_count) / total_count; // ³ôÀÌ
1333                if (nHeight < nMinHeight) nHeight = nMinHeight; 
1334                int nStart = (h * page_start) / total_count;
1335                if (nStart + nHeight > h) nStart = h - nHeight; // ¾Æ·¡·Î »ßÁ®³ª¿À´Â°Í ¹æÁö
1336                if (total_count == page_start + page_count) nStart = h - nHeight; // ¾Æ·¡ ÇÑÇȼ¿ »ù ¹æÁö
1337                int nMid = nHeight - nTop - nBot;       
1338                this->DrawBox32(this, x,y+nStart,10,1,CONV32_16(0xFFFFFFFF));
1339                int yy = 0;
1340                for ( yy = 0; yy < nMid; yy++)
1341                {
1342                        this->DrawBox32(this, x,y+yy+nStart+nTop,10,1,CONV32_16(0xFFFFFFFF));
1343                }
1344                this->DrawBox32(this, x,y+nStart+nTop+nMid,10,1,CONV32_16(0xFFFFFFFF));
1345        }
1346
1347        void CDebugSQLSubWin_DrawHorScrollBar(CWindow *this, int x, int y, int w, int total_count, int page_count, int page_start)
1348        {
1349                if (total_count <= page_count) return;
1350                // ¼±Åà ±×¸®±â
1351                int nLeft = 1;
1352                int nRight = 1;
1353                int nMinWidth = nLeft + nRight + 1; // ÃÖ¼Ò ³ôÀÌ
1354                int nWidth = (w * page_count) / total_count; // ³ôÀÌ
1355                if (nWidth < nMinWidth) nWidth = nMinWidth; 
1356                int nStart = (w * page_start) / total_count;
1357                if (nStart + nWidth > w) nStart = w - nWidth; // ¾Æ·¡·Î »ßÁ®³ª¿À´Â°Í ¹æÁö
1358                if (total_count == page_start + page_count) nStart = w - nWidth; // ¾Æ·¡ ÇÑÇȼ¿ »ù ¹æÁö
1359                int nMid = nWidth - nLeft - nRight;     
1360                this->DrawBox32(this, x+nStart,y,1,6,CONV32_16(0xFFFFFFFF));
1361                int xx = 0;
1362                for ( xx = 0; xx < nMid; xx++)
1363                {
1364                        this->DrawBox32(this, x+xx+nStart+nLeft,y,1,6,CONV32_16(0xFFFFFFFF));
1365                }
1366                this->DrawBox32(this, x+nStart+nLeft+nMid,y,1,6,CONV32_16(0xFFFFFFFF));
1367        }       
1368
1369        void CDebugSQLSubWin_DrawDetail(CWindow *this)
1370        {
1371                int i = 0;
1372                this->setFontStyle(this, 15, 0xFF262626, ALIGN_MIDDLE,ALIGN_LEFT);
1373                if(CDebugSQLSubWin_results == 0) return;
1374                 //column attribute data typeÀÌ intÀÏ °æ¿ì,  hex°ªµµ °°ÀÌ º¸¿©ÁØ´Ù
1375                if(CDebugSQLSubWin_attributes[CDebugSQLSubWin_ColPos+CDebugSQLSubWin_ColTop].type == 1)
1376                {
1377                        int nLen1 = strlen(CDebugSQLSubWin_results[(CDebugSQLSubWin_RowPos+CDebugSQLSubWin_RowTop)*CDebugSQLSubWin_ColItemNum+(CDebugSQLSubWin_ColPos+CDebugSQLSubWin_ColTop)].name);
1378                        int number = dst_atoi(CDebugSQLSubWin_results[(CDebugSQLSubWin_RowPos+CDebugSQLSubWin_RowTop)*CDebugSQLSubWin_ColItemNum+(CDebugSQLSubWin_ColPos+CDebugSQLSubWin_ColTop)].name);
1379                        char tmpStr[100] = {0,};
1380                        sprintf(tmpStr," (0x%08X)",number);
1381                        int count = 0;
1382                        for( i=0;i<100;i++)
1383                        {
1384                                if(tmpStr[i] == 0) break;
1385                                count++;
1386                        }
1387                        int nLen = nLen1 + count + 1;
1388                        char * finalStr = (char*)DST_OS_Calloc((nLen)*sizeof(char),1);
1389
1390                        memcpy(finalStr,CDebugSQLSubWin_results[(CDebugSQLSubWin_RowPos+CDebugSQLSubWin_RowTop)*CDebugSQLSubWin_ColItemNum+(CDebugSQLSubWin_ColPos+CDebugSQLSubWin_ColTop)].name,nLen1);
1391                        memcpy(&finalStr[nLen1],tmpStr,count);
1392                        this->DrawText(this, 2, 2, this->rect.w-4, 54-4,finalStr,&(this->font));
1393                        DST_OS_Free(&finalStr);
1394                }
1395                else
1396                {
1397                        this->DrawText32(this, 2, 2, this->rect.w-4, 54-4, DST_UTF82Uni((DS_U8*)CDebugSQLSubWin_results[(CDebugSQLSubWin_RowPos+CDebugSQLSubWin_RowTop)*CDebugSQLSubWin_ColItemNum+(CDebugSQLSubWin_ColPos+CDebugSQLSubWin_ColTop)].name),&(this->font));
1398                }
1399        }
1400
1401        void CDebugSQLSubWin_DrawDetailPre(CWindow *this)
1402        {
1403                int i = 0;
1404                this->setFontStyle(this, 15, 0xFF262626, ALIGN_MIDDLE,ALIGN_LEFT);
1405                if(CDebugSQLSubWin_results == 0)
1406                {
1407                        this->DrawBox32(this, 2, 2, this->rect.w-4, 54-4, CONV32_16(0xFFFFFFFF));
1408                        return;
1409                }
1410                 //column attribute data typeÀÌ intÀÏ °æ¿ì,  hex°ªµµ °°ÀÌ º¸¿©ÁØ´Ù
1411                if(CDebugSQLSubWin_attributes[CDebugSQLSubWin_pre_ColPos+CDebugSQLSubWin_pre_ColTop].type == 1)
1412                {
1413                        int nLen1 = strlen(CDebugSQLSubWin_results[(CDebugSQLSubWin_pre_RowPos+CDebugSQLSubWin_pre_RowTop)*CDebugSQLSubWin_ColItemNum+(CDebugSQLSubWin_pre_ColPos+CDebugSQLSubWin_pre_ColTop)].name);
1414                        int number = dst_atoi(CDebugSQLSubWin_results[(CDebugSQLSubWin_pre_RowPos+CDebugSQLSubWin_pre_RowTop)*CDebugSQLSubWin_ColItemNum+(CDebugSQLSubWin_pre_ColPos+CDebugSQLSubWin_pre_ColTop)].name);
1415                        char tmpStr[100] = {0,};
1416                        sprintf(tmpStr," (0x%08X)",number);
1417                        int count = 0;
1418                        for( i=0;i<100;i++)
1419                        {
1420                                if(tmpStr[i] == 0) break;
1421                                count++;
1422                        }
1423                        int nLen = nLen1 + count + 1;
1424                        char * finalStr = (char*)DST_OS_Calloc((nLen)*sizeof(char),1);
1425
1426                        memcpy(finalStr,CDebugSQLSubWin_results[(CDebugSQLSubWin_pre_RowPos+CDebugSQLSubWin_pre_RowTop)*CDebugSQLSubWin_ColItemNum+(CDebugSQLSubWin_pre_ColPos+CDebugSQLSubWin_pre_ColTop)].name,nLen1);
1427                        memcpy(&finalStr[nLen1],tmpStr,count);
1428                        this->DrawBox32(this, 2, 2, DST_GetTextWidth(finalStr, this->FontGetSize(this)), 54-4, CONV32_16(0xFFFFFFFF));
1429                        DST_OS_Free(&finalStr);
1430                }
1431                else
1432                {
1433                        this->DrawBox32(this, 2, 2, DST_GetTextWidth32(DST_UTF82Uni((DS_U8*)CDebugSQLSubWin_results[(CDebugSQLSubWin_pre_RowPos+CDebugSQLSubWin_pre_RowTop)*CDebugSQLSubWin_ColItemNum+(CDebugSQLSubWin_pre_ColPos+CDebugSQLSubWin_pre_ColTop)].name), strlen32(DST_UTF82Uni((DS_U8*)CDebugSQLSubWin_results[(CDebugSQLSubWin_pre_RowPos+CDebugSQLSubWin_pre_RowTop)*CDebugSQLSubWin_ColItemNum+(CDebugSQLSubWin_pre_ColPos+CDebugSQLSubWin_pre_ColTop)].name)), this->FontGetSize(this)), 54-4, CONV32_16(0xFFFFFFFF));
1434                }
1435        }       
1436
1437        void CDebugSQLSubWin_DrawAll(CWindow *this)
1438        {
1439                int i = 0;
1440                int j = 0;
1441                this->setFontStyle(this, 15, 0xFFC8C8C8, ALIGN_MIDDLE,ALIGN_CENTER);
1442
1443                this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0xAA262626));
1444
1445               
1446                this->DrawBox32(this, 2, 2, this->rect.w-4, 54-4, CONV32_16(0xFFFFFFFF));
1447                for( i=0;i<CDebugSQLSubWin_ColListNum;i++)
1448                        this->DrawText(this, 2+i*108, 84+2-28, 108-4, 28-4, CDebugSQLSubWin_attributes[i+CDebugSQLSubWin_ColTop].name,&(this->font));
1449                char count_str[5] = {0,0,0,0,0};
1450                sprintf(count_str,"%d",CDebugSQLSubWin_RowItemNum);
1451                this->DrawText(this, 5*108 - 2, 84+2-28, 34, 28-4, count_str,&(this->font));
1452
1453               
1454                this->setFontStyle(this, 15, 0xFF363636, ALIGN_MIDDLE,ALIGN_CENTER);
1455                i = 0;
1456                j = 0;
1457                for( i=0;i<CDebugSQLSubWin_RowListNum;i++)
1458                {
1459                        for( j=0;j<CDebugSQLSubWin_ColListNum;j++)
1460                        {
1461                                if(CDebugSQLSubWin_RowSelect == i+CDebugSQLSubWin_RowTop && CDebugSQLSubWin_ColSelect == j+CDebugSQLSubWin_ColTop)
1462                                        this->DrawBox32(this, 2+j*108, 84+2+i*28, 108-4, 28-4, CONV32_16(0xAA2C86FF));
1463                                else
1464                                        this->DrawBox32(this, 2+j*108, 84+2+i*28, 108-4, 28-4, CONV32_16(0xAAFFA52C));
1465                                this->DrawText32(this, 2+j*108, 84+2+i*28, 108-4, 28-4,DST_UTF82Uni((DS_U8*)CDebugSQLSubWin_results[(i+CDebugSQLSubWin_RowTop)*CDebugSQLSubWin_ColItemNum+(j+CDebugSQLSubWin_ColTop)].name),&(this->font));
1466                        }
1467                }
1468                CDebugSQLSubWin_DrawDetail(this);
1469               
1470                CDebugSQLSubWin_DrawVerScrollBar(this, 550, 86, 28*CDebugSQLSubWin_RowListNum-4, CDebugSQLSubWin_RowItemNum, CDebugSQLSubWin_RowListNum, CDebugSQLSubWin_RowTop);
1471                CDebugSQLSubWin_DrawHorScrollBar(this, 2, 370, 108*CDebugSQLSubWin_ColListNum-4, CDebugSQLSubWin_ColItemNum, CDebugSQLSubWin_ColListNum, CDebugSQLSubWin_ColTop);
1472        }       
1473       
1474        void CDebugSQLSubWin_Draw(CWindow *this)
1475        {
1476                int i = 0;
1477                int j = 0;
1478                bool bDone = false;
1479                this->setFontStyle(this, 15, 0xFFC8C8C8, ALIGN_MIDDLE,ALIGN_CENTER);
1480
1481                CDebugSQLSubWin_DrawDetailPre(this);
1482                CDebugSQLSubWin_DrawDetail(this);
1483
1484               
1485                if(CDebugSQLSubWin_ColTop != CDebugSQLSubWin_pre_ColTop)
1486                {
1487                        for( i=0;i<CDebugSQLSubWin_ColListNum;i++)
1488                                this->DrawText(this, 2+i*108, 84+2-28, 108-4, 28-4,CDebugSQLSubWin_attributes[i+CDebugSQLSubWin_ColTop].name,&(this->font));
1489                }
1490               
1491                this->setFontStyle(this, 15, 0xFF363636, ALIGN_MIDDLE,ALIGN_CENTER);
1492                i = 0;
1493                j = 0;
1494                for( i=0;i<CDebugSQLSubWin_RowListNum;i++)
1495                {
1496                        for( j=0;j<CDebugSQLSubWin_ColListNum;j++)
1497                        {
1498                                if(CDebugSQLSubWin_RowSelect == i+CDebugSQLSubWin_RowTop && CDebugSQLSubWin_ColSelect == j+CDebugSQLSubWin_ColTop)
1499                                {
1500                                        this->DrawBox32(this, 2+j*108, 84+2+i*28, 108-4, 28-4, CONV32_16(0xAA2C86FF));
1501                                        this->DrawText32(this, 2+j*108, 84+2+i*28, 108-4, 28-4,DST_UTF82Uni((DS_U8*)CDebugSQLSubWin_results[(i+CDebugSQLSubWin_RowTop)*CDebugSQLSubWin_ColItemNum+(j+CDebugSQLSubWin_ColTop)].name),&(this->font));
1502                                        bDone = true;
1503                                        break;
1504                                }
1505                        }
1506                        if(bDone) break;
1507                }
1508
1509                bDone = false;
1510                i = 0;
1511                j = 0;
1512                for( i=0;i<CDebugSQLSubWin_RowListNum;i++)
1513                {
1514                        for( j=0;j<CDebugSQLSubWin_ColListNum;j++)
1515                        {
1516                                if(CDebugSQLSubWin_pre_RowSelect == i+CDebugSQLSubWin_pre_RowTop && CDebugSQLSubWin_pre_ColSelect == j+CDebugSQLSubWin_pre_ColTop)
1517                                {
1518                                        this->DrawBox32(this, 2+j*108, 84+2+i*28, 108-4, 28-4, CONV32_16(0xAAFFA52C));
1519                                        this->DrawText32(this, 2+j*108, 84+2+i*28, 108-4, 28-4,DST_UTF82Uni((DS_U8*)CDebugSQLSubWin_results[(i+CDebugSQLSubWin_pre_RowTop)*CDebugSQLSubWin_ColItemNum+(j+CDebugSQLSubWin_pre_ColTop)].name),&(this->font));
1520                                        bDone = true;
1521                                        break;
1522                                }
1523                        }
1524                        if(bDone) break;
1525                }       
1526                if(CDebugSQLSubWin_RowTop != CDebugSQLSubWin_pre_RowTop) CDebugSQLSubWin_DrawVerScrollBar(this, 550, 86, 28*CDebugSQLSubWin_RowListNum-4, CDebugSQLSubWin_RowItemNum, CDebugSQLSubWin_RowListNum, CDebugSQLSubWin_RowTop);
1527                if(CDebugSQLSubWin_ColTop != CDebugSQLSubWin_pre_ColTop) CDebugSQLSubWin_DrawHorScrollBar(this, 2, 370, 108*CDebugSQLSubWin_ColListNum-4, CDebugSQLSubWin_ColItemNum, CDebugSQLSubWin_ColListNum, CDebugSQLSubWin_ColTop);
1528        }
1529
1530//      virtual void Show()
1531        void CDebugSQLSubWin_Show(CWindow *this)
1532        {
1533                CDebugSQLSubWin_DrawAll(this);
1534        }       
1535
1536//      virtual void OnTimer(char nID)
1537        void CDebugSQLSubWin_OnTimer(CWindow *this, char nID)
1538        {
1539                switch(nID)
1540                {
1541                        case 1:
1542                                this->KillTimer(this,1);
1543                                CDebugSQLSubWin_InitValues();
1544                                this->Show(this);
1545                                break;
1546                }
1547        }       
1548
1549//      virtual void OnMessage(SWinEventMsg event)
1550        void CDebugSQLSubWin_OnMessage(CWindow *this, SWinEventMsg event)
1551        {
1552                switch (event.cmd)
1553                {
1554                        case WM_CT_MSG: // Æ©´× ½ÃÀÛ ¸Þ½ÃÁö¸¦ ¹ÞÀ¸¸é °»½Å
1555                                if (event.data32[0] == CT_TUNE_START) 
1556                                {
1557                                        this->SetTimer(this, 1, 1000);
1558                                }
1559                                break;         
1560                }
1561        }
1562
1563//      virtual void KeyInput(DS_U8 key,bool)
1564        void CDebugSQLSubWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
1565        {
1566                switch(key)
1567                {
1568                        case VK_PREV_CH:
1569                        case VK_PREV:
1570                        case VK_PREV_MENU:
1571                        case VK_CANCEL:
1572                                {
1573                                        CWindow * sqlWin = DST_GetWin(WIN_DEBUG_SQL);
1574                                        if(sqlWin)
1575                                                sqlWin->SetVisible(sqlWin, true);
1576                                        else
1577                                                DST_CreateWin(WIN_DEBUG_SQL, 0, 0, 0, 0, 0);
1578                                }
1579                                this->Close(this);
1580                                break;
1581                        case VK_OK:
1582                               
1583                                break;
1584                        case VK_LEFT:
1585                        case VK_RIGHT:
1586                                if(key == VK_RIGHT)
1587                                {
1588                                        if(CDebugSQLSubWin_pre_ColPos == CDebugSQLSubWin_ColListNum-1 && CDebugSQLSubWin_pre_ColTop+CDebugSQLSubWin_ColListNum < CDebugSQLSubWin_ColItemNum - (CDebugSQLSubWin_ColItemNum%CDebugSQLSubWin_ColListNum))
1589                                        {
1590                                                ItemIncrease(CDebugSQLSubWin_ColItemNum, CDebugSQLSubWin_ColListNum, &CDebugSQLSubWin_ColTop, &CDebugSQLSubWin_ColSelect, &CDebugSQLSubWin_ColPos,CDebugSQLSubWin_ColListNum);
1591                                                CDebugSQLSubWin_ColSelect = 1 + CDebugSQLSubWin_ColSelect - CDebugSQLSubWin_ColListNum;
1592                                                CDebugSQLSubWin_ColPos = 0;
1593                                        }
1594                                        else
1595                                        {
1596                                                ItemIncrease(CDebugSQLSubWin_ColItemNum, CDebugSQLSubWin_ColListNum, &CDebugSQLSubWin_ColTop, &CDebugSQLSubWin_ColSelect, &CDebugSQLSubWin_ColPos, 1);
1597                                        }
1598                                }
1599                                else
1600                                {
1601                                        if(CDebugSQLSubWin_pre_ColPos == 0 && CDebugSQLSubWin_pre_ColTop > CDebugSQLSubWin_ColListNum)
1602                                        {
1603                                       
1604                                                ItemDecrease(CDebugSQLSubWin_ColItemNum, CDebugSQLSubWin_ColListNum, &CDebugSQLSubWin_ColTop, &CDebugSQLSubWin_ColSelect, &CDebugSQLSubWin_ColPos,CDebugSQLSubWin_ColListNum);
1605                                                CDebugSQLSubWin_ColSelect = CDebugSQLSubWin_ColSelect + CDebugSQLSubWin_ColListNum - 1;
1606                                                CDebugSQLSubWin_ColPos = CDebugSQLSubWin_ColListNum -1;
1607                                        }
1608                                        else
1609                                        {
1610                                                ItemDecrease(CDebugSQLSubWin_ColItemNum, CDebugSQLSubWin_ColListNum, &CDebugSQLSubWin_ColTop, &CDebugSQLSubWin_ColSelect, &CDebugSQLSubWin_ColPos, 1);
1611                                        }
1612                                }
1613                               
1614                                if(CDebugSQLSubWin_ColTop != CDebugSQLSubWin_pre_ColTop) CDebugSQLSubWin_DrawAll(this);
1615                                else CDebugSQLSubWin_Draw(this);
1616                               
1617                                CDebugSQLSubWin_pre_ColItemNum = CDebugSQLSubWin_ColItemNum;
1618                                CDebugSQLSubWin_pre_ColListNum = CDebugSQLSubWin_ColListNum;
1619                                CDebugSQLSubWin_pre_ColTop = CDebugSQLSubWin_ColTop;
1620                                CDebugSQLSubWin_pre_ColSelect = CDebugSQLSubWin_ColSelect;
1621                                CDebugSQLSubWin_pre_ColPos = CDebugSQLSubWin_ColPos;                           
1622                                break;
1623                        case VK_UP:
1624                        case VK_DN:
1625                                if(key == VK_DN)
1626                                {
1627                                        if(CDebugSQLSubWin_pre_RowPos == CDebugSQLSubWin_RowListNum-1 && CDebugSQLSubWin_pre_RowTop+CDebugSQLSubWin_RowListNum < CDebugSQLSubWin_RowItemNum - (CDebugSQLSubWin_RowItemNum%CDebugSQLSubWin_RowListNum))
1628                                        {
1629                                                ItemIncrease(CDebugSQLSubWin_RowItemNum, CDebugSQLSubWin_RowListNum, &CDebugSQLSubWin_RowTop, &CDebugSQLSubWin_RowSelect, &CDebugSQLSubWin_RowPos,CDebugSQLSubWin_RowListNum);
1630                                                CDebugSQLSubWin_RowSelect = 1 + CDebugSQLSubWin_RowSelect - CDebugSQLSubWin_RowListNum ;
1631                                                CDebugSQLSubWin_RowPos = 0;
1632                                        }
1633                                        else
1634                                        {
1635                                                ItemIncrease(CDebugSQLSubWin_RowItemNum, CDebugSQLSubWin_RowListNum, &CDebugSQLSubWin_RowTop, &CDebugSQLSubWin_RowSelect, &CDebugSQLSubWin_RowPos, 1);
1636                                        }
1637                                }
1638                                else
1639                                {
1640                                        if(CDebugSQLSubWin_pre_RowPos == 0 && CDebugSQLSubWin_pre_RowTop > CDebugSQLSubWin_RowListNum)
1641                                        {
1642                                       
1643                                                ItemDecrease(CDebugSQLSubWin_RowItemNum, CDebugSQLSubWin_RowListNum, &CDebugSQLSubWin_RowTop, &CDebugSQLSubWin_RowSelect, &CDebugSQLSubWin_RowPos,CDebugSQLSubWin_RowListNum);
1644                                                CDebugSQLSubWin_RowSelect = CDebugSQLSubWin_RowSelect + CDebugSQLSubWin_RowListNum - 1;
1645                                                CDebugSQLSubWin_RowPos = CDebugSQLSubWin_RowListNum -1;
1646                                        }
1647                                        else
1648                                        {
1649                                                ItemDecrease(CDebugSQLSubWin_RowItemNum, CDebugSQLSubWin_RowListNum, &CDebugSQLSubWin_RowTop, &CDebugSQLSubWin_RowSelect, &CDebugSQLSubWin_RowPos, 1);
1650                                        }
1651                                }
1652
1653                                if(CDebugSQLSubWin_RowTop != CDebugSQLSubWin_pre_RowTop) CDebugSQLSubWin_DrawAll(this);
1654                                else CDebugSQLSubWin_Draw(this);
1655                       
1656                       
1657                                CDebugSQLSubWin_pre_RowItemNum = CDebugSQLSubWin_RowItemNum;
1658                                CDebugSQLSubWin_pre_RowListNum = CDebugSQLSubWin_RowListNum;
1659                                CDebugSQLSubWin_pre_RowTop = CDebugSQLSubWin_RowTop;
1660                                CDebugSQLSubWin_pre_RowSelect = CDebugSQLSubWin_RowSelect;
1661                                CDebugSQLSubWin_pre_RowPos = CDebugSQLSubWin_RowPos;                           
1662                                break;
1663
1664                }
1665        }
1666//};
1667
1668
1669void DST_CreateDebugSQLSubWin(SWinEventMsg event)
1670{
1671        CWindow*pWin = NewCWindow(event);
1672        pWin->Destructor        = CDebugSQLSubWin_Destructor;
1673        pWin->KeyInput          = CDebugSQLSubWin_KeyInput;
1674        pWin->OnMessage         = CDebugSQLSubWin_OnMessage;
1675        pWin->OnTimer           = CDebugSQLSubWin_OnTimer;
1676        pWin->ShowWindow        = CDebugSQLSubWin_ShowWindow;
1677        pWin->Show                      = CDebugSQLSubWin_Show;
1678        // »ý¼ºÀÚ È£Ãâ
1679        CDebugSQLSubWin_Constructor(pWin, event);
1680        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
1681        DST_AddWin((WinID)(event.data[0]), pWin);
1682}
1683
Note: See TracBrowser for help on using the repository browser.