Hex Artifact Content Вы: nobody
Вход

Artifact e9960833d66c3f7b8f4d97270fc91d990afa933d:


0000: 2f 2f 20 64 61 74 61 70 72 6f 76 69 64 65 72 2e  // dataprovider.
0010: 68 0d 0a 23 70 72 61 67 6d 61 20 6f 6e 63 65 0d  h..#pragma once.
0020: 0a 2f 2f 23 64 65 66 69 6e 65 20 4f 50 54 49 4d  .//#define OPTIM
0030: 49 5a 45 5f 46 49 45 4c 44 53 5f 43 48 41 4e 47  IZE_FIELDS_CHANG
0040: 45 0d 0a 23 69 6e 63 6c 75 64 65 20 22 31 63 70  E..#include "1cp
0050: 70 2f 56 37 44 61 74 61 50 72 6f 76 69 64 65 72  p/V7DataProvider
0060: 2e 68 22 0d 0a 23 69 6e 63 6c 75 64 65 20 22 64  .h"..#include "d
0070: 61 74 61 62 61 73 65 2e 68 22 0d 0a 23 69 6e 63  atabase.h"..#inc
0080: 6c 75 64 65 20 22 72 65 73 75 6c 74 6c 6f 61 64  lude "resultload
0090: 65 72 2e 68 22 0d 0a 0d 0a 63 6c 61 73 73 20 53  er.h"....class S
00a0: 51 4c 69 74 65 44 61 74 61 50 72 6f 76 69 64 65  QLiteDataProvide
00b0: 72 3b 0d 0a 0d 0a 63 6c 61 73 73 20 53 51 4c 69  r;....class SQLi
00c0: 74 65 44 61 74 61 52 6f 77 20 3a 20 70 75 62 6c  teDataRow : publ
00d0: 69 63 20 43 44 61 74 61 52 6f 77 2c 20 70 75 62  ic CDataRow, pub
00e0: 6c 69 63 20 43 56 37 44 61 74 61 52 6f 77 0d 0a  lic CV7DataRow..
00f0: 7b 0d 0a 70 75 62 6c 69 63 3a 0d 0a 20 20 20 20  {..public:..    
0100: 2f 2f 43 44 61 74 61 52 6f 77 0d 0a 20 20 20 20  //CDataRow..    
0110: 76 69 72 74 75 61 6c 20 69 6e 74 20 47 65 74 46  virtual int GetF
0120: 69 65 6c 64 43 6f 75 6e 74 28 29 3b 0d 0a 20 20  ieldCount();..  
0130: 20 20 76 69 72 74 75 61 6c 20 69 6e 74 20 47 65    virtual int Ge
0140: 74 46 69 65 6c 64 49 6e 64 65 78 4f 66 28 4c 50  tFieldIndexOf(LP
0150: 43 53 54 52 20 73 7a 46 69 65 6c 64 4e 61 6d 65  CSTR szFieldName
0160: 29 3b 0d 0a 20 20 20 20 76 69 72 74 75 61 6c 20  );..    virtual 
0170: 4c 50 43 53 54 52 20 47 65 74 46 69 65 6c 64 4e  LPCSTR GetFieldN
0180: 61 6d 65 28 69 6e 74 20 6e 49 6e 64 65 78 29 3b  ame(int nIndex);
0190: 0d 0a 20 20 20 20 76 69 72 74 75 61 6c 20 44 61  ..    virtual Da
01a0: 74 61 54 79 70 65 20 47 65 74 46 69 65 6c 64 54  taType GetFieldT
01b0: 79 70 65 28 69 6e 74 20 6e 49 6e 64 65 78 29 3b  ype(int nIndex);
01c0: 0d 0a 20 20 20 20 76 69 72 74 75 61 6c 20 76 6f  ..    virtual vo
01d0: 69 64 20 46 6f 72 6d 61 74 46 69 65 6c 64 28 69  id FormatField(i
01e0: 6e 74 20 6e 49 6e 64 65 78 2c 20 43 53 74 72 69  nt nIndex, CStri
01f0: 6e 67 26 20 73 74 72 56 61 6c 75 65 29 3b 0d 0a  ng& strValue);..
0200: 20 20 20 20 76 69 72 74 75 61 6c 20 55 49 4e 54      virtual UINT
0210: 20 47 65 74 52 6f 77 49 6e 64 65 78 28 29 3b 0d   GetRowIndex();.
0220: 0a 0d 0a 20 20 20 20 2f 2f 43 56 37 44 61 74 61  ...    //CV7Data
0230: 52 6f 77 0d 0a 20 20 20 20 76 69 72 74 75 61 6c  Row..    virtual
0240: 20 63 6f 6e 73 74 20 43 56 61 6c 75 65 26 20 47   const CValue& G
0250: 65 74 56 61 6c 75 65 28 69 6e 74 20 6e 49 6e 64  etValue(int nInd
0260: 65 78 29 20 63 6f 6e 73 74 3b 0d 0a 70 72 6f 74  ex) const;..prot
0270: 65 63 74 65 64 3a 0d 0a 09 66 72 69 65 6e 64 20  ected:...friend 
0280: 53 51 4c 69 74 65 44 61 74 61 50 72 6f 76 69 64  SQLiteDataProvid
0290: 65 72 3b 0d 0a 09 66 72 69 65 6e 64 20 63 6c 61  er;...friend cla
02a0: 73 73 20 44 61 74 61 50 72 6f 76 69 64 65 72 52  ss DataProviderR
02b0: 65 73 75 6c 74 4c 6f 61 64 65 72 3b 0d 0a 09 53  esultLoader;...S
02c0: 51 4c 69 74 65 44 61 74 61 52 6f 77 28 53 51 4c  QLiteDataRow(SQL
02d0: 69 74 65 44 61 74 61 50 72 6f 76 69 64 65 72 2a  iteDataProvider*
02e0: 20 70 50 61 72 65 6e 74 29 3b 0d 0a 09 53 51 4c   pParent);...SQL
02f0: 69 74 65 44 61 74 61 52 6f 77 28 44 57 4f 52 44  iteDataRow(DWORD
0300: 20 66 63 29 3b 0d 0a 09 7e 53 51 4c 69 74 65 44   fc);...~SQLiteD
0310: 61 74 61 52 6f 77 28 29 3b 0d 0a 09 53 51 4c 69  ataRow();...SQLi
0320: 74 65 44 61 74 61 50 72 6f 76 69 64 65 72 2a 20  teDataProvider* 
0330: 6d 5f 70 50 61 72 65 6e 74 3b 0d 0a 09 43 56 61  m_pParent;...CVa
0340: 6c 75 65 2a 20 6d 5f 70 56 61 6c 75 65 73 3b 0d  lue* m_pValues;.
0350: 0a 09 44 57 4f 52 44 20 6d 5f 66 43 6f 75 6e 74  ..DWORD m_fCount
0360: 3b 0d 0a 7d 3b 0d 0a 74 79 70 65 64 65 66 20 43  ;..};..typedef C
0370: 54 79 70 65 64 50 74 72 41 72 72 61 79 3c 43 50  TypedPtrArray<CP
0380: 74 72 41 72 72 61 79 2c 20 53 51 4c 69 74 65 44  trArray, SQLiteD
0390: 61 74 61 52 6f 77 2a 3e 20 52 6f 77 73 41 72 72  ataRow*> RowsArr
03a0: 61 79 3b 0d 0a 0d 0a 0d 0a 63 6c 61 73 73 20 53  ay;......class S
03b0: 51 4c 69 74 65 44 61 74 61 50 72 6f 76 69 64 65  QLiteDataProvide
03c0: 72 20 3a 20 70 75 62 6c 69 63 20 43 43 6f 6e 74  r : public CCont
03d0: 65 78 74 49 6d 70 6c 3c 53 51 4c 69 74 65 44 61  extImpl<SQLiteDa
03e0: 74 61 50 72 6f 76 69 64 65 72 3e 0d 0a 09 2c 20  taProvider>..., 
03f0: 70 75 62 6c 69 63 20 43 44 61 74 61 50 72 6f 76  public CDataProv
0400: 69 64 65 72 2c 20 70 75 62 6c 69 63 20 43 56 37  ider, public CV7
0410: 44 61 74 61 50 72 6f 76 69 64 65 72 0d 0a 7b 0d  DataProvider..{.
0420: 0a 20 20 20 20 2f 2f 43 44 61 74 61 50 72 6f 76  .    //CDataProv
0430: 69 64 65 72 0d 0a 70 75 62 6c 69 63 3a 0d 0a 20  ider..public:.. 
0440: 20 20 20 76 69 72 74 75 61 6c 20 76 6f 69 64 20     virtual void 
0450: 51 75 65 72 79 52 6f 77 73 28 43 44 61 74 61 52  QueryRows(CDataR
0460: 6f 77 2a 20 70 52 6f 77 46 72 6f 6d 2c 20 69 6e  ow* pRowFrom, in
0470: 74 20 6e 52 6f 77 73 43 6f 75 6e 74 2c 20 69 6e  t nRowsCount, in
0480: 74 20 6e 50 61 67 65 53 69 7a 65 48 69 6e 74 29  t nPageSizeHint)
0490: 3b 0d 0a 20 20 20 20 76 69 72 74 75 61 6c 20 43  ;..    virtual C
04a0: 44 61 74 61 52 6f 77 2a 20 46 65 74 63 68 28 29  DataRow* Fetch()
04b0: 3b 0d 0a 20 20 20 20 76 69 72 74 75 61 6c 20 42  ;..    virtual B
04c0: 4f 4f 4c 20 52 65 66 72 65 73 68 52 6f 77 28 43  OOL RefreshRow(C
04d0: 44 61 74 61 52 6f 77 2a 20 70 52 6f 77 46 72 6f  DataRow* pRowFro
04e0: 6d 29 3b 0d 0a 20 20 20 20 76 69 72 74 75 61 6c  m);..    virtual
04f0: 20 42 4f 4f 4c 20 43 6f 6d 70 61 72 65 52 6f 77   BOOL CompareRow
0500: 73 28 43 44 61 74 61 52 6f 77 2a 20 70 52 6f 77  s(CDataRow* pRow
0510: 31 2c 20 43 44 61 74 61 52 6f 77 2a 20 70 52 6f  1, CDataRow* pRo
0520: 77 32 29 20 63 6f 6e 73 74 3b 0d 0a 20 20 20 20  w2) const;..    
0530: 76 69 72 74 75 61 6c 20 42 4f 4f 4c 20 47 65 74  virtual BOOL Get
0540: 52 6f 77 43 6f 75 6e 74 28 55 49 4e 54 2a 20 70  RowCount(UINT* p
0550: 43 6f 75 6e 74 29 3b 0d 0a 0d 0a 20 20 20 20 76  Count);....    v
0560: 69 72 74 75 61 6c 20 76 6f 69 64 20 51 75 65 72  irtual void Quer
0570: 79 46 69 65 6c 64 28 4c 50 43 53 54 52 20 73 7a  yField(LPCSTR sz
0580: 46 69 65 6c 64 4e 61 6d 65 29 3b 0d 0a 20 20 20  FieldName);..   
0590: 20 76 69 72 74 75 61 6c 20 76 6f 69 64 20 52 65   virtual void Re
05a0: 6c 65 61 73 65 46 69 65 6c 64 28 4c 50 43 53 54  leaseField(LPCST
05b0: 52 20 73 7a 46 69 65 6c 64 4e 61 6d 65 29 3b 0d  R szFieldName);.
05c0: 0a 0d 0a 20 20 20 20 76 69 72 74 75 61 6c 20 44  ...    virtual D
05d0: 61 74 61 54 79 70 65 20 47 65 74 51 75 69 63 6b  ataType GetQuick
05e0: 53 65 61 72 63 68 54 79 70 65 28 4c 50 43 53 54  SearchType(LPCST
05f0: 52 20 73 7a 46 69 65 6c 64 4e 61 6d 65 29 3b 0d  R szFieldName);.
0600: 0a 20 20 20 20 76 69 72 74 75 61 6c 20 76 6f 69  .    virtual voi
0610: 64 20 51 75 69 63 6b 53 65 61 72 63 68 28 73 74  d QuickSearch(st
0620: 51 75 69 63 6b 53 65 61 72 63 68 50 61 74 74 65  QuickSearchPatte
0630: 72 6e 26 20 51 53 50 61 74 74 65 72 6e 29 3b 0d  rn& QSPattern);.
0640: 0a 70 72 6f 74 65 63 74 65 64 3a 0d 0a 20 20 20  .protected:..   
0650: 20 76 69 72 74 75 61 6c 20 76 6f 69 64 20 4f 6e   virtual void On
0660: 41 74 74 61 63 68 28 29 3b 0d 0a 20 20 20 20 2f  Attach();..    /
0670: 2f 43 56 37 44 61 74 61 50 72 6f 76 69 64 65 72  /CV7DataProvider
0680: 0d 0a 70 75 62 6c 69 63 3a 0d 0a 20 20 20 20 76  ..public:..    v
0690: 69 72 74 75 61 6c 20 43 56 37 44 61 74 61 52 6f  irtual CV7DataRo
06a0: 77 2a 20 47 65 74 56 37 44 61 74 61 52 6f 77 28  w* GetV7DataRow(
06b0: 43 44 61 74 61 52 6f 77 2a 20 70 44 61 74 61 52  CDataRow* pDataR
06c0: 6f 77 29 20 63 6f 6e 73 74 3b 0d 0a 20 20 20 20  ow) const;..    
06d0: 76 69 72 74 75 61 6c 20 76 6f 69 64 20 47 65 74  virtual void Get
06e0: 52 6f 77 56 61 6c 75 65 28 43 44 61 74 61 52 6f  RowValue(CDataRo
06f0: 77 2a 20 70 44 61 74 61 52 6f 77 2c 20 43 56 61  w* pDataRow, CVa
0700: 6c 75 65 26 20 76 61 6c 75 65 29 20 63 6f 6e 73  lue& value) cons
0710: 74 3b 0d 0a 20 20 20 20 76 69 72 74 75 61 6c 20  t;..    virtual 
0720: 43 44 61 74 61 52 6f 77 2a 20 42 75 69 6c 64 52  CDataRow* BuildR
0730: 6f 77 42 79 56 61 6c 75 65 28 63 6f 6e 73 74 20  owByValue(const 
0740: 43 56 61 6c 75 65 26 20 76 61 6c 75 65 29 3b 0d  CValue& value);.
0750: 0a 0d 0a 09 2f 2f 20 c4 eb ff 20 53 51 4c 69 74  ....// ... SQLit
0760: 65 44 61 74 61 52 6f 77 0d 0a 09 69 6e 74 20 66  eDataRow...int f
0770: 69 6e 64 46 69 65 6c 64 28 4c 50 43 53 54 52 20  indField(LPCSTR 
0780: 73 74 72 46 69 65 6c 64 4e 61 6d 65 29 20 63 6f  strFieldName) co
0790: 6e 73 74 0d 0a 09 7b 0d 0a 09 09 66 69 65 6c 64  nst...{....field
07a0: 5f 69 6e 66 6f 2a 20 70 46 49 3b 0d 0a 09 09 69  _info* pFI;....i
07b0: 66 28 6d 5f 66 69 65 6c 64 42 79 4e 61 6d 65 2e  f(m_fieldByName.
07c0: 4c 6f 6f 6b 75 70 28 73 74 72 46 69 65 6c 64 4e  Lookup(strFieldN
07d0: 61 6d 65 2c 20 70 46 49 29 29 0d 0a 09 09 09 72  ame, pFI)).....r
07e0: 65 74 75 72 6e 20 70 46 49 2d 3e 70 6f 73 49 6e  eturn pFI->posIn
07f0: 51 75 65 72 79 3b 0d 0a 09 09 72 65 74 75 72 6e  Query;....return
0800: 20 2d 31 3b 0d 0a 09 7d 0d 0a 09 69 6e 74 20 66   -1;...}...int f
0810: 69 65 6c 64 73 43 6f 75 6e 74 28 29 20 63 6f 6e  ieldsCount() con
0820: 73 74 09 09 09 09 7b 20 72 65 74 75 72 6e 20 6d  st....{ return m
0830: 5f 63 6f 75 6e 74 4f 66 43 6f 6c 75 6d 6e 73 3b  _countOfColumns;
0840: 20 7d 0d 0a 09 4c 50 43 53 54 52 20 66 69 65 6c   }...LPCSTR fiel
0850: 64 4e 61 6d 65 28 69 6e 74 20 69 49 6e 64 65 78  dName(int iIndex
0860: 29 63 6f 6e 73 74 09 7b 20 72 65 74 75 72 6e 20  )const.{ return 
0870: 6d 5f 71 75 65 72 79 46 69 65 6c 64 73 4e 61 6d  m_queryFieldsNam
0880: 65 73 5b 69 49 6e 64 65 78 5d 3b 20 7d 0d 0a 0d  es[iIndex]; }...
0890: 0a 09 53 51 4c 69 74 65 44 61 74 61 50 72 6f 76  ..SQLiteDataProv
08a0: 69 64 65 72 28 29 3b 0d 0a 09 7e 53 51 4c 69 74  ider();...~SQLit
08b0: 65 44 61 74 61 50 72 6f 76 69 64 65 72 28 29 0d  eDataProvider().
08c0: 0a 09 7b 0d 0a 09 09 63 6c 65 61 72 41 6c 6c 28  ..{....clearAll(
08d0: 29 3b 0d 0a 09 7d 0d 0a 0d 0a 09 42 4c 5f 42 45  );...}.....BL_BE
08e0: 47 49 4e 5f 43 4f 4e 54 45 58 54 28 22 53 51 4c  GIN_CONTEXT("SQL
08f0: 69 74 65 44 61 74 61 50 72 6f 76 69 64 65 72 22  iteDataProvider"
0900: 2c 20 22 53 51 4c 69 74 65 44 61 74 61 50 72 6f  , "SQLiteDataPro
0910: 76 69 64 65 72 22 29 3b 0d 0a 0d 0a 09 42 4c 5f  vider");.....BL_
0920: 50 52 4f 43 5f 57 49 54 48 5f 44 45 46 56 41 4c  PROC_WITH_DEFVAL
0930: 28 53 65 74 44 61 74 61 42 61 73 65 2c 20 22 d3  (SetDataBase, ".
0940: f1 f2 e0 ed ee e2 e8 f2 fc c1 c4 22 2c 20 31 29  ...........", 1)
0950: 3b 0d 0a 09 42 4c 5f 44 45 46 56 41 4c 5f 46 4f  ;...BL_DEFVAL_FO
0960: 52 28 53 65 74 44 61 74 61 42 61 73 65 29 20 7b  R(SetDataBase) {
0970: 69 66 28 70 56 61 6c 75 65 29 20 70 56 61 6c 75  if(pValue) pValu
0980: 65 2d 3e 52 65 73 65 74 28 29 3b 20 72 65 74 75  e->Reset(); retu
0990: 72 6e 20 54 52 55 45 3b 20 7d 0d 0a 09 0d 0a 09  rn TRUE; }......
09a0: 42 4c 5f 50 52 4f 43 5f 57 49 54 48 5f 44 45 46  BL_PROC_WITH_DEF
09b0: 56 41 4c 28 53 65 74 50 61 72 61 6d 2c 20 22 d3  VAL(SetParam, ".
09c0: f1 f2 e0 ed ee e2 e8 f2 fc cf e0 f0 e0 ec e5 f2  ................
09d0: f0 22 2c 20 33 29 0d 0a 09 7b 0d 0a 09 09 6d 5f  .", 3)...{....m_
09e0: 73 71 6c 50 61 72 61 6d 73 2e 73 65 74 53 71 6c  sqlParams.setSql
09f0: 50 61 72 61 6d 28 70 70 50 61 72 61 6d 73 5b 30  Param(ppParams[0
0a00: 5d 2d 3e 47 65 74 53 74 72 69 6e 67 28 29 2c 20  ]->GetString(), 
0a10: 70 70 50 61 72 61 6d 73 5b 31 5d 2c 20 70 70 50  ppParams[1], ppP
0a20: 61 72 61 6d 73 5b 32 5d 2d 3e 47 65 74 4e 75 6d  arams[2]->GetNum
0a30: 65 72 69 63 28 29 29 3b 0d 0a 09 09 72 65 74 75  eric());....retu
0a40: 72 6e 20 54 52 55 45 3b 0d 0a 09 7d 0d 0a 09 42  rn TRUE;...}...B
0a50: 4c 5f 44 45 46 56 41 4c 5f 46 4f 52 28 53 65 74  L_DEFVAL_FOR(Set
0a60: 50 61 72 61 6d 29 0d 0a 09 7b 0d 0a 09 09 69 66  Param)...{....if
0a70: 28 6e 50 61 72 61 6d 20 3d 3d 20 32 29 0d 0a 09  (nParam == 2)...
0a80: 09 7b 0d 0a 09 09 09 69 66 28 70 56 61 6c 75 65  .{.....if(pValue
0a90: 29 0d 0a 09 09 09 09 70 56 61 6c 75 65 20 3d 20  )......pValue = 
0aa0: 30 4c 3b 0d 0a 09 09 09 72 65 74 75 72 6e 20 54  0L;.....return T
0ab0: 52 55 45 3b 0d 0a 09 09 7d 0d 0a 09 09 72 65 74  RUE;....}....ret
0ac0: 75 72 6e 20 46 41 4c 53 45 3b 0d 0a 09 7d 0d 0a  urn FALSE;...}..
0ad0: 09 42 4c 5f 50 52 4f 43 28 53 75 62 73 74 69 74  .BL_PROC(Substit
0ae0: 75 74 65 2c 20 22 cf ee e4 f1 f2 e0 e2 eb ff f2  ute, "..........
0af0: fc 22 2c 20 32 29 0d 0a 09 7b 0d 0a 09 09 6d 5f  .", 2)...{....m_
0b00: 6d 65 74 61 50 61 72 73 65 72 2e 73 65 74 54 65  metaParser.setTe
0b10: 78 74 50 61 72 61 6d 28 70 70 50 61 72 61 6d 73  xtParam(ppParams
0b20: 5b 30 5d 2d 3e 47 65 74 53 74 72 69 6e 67 28 29  [0]->GetString()
0b30: 2c 20 70 70 50 61 72 61 6d 73 5b 31 5d 29 3b 0d  , ppParams[1]);.
0b40: 0a 09 09 72 65 74 75 72 6e 20 54 52 55 45 3b 0d  ...return TRUE;.
0b50: 0a 09 7d 0d 0a 09 42 4c 5f 50 52 4f 43 5f 57 49  ..}...BL_PROC_WI
0b60: 54 48 5f 44 45 46 56 41 4c 28 53 65 74 51 75 65  TH_DEFVAL(SetQue
0b70: 72 79 54 65 78 74 2c 20 22 d3 f1 f2 e0 ed ee e2  ryText, ".......
0b80: e8 f2 fc d2 e5 ea f1 f2 c7 e0 ef f0 ee f1 e0 22  ..............."
0b90: 2c 20 33 29 3b 0d 0a 09 42 4c 5f 44 45 46 56 41  , 3);...BL_DEFVA
0ba0: 4c 5f 46 4f 52 28 53 65 74 51 75 65 72 79 54 65  L_FOR(SetQueryTe
0bb0: 78 74 29 0d 0a 09 7b 0d 0a 09 09 69 66 28 6e 50  xt)...{....if(nP
0bc0: 61 72 61 6d 20 3e 3d 20 32 29 0d 0a 09 09 7b 0d  aram >= 2)....{.
0bd0: 0a 09 09 09 69 66 28 70 56 61 6c 75 65 29 0d 0a  ....if(pValue)..
0be0: 09 09 09 09 70 56 61 6c 75 65 2d 3e 52 65 73 65  ....pValue->Rese
0bf0: 74 28 29 3b 0d 0a 09 09 09 72 65 74 75 72 6e 20  t();.....return 
0c00: 54 52 55 45 3b 0d 0a 09 09 7d 0d 0a 09 09 72 65  TRUE;....}....re
0c10: 74 75 72 6e 20 46 41 4c 53 45 3b 0d 0a 09 7d 0d  turn FALSE;...}.
0c20: 0a 09 42 4c 5f 50 52 4f 43 28 44 65 62 75 67 2c  ..BL_PROC(Debug,
0c30: 20 22 ce f2 eb e0 e4 ea e0 22 2c 20 31 29 0d 0a   ".......", 1)..
0c40: 09 7b 0d 0a 09 09 6d 5f 64 65 62 75 67 20 3d 20  .{....m_debug = 
0c50: 28 6c 6f 6e 67 29 70 70 50 61 72 61 6d 73 5b 30  (long)ppParams[0
0c60: 5d 2d 3e 47 65 74 4e 75 6d 65 72 69 63 28 29 20  ]->GetNumeric() 
0c70: 21 3d 20 30 3b 0d 0a 09 09 72 65 74 75 72 6e 20  != 0;....return 
0c80: 54 52 55 45 3b 0d 0a 09 7d 0d 0a 09 42 4c 5f 50  TRUE;...}...BL_P
0c90: 52 4f 43 28 52 65 72 65 61 64 2c 20 22 cf e5 f0  ROC(Reread, "...
0ca0: e5 f7 e8 f2 e0 f2 fc 22 2c 20 30 29 0d 0a 09 7b  .......", 0)...{
0cb0: 0d 0a 09 09 52 65 73 65 74 44 61 74 61 28 29 3b  ....ResetData();
0cc0: 0d 0a 09 09 72 65 74 75 72 6e 20 54 52 55 45 3b  ....return TRUE;
0cd0: 0d 0a 09 7d 0d 0a 09 42 4c 5f 50 52 4f 43 28 4e  ...}...BL_PROC(N
0ce0: 6f 44 65 6c 65 74 65 46 69 65 6c 64 73 2c 20 22  oDeleteFields, "
0cf0: cd e5 d3 e4 e0 eb ff f2 fc cf ee eb ff 22 2c 20  .............", 
0d00: 31 29 0d 0a 09 7b 0d 0a 09 09 73 65 74 46 6c 61  1)...{....setFla
0d10: 67 4f 6e 46 69 65 6c 64 73 28 70 70 50 61 72 61  gOnFields(ppPara
0d20: 6d 73 5b 30 5d 2d 3e 47 65 74 53 74 72 69 6e 67  ms[0]->GetString
0d30: 28 29 2c 20 66 69 65 6c 64 5f 69 6e 66 6f 3a 3a  (), field_info::
0d40: 4e 6f 41 75 74 6f 44 65 6c 65 74 65 20 7c 20 66  NoAutoDelete | f
0d50: 69 65 6c 64 5f 69 6e 66 6f 3a 3a 69 6e 55 73 65  ield_info::inUse
0d60: 29 3b 0d 0a 09 09 73 65 74 43 6f 6c 75 6d 6e 73  );....setColumns
0d70: 43 68 61 6e 67 65 64 28 29 3b 0d 0a 09 09 72 65  Changed();....re
0d80: 74 75 72 6e 20 54 52 55 45 3b 0d 0a 09 7d 0d 0a  turn TRUE;...}..
0d90: 09 42 4c 5f 50 52 4f 43 28 51 75 69 63 6b 53 65  .BL_PROC(QuickSe
0da0: 61 72 63 68 46 69 65 6c 64 73 2c 20 22 cf ee eb  archFields, "...
0db0: ff c1 fb f1 f2 f0 ee e3 ee cf ee e8 f1 ea e0 22  ..............."
0dc0: 2c 20 31 29 0d 0a 09 7b 0d 0a 09 09 73 65 74 46  , 1)...{....setF
0dd0: 6c 61 67 4f 6e 46 69 65 6c 64 73 28 70 70 50 61  lagOnFields(ppPa
0de0: 72 61 6d 73 5b 30 5d 2d 3e 47 65 74 53 74 72 69  rams[0]->GetStri
0df0: 6e 67 28 29 2c 20 66 69 65 6c 64 5f 69 6e 66 6f  ng(), field_info
0e00: 3a 3a 71 73 50 6f 73 73 69 62 6c 65 29 3b 0d 0a  ::qsPossible);..
0e10: 09 09 72 65 74 75 72 6e 20 54 52 55 45 3b 0d 0a  ..return TRUE;..
0e20: 09 7d 0d 0a 09 42 4c 5f 46 55 4e 43 28 47 65 74  .}...BL_FUNC(Get
0e30: 51 75 65 72 79 54 65 78 74 2c 20 22 cf ee eb f3  QueryText, "....
0e40: f7 e8 f2 fc d2 e5 ea f1 f2 c7 e0 ef f0 ee f1 e0  ................
0e50: 22 2c 20 31 29 3b 0d 0a 0d 0a 09 42 4c 5f 45 4e  ", 1);.....BL_EN
0e60: 44 5f 43 4f 4e 54 45 58 54 28 29 3b 0d 0a 70 72  D_CONTEXT();..pr
0e70: 69 76 61 74 65 3a 0d 0a 09 65 6e 75 6d 20 71 54  ivate:...enum qT
0e80: 79 70 65 73 7b 71 44 6f 77 6e 2c 20 71 55 70 2c  ypes{qDown, qUp,
0e90: 20 71 54 6f 70 2c 20 71 42 6f 74 74 6f 6d 2c 20   qTop, qBottom, 
0ea0: 71 49 44 2c 20 71 43 75 72 52 6f 77 2c 20 71 51  qID, qCurRow, qQ
0eb0: 75 69 63 6b 53 65 61 72 63 68 2c 20 71 4c 61 73  uickSearch, qLas
0ec0: 74 7d 3b 0d 0a 09 0d 0a 09 73 74 72 75 63 74 20  t};......struct 
0ed0: 73 71 6c 50 61 72 61 6d 53 74 6f 72 65 0d 0a 09  sqlParamStore...
0ee0: 7b 0d 0a 09 09 73 74 72 75 63 74 20 6e 6f 64 65  {....struct node
0ef0: 0d 0a 09 09 7b 0d 0a 09 09 09 6e 6f 64 65 28 63  ....{.....node(c
0f00: 6f 6e 73 74 20 43 56 61 6c 75 65 2a 20 70 56 61  onst CValue* pVa
0f10: 6c 2c 20 69 6e 74 20 6d 29 20 3a 20 76 61 6c 75  l, int m) : valu
0f20: 65 28 2a 70 56 61 6c 29 2c 20 6d 6f 64 28 6d 29  e(*pVal), mod(m)
0f30: 7b 7d 0d 0a 09 09 09 43 56 61 6c 75 65 20 76 61  {}.....CValue va
0f40: 6c 75 65 3b 0d 0a 09 09 09 69 6e 74 20 6d 6f 64  lue;.....int mod
0f50: 3b 0d 0a 09 09 7d 3b 0d 0a 09 09 73 74 72 75 63  ;....};....struc
0f60: 74 20 6e 6f 64 65 5f 64 65 6c 7b 76 6f 69 64 20  t node_del{void 
0f70: 6f 70 65 72 61 74 6f 72 28 29 28 6e 6f 64 65 2a  operator()(node*
0f80: 20 70 29 7b 64 65 6c 65 74 65 20 70 3b 7d 7d 3b   p){delete p;}};
0f90: 0d 0a 09 09 73 74 72 75 63 74 20 73 65 74 74 65  ....struct sette
0fa0: 72 0d 0a 09 09 7b 0d 0a 09 09 09 73 65 74 74 65  r....{.....sette
0fb0: 72 28 53 51 4c 69 74 65 51 75 65 72 79 2a 20 70  r(SQLiteQuery* p
0fc0: 29 20 3a 20 70 51 28 70 29 7b 7d 0d 0a 09 09 09  ) : pQ(p){}.....
0fd0: 53 51 4c 69 74 65 51 75 65 72 79 2a 20 70 51 3b  SQLiteQuery* pQ;
0fe0: 0d 0a 09 09 09 76 6f 69 64 20 6f 70 65 72 61 74  .....void operat
0ff0: 6f 72 28 29 28 63 6f 6e 73 74 20 43 53 74 72 69  or()(const CStri
1000: 6e 67 26 20 6e 61 6d 65 2c 20 6e 6f 64 65 2a 20  ng& name, node* 
1010: 70 29 0d 0a 09 09 09 7b 0d 0a 09 09 09 09 70 51  p).....{......pQ
1020: 2d 3e 73 65 74 53 71 6c 50 61 72 61 6d 28 43 56  ->setSqlParam(CV
1030: 61 6c 75 65 28 6e 61 6d 65 29 2c 20 70 2d 3e 76  alue(name), p->v
1040: 61 6c 75 65 2c 20 70 2d 3e 6d 6f 64 2c 20 46 41  alue, p->mod, FA
1050: 4c 53 45 29 3b 0d 0a 09 09 09 7d 0d 0a 09 09 7d  LSE);.....}....}
1060: 3b 0d 0a 09 09 0d 0a 09 09 43 4e 6f 43 61 73 65  ;........CNoCase
1070: 4d 61 70 3c 6e 6f 64 65 2a 3e 20 6e 6f 64 65 73  Map<node*> nodes
1080: 3b 0d 0a 09 09 44 57 4f 52 44 20 64 69 72 74 79  ;....DWORD dirty
1090: 51 75 65 72 69 65 73 3b 0d 0a 0d 0a 09 09 76 6f  Queries;......vo
10a0: 69 64 20 73 65 74 53 71 6c 50 61 72 61 6d 28 63  id setSqlParam(c
10b0: 6f 6e 73 74 20 43 53 74 72 69 6e 67 26 20 6e 61  onst CString& na
10c0: 6d 65 2c 20 63 6f 6e 73 74 20 43 56 61 6c 75 65  me, const CValue
10d0: 2a 20 70 56 61 6c 2c 20 69 6e 74 20 6d 6f 64 29  * pVal, int mod)
10e0: 0d 0a 09 09 7b 0d 0a 09 09 09 6e 6f 64 65 2a 20  ....{.....node* 
10f0: 70 4e 6f 64 65 3b 0d 0a 09 09 09 69 66 28 6e 6f  pNode;.....if(no
1100: 64 65 73 2e 4c 6f 6f 6b 75 70 28 6e 61 6d 65 2c  des.Lookup(name,
1110: 20 70 4e 6f 64 65 29 29 0d 0a 09 09 09 7b 0d 0a   pNode)).....{..
1120: 09 09 09 09 70 4e 6f 64 65 2d 3e 76 61 6c 75 65  ....pNode->value
1130: 20 3d 20 2a 70 56 61 6c 3b 0d 0a 09 09 09 09 70   = *pVal;......p
1140: 4e 6f 64 65 2d 3e 6d 6f 64 20 3d 20 6d 6f 64 3b  Node->mod = mod;
1150: 0d 0a 09 09 09 7d 0d 0a 09 09 09 65 6c 73 65 0d  .....}.....else.
1160: 0a 09 09 09 09 6e 6f 64 65 73 5b 6e 61 6d 65 5d  .....nodes[name]
1170: 20 3d 20 6e 65 77 20 6e 6f 64 65 28 70 56 61 6c   = new node(pVal
1180: 2c 20 6d 6f 64 29 3b 0d 0a 09 09 09 64 69 72 74  , mod);.....dirt
1190: 79 51 75 65 72 69 65 73 20 3d 20 30 78 46 46 46  yQueries = 0xFFF
11a0: 46 46 46 46 46 3b 0d 0a 09 09 7d 0d 0a 09 09 69  FFFFF;....}....i
11b0: 6e 6c 69 6e 65 20 76 6f 69 64 20 61 70 70 6c 79  nline void apply
11c0: 50 61 72 61 6d 73 54 6f 51 75 65 72 79 28 53 51  ParamsToQuery(SQ
11d0: 4c 69 74 65 51 75 65 72 79 2a 20 70 51 2c 20 69  LiteQuery* pQ, i
11e0: 6e 74 20 74 79 70 65 29 0d 0a 09 09 7b 0d 0a 09  nt type)....{...
11f0: 09 09 69 66 28 74 79 70 65 20 3e 3d 20 30 20 26  ..if(type >= 0 &
1200: 26 20 28 64 69 72 74 79 51 75 65 72 69 65 73 20  & (dirtyQueries 
1210: 26 20 28 31 20 3c 3c 20 74 79 70 65 29 29 20 3d  & (1 << type)) =
1220: 3d 20 30 29 0d 0a 09 09 09 09 72 65 74 75 72 6e  = 0)......return
1230: 3b 0d 0a 09 09 09 6e 6f 64 65 73 2e 46 6f 72 45  ;.....nodes.ForE
1240: 61 63 68 50 61 69 72 28 73 65 74 74 65 72 28 70  achPair(setter(p
1250: 51 29 29 3b 0d 0a 09 09 09 69 66 28 74 79 70 65  Q));.....if(type
1260: 20 3e 3d 20 30 29 0d 0a 09 09 09 09 64 69 72 74   >= 0)......dirt
1270: 79 51 75 65 72 69 65 73 20 26 3d 20 7e 28 31 3c  yQueries &= ~(1<
1280: 3c 74 79 70 65 29 3b 0d 0a 09 09 7d 0d 0a 09 09  <type);....}....
1290: 7e 73 71 6c 50 61 72 61 6d 53 74 6f 72 65 28 29  ~sqlParamStore()
12a0: 0d 0a 09 09 7b 0d 0a 09 09 09 6e 6f 64 65 73 2e  ....{.....nodes.
12b0: 46 6f 72 45 61 63 68 56 61 6c 75 65 28 6e 6f 64  ForEachValue(nod
12c0: 65 5f 64 65 6c 28 29 29 3b 0d 0a 09 09 7d 0d 0a  e_del());....}..
12d0: 09 7d 3b 0d 0a 0d 0a 09 73 74 72 75 63 74 20 66  .};.....struct f
12e0: 69 65 6c 64 5f 69 6e 66 6f 0d 0a 09 7b 0d 0a 09  ield_info...{...
12f0: 09 44 57 4f 52 44 20 70 6f 73 49 6e 51 75 65 72  .DWORD posInQuer
1300: 79 2c 20 66 6c 61 67 73 3b 0d 0a 09 09 74 79 70  y, flags;....typ
1310: 65 73 4f 66 46 69 65 6c 64 73 20 74 79 70 65 3b  esOfFields type;
1320: 0d 0a 09 09 43 53 74 72 69 6e 67 20 65 78 70 72  ....CString expr
1330: 65 73 73 69 6f 6e 2c 20 61 6c 69 61 73 2c 20 6e  ession, alias, n
1340: 61 6d 65 4f 66 51 75 65 72 79 43 6f 6c 75 6d 6e  ameOfQueryColumn
1350: 3b 0d 0a 09 09 65 6e 75 6d 7b 0d 0a 09 09 09 6b  ;....enum{.....k
1360: 65 79 46 69 65 6c 64 20 3d 20 31 2c 20 69 64 46  eyField = 1, idF
1370: 69 65 6c 64 20 3d 20 32 2c 20 4e 6f 41 75 74 6f  ield = 2, NoAuto
1380: 44 65 6c 65 74 65 20 3d 20 34 2c 20 69 6e 55 73  Delete = 4, inUs
1390: 65 20 3d 20 38 2c 20 71 73 50 6f 73 73 69 62 6c  e = 8, qsPossibl
13a0: 65 2c 0d 0a 09 09 7d 3b 0d 0a 09 7d 3b 0d 0a 09  e,....};...};...
13b0: 74 79 70 65 64 65 66 20 43 41 72 72 61 79 3c 66  typedef CArray<f
13c0: 69 65 6c 64 5f 69 6e 66 6f 2c 20 66 69 65 6c 64  ield_info, field
13d0: 5f 69 6e 66 6f 3e 20 46 69 65 6c 64 41 72 72 61  _info> FieldArra
13e0: 79 3b 0d 0a 0d 0a 09 09 0d 0a 09 53 51 4c 69 74  y;.........SQLit
13f0: 65 51 75 65 72 79 2a 09 09 67 65 74 51 75 65 72  eQuery*..getQuer
1400: 79 28 71 54 79 70 65 73 20 74 79 70 65 29 3b 0d  y(qTypes type);.
1410: 0a 09 76 6f 69 64 09 09 09 09 63 6c 65 61 72 52  ..void....clearR
1420: 6f 77 73 28 29 3b 0d 0a 09 76 6f 69 64 09 09 09  ows();...void...
1430: 09 63 6c 65 61 72 51 75 65 72 69 65 73 44 61 74  .clearQueriesDat
1440: 61 28 29 3b 0d 0a 09 76 6f 69 64 09 09 09 09 63  a();...void....c
1450: 6c 65 61 72 41 6c 6c 28 29 3b 0d 0a 09 76 6f 69  learAll();...voi
1460: 64 09 09 09 09 62 69 6e 64 4b 65 79 56 61 6c 75  d....bindKeyValu
1470: 65 73 28 53 51 4c 69 74 65 51 75 65 72 79 2a 20  es(SQLiteQuery* 
1480: 70 51 75 65 72 79 2c 20 53 51 4c 69 74 65 44 61  pQuery, SQLiteDa
1490: 74 61 52 6f 77 2a 20 70 52 6f 77 29 3b 0d 0a 09  taRow* pRow);...
14a0: 44 57 4f 52 44 09 09 09 09 66 69 65 6c 64 73 49  DWORD....fieldsI
14b0: 6e 66 6f 43 6f 75 6e 74 28 29 20 63 6f 6e 73 74  nfoCount() const
14c0: 09 09 09 09 7b 20 72 65 74 75 72 6e 20 6d 5f 66  ....{ return m_f
14d0: 69 65 6c 64 73 49 6e 66 6f 43 6f 75 6e 74 3b 20  ieldsInfoCount; 
14e0: 7d 0d 0a 09 63 6f 6e 73 74 20 66 69 65 6c 64 5f  }...const field_
14f0: 69 6e 66 6f 26 09 66 69 65 6c 64 49 6e 66 6f 28  info&.fieldInfo(
1500: 44 57 4f 52 44 20 69 64 78 29 20 63 6f 6e 73 74  DWORD idx) const
1510: 09 09 09 7b 20 72 65 74 75 72 6e 20 6d 5f 66 69  ...{ return m_fi
1520: 65 6c 64 73 49 6e 66 6f 5b 69 64 78 5d 3b 20 7d  eldsInfo[idx]; }
1530: 0d 0a 09 44 57 4f 52 44 09 09 09 09 6b 65 79 46  ...DWORD....keyF
1540: 69 65 6c 64 73 43 6f 75 6e 74 28 29 20 63 6f 6e  ieldsCount() con
1550: 73 74 09 09 09 09 7b 20 72 65 74 75 72 6e 20 6d  st....{ return m
1560: 5f 6b 65 79 46 69 65 6c 64 43 6f 75 6e 74 3b 7d  _keyFieldCount;}
1570: 0d 0a 09 63 6f 6e 73 74 20 43 53 74 72 69 6e 67  ...const CString
1580: 26 09 09 6b 65 79 53 51 4c 50 61 72 61 6d 4e 61  &..keySQLParamNa
1590: 6d 65 28 44 57 4f 52 44 20 69 64 78 29 20 63 6f  me(DWORD idx) co
15a0: 6e 73 74 09 7b 20 72 65 74 75 72 6e 20 6d 5f 6b  nst.{ return m_k
15b0: 65 79 50 61 72 61 6d 4e 61 6d 65 73 5b 69 64 78  eyParamNames[idx
15c0: 5d 3b 20 7d 0d 0a 09 44 57 4f 52 44 09 09 09 09  ]; }...DWORD....
15d0: 69 64 46 69 65 6c 64 50 6f 73 28 29 20 63 6f 6e  idFieldPos() con
15e0: 73 74 09 09 09 09 09 7b 20 72 65 74 75 72 6e 20  st.....{ return 
15f0: 6d 5f 69 64 46 69 65 6c 64 50 6f 73 3b 20 7d 0d  m_idFieldPos; }.
1600: 0a 09 76 6f 69 64 09 09 09 09 73 65 74 43 6f 6c  ..void....setCol
1610: 75 6d 6e 73 43 68 61 6e 67 65 64 28 29 3b 0d 0a  umnsChanged();..
1620: 09 76 6f 69 64 09 09 09 09 73 65 74 46 6c 61 67  .void....setFlag
1630: 4f 6e 46 69 65 6c 64 73 28 63 6f 6e 73 74 20 43  OnFields(const C
1640: 53 74 72 69 6e 67 26 20 66 69 65 6c 64 73 2c 20  String& fields, 
1650: 69 6e 74 20 66 6c 61 67 29 3b 0d 0a 0d 0a 09 43  int flag);.....C
1660: 53 4c 44 61 74 61 42 61 73 65 2a 09 09 6d 5f 70  SLDataBase*..m_p
1670: 44 61 74 61 42 61 73 65 3b 09 09 2f 2f 20 c1 e0  DataBase;..// ..
1680: e7 e0 20 e4 e0 ed ed fb f5 0d 0a 09 53 51 4c 69  .. .........SQLi
1690: 74 65 51 75 65 72 79 2a 09 09 6d 5f 71 75 65 72  teQuery*..m_quer
16a0: 69 65 73 5b 71 4c 61 73 74 5d 3b 09 2f 2f 20 d2  ies[qLast];.// .
16b0: f3 f2 20 eb e5 e6 e0 f2 20 ef ee e4 e3 ee f2 ee  .. ..... .......
16c0: e2 eb e5 ed ed fb e5 20 e7 e0 ef f0 ee f1 fb 0d  ....... ........
16d0: 0a 09 4d 65 74 61 50 61 72 73 65 72 09 09 09 6d  ..MetaParser...m
16e0: 5f 6d 65 74 61 50 61 72 73 65 72 3b 09 09 2f 2f  _metaParser;..//
16f0: 20 c4 eb ff 20 f5 f0 e0 ed e5 ed e8 ff 20 f2 e5   ... ........ ..
1700: ea f1 f2 ee e2 fb f5 20 ef ee e4 f1 f2 e0 ed ee  ....... ........
1710: e2 ee ea 0d 0a 09 73 71 6c 50 61 72 61 6d 53 74  ......sqlParamSt
1720: 6f 72 65 09 09 6d 5f 73 71 6c 50 61 72 61 6d 73  ore..m_sqlParams
1730: 3b 09 09 2f 2f 20 c4 eb ff 20 f5 f0 e0 ed e5 ed  ;..// ... ......
1740: e8 ff 20 73 71 6c 2d ef e0 f0 e0 ec e5 f2 f0 ee  .. sql-.........
1750: e2 0d 0a 09 52 6f 77 73 41 72 72 61 79 09 09 09  ....RowsArray...
1760: 6d 5f 72 6f 77 73 3b 09 09 09 09 2f 2f 20 cf ee  m_rows;....// ..
1770: eb f3 f7 e5 ed ed fb e5 20 f1 f2 f0 ee ea e8 20  ........ ...... 
1780: e2 fb ef ee eb ed e5 ed ed ee e3 ee 20 e7 e0 ef  ............ ...
1790: f0 ee f1 e0 0d 0a 09 4c 50 43 53 54 52 2a 09 09  .......LPCSTR*..
17a0: 09 09 6d 5f 71 75 65 72 79 46 69 65 6c 64 73 4e  ..m_queryFieldsN
17b0: 61 6d 65 73 3b 09 2f 2f 20 cf f0 ee f1 f2 ee 20  ames;.// ...... 
17c0: e8 ec e5 ed e0 20 ea ee eb ee ed ee ea 20 f2 e5  ..... ....... ..
17d0: ea f3 f9 e5 e3 ee 20 e7 e0 ef f0 ee f1 e0 0d 0a  ...... .........
17e0: 09 43 53 74 72 69 6e 67 2a 09 09 09 6d 5f 6b 65  .CString*...m_ke
17f0: 79 50 61 72 61 6d 4e 61 6d 65 73 3b 09 2f 2f 20  yParamNames;.// 
1800: c8 ec e5 ed e0 20 53 51 4c 2d ef e0 f0 e0 ec e5  ..... SQL-......
1810: f2 f0 ee e2 20 e4 eb ff 20 ea eb fe f7 e5 e9 0d  .... ... .......
1820: 0a 09 66 69 65 6c 64 5f 69 6e 66 6f 2a 09 09 09  ..field_info*...
1830: 6d 5f 66 69 65 6c 64 73 49 6e 66 6f 3b 09 09 2f  m_fieldsInfo;../
1840: 2f 20 cc e0 f1 f1 e8 e2 20 f1 20 ee ef e8 f1 e0  / ...... . .....
1850: ed e8 e5 ec 20 e2 f1 e5 f5 20 ef ee eb e5 e9 20  .... .... ..... 
1860: e7 e0 ef f0 ee f1 e0 0d 0a 09 44 57 4f 52 44 09  ..........DWORD.
1870: 09 09 09 6d 5f 66 69 65 6c 64 73 49 6e 66 6f 43  ...m_fieldsInfoC
1880: 6f 75 6e 74 3b 09 2f 2f 20 ca ee eb e8 f7 e5 f1  ount;.// .......
1890: f2 e2 ee 20 e2 f1 e5 f5 20 ef ee eb e5 e9 20 e7  ... .... ..... .
18a0: e0 ef f0 ee f1 e0 0d 0a 09 44 57 4f 52 44 09 09  .........DWORD..
18b0: 09 09 6d 5f 6b 65 79 46 69 65 6c 64 43 6f 75 6e  ..m_keyFieldCoun
18c0: 74 3b 09 2f 2f 20 ca ee eb e8 f7 e5 f1 f2 e2 ee  t;.// ..........
18d0: 20 ea eb fe f7 e5 e2 fb f5 20 ef ee eb e5 e9 0d   ........ ......
18e0: 0a 09 44 57 4f 52 44 09 09 09 09 6d 5f 69 64 46  ..DWORD....m_idF
18f0: 69 65 6c 64 50 6f 73 3b 09 09 2f 2f 20 cd ee ec  ieldPos;..// ...
1900: e5 f0 20 e8 e4 2d ef ee eb ff 20 e2 20 f1 ef e8  .. ..-.... . ...
1910: f1 ea e5 20 e2 f1 e5 f5 20 ef ee eb e5 e9 0d 0a  ... .... .......
1920: 09 44 57 4f 52 44 09 09 09 09 6d 5f 63 6f 75 6e  .DWORD....m_coun
1930: 74 4f 66 43 6f 6c 75 6d 6e 73 3b 09 2f 2f 20 ca  tOfColumns;.// .
1940: ee eb e8 f7 e5 f1 f2 e2 ee 20 ea ee eb ee ed ee  ......... ......
1950: ea 20 e2 20 f2 e5 ea f3 f9 e5 ec 20 e7 e0 ef f0  . . ....... ....
1960: ee f1 e5 0d 0a 09 42 4f 4f 4c 09 09 09 09 6d 5f  ......BOOL....m_
1970: 64 65 62 75 67 3b 09 09 09 2f 2f 20 d4 eb e0 e3  debug;...// ....
1980: 20 ee f2 eb e0 e4 ea e8 0d 0a 09 66 69 65 6c 64   ..........field
1990: 5f 69 6e 66 6f 2a 09 09 09 6d 5f 6c 61 73 74 51  _info*...m_lastQ
19a0: 53 43 6f 6c 75 6d 6e 3b 09 09 2f 2f 20 c4 eb ff  SColumn;..// ...
19b0: 20 ea ee f2 ee f0 ee e3 ee 20 ef ee eb ff 20 ef   ........ .... .
19c0: ee e4 e3 ee f2 ee e2 eb e5 ed 20 e7 e0 ef f0 ee  .......... .....
19d0: f1 20 e1 fb f1 f2 f0 ee e3 ee 20 ef ee e8 f1 ea  . ........ .....
19e0: e0 0d 0a 09 44 57 4f 52 44 09 09 09 09 6d 5f 51  ....DWORD....m_Q
19f0: 53 43 6f 6c 75 6d 6e 3b 09 09 09 2f 2f 20 cd ee  SColumn;...// ..
1a00: ec e5 f0 20 ea ee eb ee ed ea e8 20 e2 20 e7 e0  ... ....... . ..
1a10: ef f0 ee f1 e5 20 e1 fb f1 f2 f0 ee e3 ee 20 ef  ..... ........ .
1a20: ee e8 f1 ea e0 2c 20 e2 20 ea ee f2 ee f0 ee ec  ....., . .......
1a30: 20 e8 f1 ea e0 f2 fc 0d 0a 09 43 53 74 72 69 6e   .........CStrin
1a40: 67 09 09 09 09 6d 5f 73 65 6c 65 63 74 3b 09 09  g....m_select;..
1a50: 09 2f 2f 20 73 65 6c 65 63 74 2d eb e8 f1 f2 20  .// select-.... 
1a60: f1 20 ef ee eb ff ec e8 2c 20 e2 f5 ee e4 ff f9  . ......, ......
1a70: e8 ec e8 20 e2 20 f2 e5 ea f3 f9 e8 e9 20 e7 e0  ... . ....... ..
1a80: ef f0 ee f1 0d 0a 09 43 53 74 72 69 6e 67 09 09  .......CString..
1a90: 09 09 6d 5f 66 72 6f 6d 3b 09 09 09 09 2f 2f 20  ..m_from;....// 
1aa0: f7 e0 f1 f2 fc 20 66 72 6f 6d 20 e7 e0 ef f0 ee  ..... from .....
1ab0: f1 e0 0d 0a 09 43 53 74 72 69 6e 67 09 09 09 09  .....CString....
1ac0: 6d 5f 77 68 65 72 65 3b 09 09 09 2f 2f 20 f7 e0  m_where;...// ..
1ad0: f1 f2 fc 20 77 68 65 72 65 20 e7 e0 ef f0 ee f1  ... where ......
1ae0: e0 0d 0a 09 43 4e 6f 43 61 73 65 4d 61 70 3c 66  ....CNoCaseMap<f
1af0: 69 65 6c 64 5f 69 6e 66 6f 2a 3e 09 6d 5f 66 69  ield_info*>.m_fi
1b00: 65 6c 64 42 79 4e 61 6d 65 3b 09 2f 2f 20 c4 eb  eldByName;.// ..
1b10: ff 20 ef ee e8 f1 ea e0 20 e8 ed f4 fb 20 ef ee  . ...... .... ..
1b20: 20 e8 ec e5 ed e8 20 ea ee eb ee ed ea e8 0d 0a   ..... .........
1b30: 7d 3b 0d 0a 0d 0a 63 6c 61 73 73 20 53 69 6d 70  };....class Simp
1b40: 6c 65 52 65 73 75 6c 74 4c 6f 61 64 65 72 20 3a  leResultLoader :
1b50: 20 20 70 75 62 6c 69 63 20 43 42 4c 43 6f 6e 74    public CBLCont
1b60: 65 78 74 2c 20 70 75 62 6c 69 63 20 49 53 51 4c  ext, public ISQL
1b70: 69 74 65 52 65 73 75 6c 74 4c 6f 61 64 65 72 0d  iteResultLoader.
1b80: 0a 7b 0d 0a 70 75 62 6c 69 63 3a 0d 0a 09 76 69  .{..public:...vi
1b90: 72 74 75 61 6c 20 44 57 4f 52 44 20 69 6e 69 74  rtual DWORD init
1ba0: 28 44 57 4f 52 44 20 63 6f 6c 43 6f 75 6e 74 49  (DWORD colCountI
1bb0: 6e 52 65 73 75 6c 74 2c 20 73 71 6c 69 74 65 33  nResult, sqlite3
1bc0: 2a 20 70 42 61 73 65 2c 20 43 56 61 6c 75 65 2a  * pBase, CValue*
1bd0: 20 70 50 61 72 61 6d 29 0d 0a 09 7b 0d 0a 09 09   pParam)...{....
1be0: 72 65 74 75 72 6e 20 6d 5f 63 6f 75 6e 74 20 3d  return m_count =
1bf0: 20 63 6f 6c 43 6f 75 6e 74 49 6e 52 65 73 75 6c   colCountInResul
1c00: 74 3b 0d 0a 09 7d 0d 0a 09 76 69 72 74 75 61 6c  t;...}...virtual
1c10: 20 76 6f 69 64 20 73 65 74 43 6f 6c 75 6d 6e 28   void setColumn(
1c20: 44 57 4f 52 44 20 63 6f 6c 49 64 78 2c 20 63 6f  DWORD colIdx, co
1c30: 6e 73 74 20 43 53 74 72 69 6e 67 26 20 63 6f 6c  nst CString& col
1c40: 4e 61 6d 65 2c 20 63 6f 6e 73 74 20 43 54 79 70  Name, const CTyp
1c50: 65 26 20 74 79 70 65 29 7b 7d 0d 0a 09 76 69 72  e& type){}...vir
1c60: 74 75 61 6c 20 76 6f 69 64 20 61 73 73 69 67 6e  tual void assign
1c70: 52 65 74 56 61 6c 75 65 28 43 56 61 6c 75 65 26  RetValue(CValue&
1c80: 20 72 65 74 56 61 6c 29 7b 7d 0d 0a 0d 0a 09 76   retVal){}.....v
1c90: 6f 69 64 20 65 78 65 63 75 74 65 28 53 51 4c 69  oid execute(SQLi
1ca0: 74 65 51 75 65 72 79 2a 20 70 51 75 65 72 79 29  teQuery* pQuery)
1cb0: 0d 0a 09 7b 0d 0a 09 09 43 56 61 6c 75 65 20 6d  ...{....CValue m
1cc0: 65 3b 0d 0a 09 09 6d 65 2e 74 79 70 65 20 3d 20  e;....me.type = 
1cd0: 31 30 30 3b 0d 0a 09 09 6d 65 2e 6d 5f 43 6f 6e  100;....me.m_Con
1ce0: 74 65 78 74 20 3d 20 74 68 69 73 3b 0d 0a 09 09  text = this;....
1cf0: 70 51 75 65 72 79 2d 3e 65 78 65 63 75 74 65 28  pQuery->execute(
1d00: 26 6d 65 2c 20 4e 55 4c 4c 2c 20 43 56 61 6c 75  &me, NULL, CValu
1d10: 65 28 29 29 3b 0d 0a 09 09 6d 65 2e 6d 5f 43 6f  e());....me.m_Co
1d20: 6e 74 65 78 74 20 3d 20 4e 55 4c 4c 3b 0d 0a 09  ntext = NULL;...
1d30: 7d 0d 0a 70 72 6f 74 65 63 74 65 64 3a 0d 0a 09  }..protected:...
1d40: 44 57 4f 52 44 20 6d 5f 63 6f 75 6e 74 3b 0d 0a  DWORD m_count;..
1d50: 7d 3b 0d 0a 0d 0a 63 6c 61 73 73 20 44 61 74 61  };....class Data
1d60: 50 72 6f 76 69 64 65 72 52 65 73 75 6c 74 4c 6f  ProviderResultLo
1d70: 61 64 65 72 20 3a 20 70 75 62 6c 69 63 20 53 69  ader : public Si
1d80: 6d 70 6c 65 52 65 73 75 6c 74 4c 6f 61 64 65 72  mpleResultLoader
1d90: 0d 0a 7b 0d 0a 70 75 62 6c 69 63 3a 0d 0a 09 44  ..{..public:...D
1da0: 61 74 61 50 72 6f 76 69 64 65 72 52 65 73 75 6c  ataProviderResul
1db0: 74 4c 6f 61 64 65 72 28 53 51 4c 69 74 65 44 61  tLoader(SQLiteDa
1dc0: 74 61 50 72 6f 76 69 64 65 72 2a 20 70 50 72 6f  taProvider* pPro
1dd0: 76 69 64 65 72 2c 20 52 6f 77 73 41 72 72 61 79  vider, RowsArray
1de0: 2a 20 70 44 65 73 74 29 0d 0a 09 09 3a 6d 5f 70  * pDest)....:m_p
1df0: 50 72 6f 76 69 64 65 72 28 70 50 72 6f 76 69 64  Provider(pProvid
1e00: 65 72 29 2c 20 6d 5f 70 44 65 73 74 69 6e 61 74  er), m_pDestinat
1e10: 69 6f 6e 28 70 44 65 73 74 29 7b 7d 0d 0a 09 76  ion(pDest){}...v
1e20: 69 72 74 75 61 6c 20 76 6f 69 64 20 61 64 64 56  irtual void addV
1e30: 61 6c 75 65 73 28 43 56 61 6c 75 65 2a 2a 20 70  alues(CValue** p
1e40: 70 56 61 6c 75 65 73 29 3b 0d 0a 70 72 6f 74 65  pValues);..prote
1e50: 63 74 65 64 3a 0d 0a 09 53 51 4c 69 74 65 44 61  cted:...SQLiteDa
1e60: 74 61 50 72 6f 76 69 64 65 72 2a 20 6d 5f 70 50  taProvider* m_pP
1e70: 72 6f 76 69 64 65 72 3b 0d 0a 09 52 6f 77 73 41  rovider;...RowsA
1e80: 72 72 61 79 2a 20 6d 5f 70 44 65 73 74 69 6e 61  rray* m_pDestina
1e90: 74 69 6f 6e 3b 0d 0a 7d 3b 0d 0a 0d 0a 63 6c 61  tion;..};....cla
1ea0: 73 73 20 51 75 69 63 6b 53 65 61 72 63 68 52 65  ss QuickSearchRe
1eb0: 73 75 6c 74 4c 6f 61 64 65 72 20 3a 20 70 75 62  sultLoader : pub
1ec0: 6c 69 63 20 53 69 6d 70 6c 65 52 65 73 75 6c 74  lic SimpleResult
1ed0: 4c 6f 61 64 65 72 0d 0a 7b 0d 0a 70 75 62 6c 69  Loader..{..publi
1ee0: 63 3a 0d 0a 09 51 75 69 63 6b 53 65 61 72 63 68  c:...QuickSearch
1ef0: 52 65 73 75 6c 74 4c 6f 61 64 65 72 28 63 6f 6e  ResultLoader(con
1f00: 73 74 20 43 53 74 72 69 6e 67 26 20 70 2c 20 43  st CString& p, C
1f10: 56 61 6c 75 65 2a 20 6b 65 79 73 2c 20 44 57 4f  Value* keys, DWO
1f20: 52 44 20 6b 63 2c 20 44 57 4f 52 44 20 74 66 29  RD kc, DWORD tf)
1f30: 0d 0a 09 09 3a 6d 5f 70 61 74 74 65 72 6e 28 70  ....:m_pattern(p
1f40: 29 2c 20 6d 5f 70 42 65 73 74 4b 65 79 28 6b 65  ), m_pBestKey(ke
1f50: 79 73 29 2c 20 6d 5f 6b 65 79 73 43 6f 75 6e 74  ys), m_keysCount
1f60: 28 6b 63 29 2c 0d 0a 09 09 6d 5f 74 65 73 74 46  (kc),....m_testF
1f70: 69 65 6c 64 28 74 66 29 2c 20 6d 5f 6d 61 78 53  ield(tf), m_maxS
1f80: 79 6d 62 6f 6c 73 28 30 29 0d 0a 09 7b 0d 0a 09  ymbols(0)...{...
1f90: 7d 0d 0a 09 76 69 72 74 75 61 6c 20 76 6f 69 64  }...virtual void
1fa0: 20 61 64 64 56 61 6c 75 65 73 28 43 56 61 6c 75   addValues(CValu
1fb0: 65 2a 2a 20 70 70 56 61 6c 75 65 73 29 3b 0d 0a  e** ppValues);..
1fc0: 0d 0a 09 69 6e 74 20 66 69 6e 64 28 53 51 4c 69  ...int find(SQLi
1fd0: 74 65 51 75 65 72 79 2a 20 70 51 75 65 72 79 29  teQuery* pQuery)
1fe0: 0d 0a 09 7b 0d 0a 09 09 49 6e 63 72 52 65 66 28  ...{....IncrRef(
1ff0: 29 3b 0d 0a 09 09 74 72 79 7b 20 65 78 65 63 75  );....try{ execu
2000: 74 65 28 70 51 75 65 72 79 29 3b 20 7d 20 63 61  te(pQuery); } ca
2010: 74 63 68 28 69 6e 74 29 7b 7d 0d 0a 09 09 72 65  tch(int){}....re
2020: 74 75 72 6e 20 6d 5f 6d 61 78 53 79 6d 62 6f 6c  turn m_maxSymbol
2030: 73 3b 0d 0a 09 7d 0d 0a 0d 0a 70 72 6f 74 65 63  s;...}....protec
2040: 74 65 64 3a 0d 0a 09 63 6f 6e 73 74 20 43 53 74  ted:...const CSt
2050: 72 69 6e 67 26 20 6d 5f 70 61 74 74 65 72 6e 3b  ring& m_pattern;
2060: 0d 0a 09 43 56 61 6c 75 65 2a 20 6d 5f 70 42 65  ...CValue* m_pBe
2070: 73 74 4b 65 79 3b 0d 0a 09 69 6e 74 20 6d 5f 6d  stKey;...int m_m
2080: 61 78 53 79 6d 62 6f 6c 73 3b 0d 0a 09 44 57 4f  axSymbols;...DWO
2090: 52 44 20 6d 5f 6b 65 79 73 43 6f 75 6e 74 2c 20  RD m_keysCount, 
20a0: 6d 5f 74 65 73 74 46 69 65 6c 64 3b 0d 0a 7d 3b  m_testField;..};
20b0: 0d 0a                                            ..