asisdata.h 175 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. // Name: asisdata.h ast_asi_inc_appl_asisdata_h
  11. //
  12. // Description: Basic SQL data definitions for ASI.
  13. // ASI C++ User Interface.
  14. #ifndef ASI_SDATA_HH
  15. #define ASI_SDATA_HH asisdata.hh
  16. #define AST_DEPRECATE_TEXT "This function is deprecated. Consider using another overload of this function."
  17. #define AST_DEPRECATE __declspec(deprecated(AST_DEPRECATE_TEXT))
  18. ///////////////////////////////////////////////////////////////////////////
  19. // INCLUDES
  20. ///////////////////////////////////////////////////////////////////////////
  21. #include <oledb.h>
  22. // If the compiler version is lower than VC7 LARGE_INTEGER is defined in largeint.h
  23. // VC7 Platform SDK defines LARGE_INTEGER in winnt.h
  24. #if _MSC_VER < 1300
  25. #include <largeint.h>
  26. #else
  27. #include <winnt.h>
  28. #endif
  29. #include "asisys.h"
  30. ///////////////////////////////////////////////////////////////////////////
  31. // FORWARD DEFINITIONS
  32. ///////////////////////////////////////////////////////////////////////////
  33. // ASI Class Hierarchy
  34. //
  35. class DLLScope CAsiObject; // Superclass for all classes
  36. class DLLScope CAsiIdent; // Identifier
  37. class DLLScope CAsiData; // ASI Data generic class
  38. class DLLScope CAsiNum; // Numeric data
  39. class DLLScope CAsiExactNum; // Exact numeric data
  40. class DLLScope CAsiSmallInt; // Small Integer
  41. class DLLScope CAsiInt; // Integer
  42. class DLLScope CAsiNumeric; // Numeric
  43. class DLLScope CAsiDecimal; // Decimal
  44. class DLLScope CAsiApproxNum; // Approximate numeric data
  45. class DLLScope CAsiFloat; // Float
  46. class DLLScope CAsiReal; // Real
  47. class DLLScope CAsiDouble; // Double precision
  48. class DLLScope CAsiChar; // Character
  49. class DLLScope CAsiBinary; // Bit
  50. class DLLScope CAsiIQualifier; // Interval qualifier
  51. class DLLScope CAsiInterval; // Interval
  52. class DLLScope CAsiYM; // Year month intervals
  53. class DLLScope CAsiDT; // Day Time intervals
  54. class DLLScope CAsiDatetime; // Datetime data
  55. class DLLScope CAsiDate; // Date
  56. class DLLScope CAsiTime; // Time
  57. class DLLScope CAsiTimeStamp; // Timestamp
  58. class DLLScope CAsiBlob; // OLEDB BLOBs
  59. class DLLScope CAsiColumn; // Column definition
  60. class DLLScope CAsiRow; // Array of columns
  61. class DLLScope CAsiHostBuffer; // Host program buffer
  62. class DLLScope CAsiParameter; // Parameter desriptor
  63. class DLLScope CAsiImplDefFunc; // Function
  64. // Class collections
  65. class DLLScope CAsiIRow; // Array of data pointers
  66. class DLLScope CAsiList; // List of CAsiObject's
  67. class DLLScope CAsiUcStr; // Unicode string
  68. class DLLScope CAsiUcChar; // Unicode character
  69. class DLLScope CAsiObjPack; // Communication buffer access
  70. typedef char ASIBCD [34]; // Decimal number
  71. // bcd[0] actual scale
  72. // bcd[1] sign
  73. // bcd[2-33] 32 digits unpacked BCD
  74. #include "asiconst.h"
  75. #include "asiucode.h"
  76. #pragma pack (push, 8)
  77. ///////////////////////////////////////////////////////////////////////////
  78. class CAsiObject
  79. //
  80. // This class is a principal base class for ALL ASI classes. It provides
  81. // services for memory management by reloading new and delete operators.
  82. //
  83. {
  84. public:
  85. CAsiObject (void);
  86. virtual ~CAsiObject (void);
  87. void* operator new (size_t);
  88. void operator delete (void*);
  89. #if defined(__WATCOMC__)
  90. void* operator new[] (unsigned int);
  91. void operator delete[] (void*);
  92. #endif /* __WATCOMC__ */
  93. // Duplicate
  94. //
  95. virtual CAsiObject * duplicate (void) const;
  96. // Nullify all members
  97. //
  98. virtual void Clear (void);
  99. // Runtime class iteraction functions. Used internaly
  100. //
  101. virtual unsigned long packSize (void) const;
  102. virtual unsigned long packTo (CAsiObjPack *) const;
  103. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  104. virtual unsigned long packValueSize (void) const;
  105. virtual unsigned long packValueTo (CAsiObjPack *) const;
  106. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  107. };
  108. ////////////////////////////////////////////////////////////////////////////////
  109. class CAsiIdent : public CAsiObject
  110. //
  111. // SQL Identifier. Most SQL names are represented as identifiers.
  112. // Identifier can be regular and delimitered.
  113. //
  114. // Regular identifier body must begin from the letter and contain
  115. // letters, underscope, and digits. ASI convertes regular
  116. // identifier body to upper case.
  117. // Delimited identifier can contain arbitrary symbol. In
  118. // SQL statements delimeted identifiers are enclosed into double
  119. // quotas
  120. //
  121. {
  122. public:
  123. // Construct identifier
  124. //
  125. CAsiIdent (void);
  126. CAsiIdent (const char *);
  127. CAsiIdent (const AsiUcStr);
  128. CAsiIdent (const CAsiUcStr &);
  129. CAsiIdent (const CAsiUcStr &, const CAsiUcStr &);
  130. CAsiIdent (const CAsiIdent &);
  131. virtual ~CAsiIdent (void);
  132. // Set and get identifier value
  133. //
  134. void set (EAsiBoolean,
  135. const CAsiUcStr &,
  136. const CAsiUcStr &);
  137. void setDelimited (EAsiBoolean);
  138. void setDelimited (void);
  139. void setCharSet (const CAsiUcStr &);
  140. // fParse = false, do not parse body. store it as it is
  141. void setBody (const CAsiUcStr &, EAsiBoolean fParse = kAsiTrue);
  142. EAsiBoolean isDelimited (void) const; // True if delimitered identifier
  143. const CAsiUcStr & CharSet (void) const;
  144. const CAsiUcStr & Body (void) const;
  145. // Length of Identifer (inc. introducer, char set name and
  146. // identifier itself
  147. int Length (void) const;
  148. // Clear components
  149. //
  150. virtual void Clear (void);
  151. // Operators
  152. //
  153. CAsiIdent & operator= (const CAsiIdent &); // Assign another identifier
  154. CAsiIdent & operator= (const CAsiUcStr &); // Assign regular identifier
  155. int operator== (const CAsiIdent &) const;
  156. // Print identifier
  157. //
  158. void ToString (CAsiUcStr *) const; // Append identifier to string
  159. // Duplicate
  160. //
  161. virtual CAsiObject * duplicate (void) const;
  162. // Runtime class iteraction functions
  163. //
  164. virtual unsigned long packSize (void) const;
  165. virtual unsigned long packTo (CAsiObjPack *) const;
  166. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  167. private:
  168. EAsiBoolean isDelim; // Is delimited identifier
  169. CAsiUcStr charset; // Character set name
  170. CAsiUcStr ident; // Identifier body
  171. };
  172. ////////////////////////////////////////////////////////////////////
  173. //
  174. // ASI Data classes
  175. //
  176. /////////////////////////////////////////////////////////////////////////
  177. //
  178. //
  179. //
  180. class CAsiData : public CAsiObject
  181. //
  182. // SQL Data
  183. //
  184. //
  185. // This class is a base class for all ASI data classes.
  186. // The basic functionality of it comprise the foolowing:
  187. // - Getting data type descriptor;
  188. // - Getting value in specified format;
  189. // - Storing value provided in arbitrary format;
  190. // - NULL value manipulating;
  191. // - Self duplicating
  192. //
  193. //
  194. // MEMBER FUNCTIONS:
  195. // -----------------
  196. //
  197. // Get data descriptor
  198. //
  199. // EAsiDataType Type (void) // type of data
  200. // EAsiDTType DateTimeType (void) // Datetime type
  201. // EAsiIType IntervalType (void) // Interval type
  202. // int ImplDataType (void) // Implemetation defined type
  203. // uint Length (void) // Length of character or bit data
  204. // uint Precision (void) // Precision
  205. // uint Scale (void) // Scale
  206. // uint TimePrec (void) // Time Precision
  207. // uint TimeStampPrec (void) // Timestamp precision
  208. // uint LeadFieldPrec (void) // Leading field precision
  209. // uint FracSecPrec (void) // Fractional second precision
  210. // uint ReturnLength (void) // Actual length of data
  211. //
  212. // The functions listed above allow to retrieve desription of the
  213. // the SQL data in terms of SQL. They are pure virtual functions,
  214. // actual transaltion of internal data descriptioon to the SQL data description
  215. // is done by the derived classes.
  216. //
  217. //
  218. // NULL value manipulation
  219. //
  220. // void setNull (void)
  221. //
  222. // Set internal data to NULL value (absence of value)
  223. //
  224. //
  225. // EAsiBoolean isNull (void) const
  226. //
  227. // Return kAsiTrue if data is NULL and kAsiFalse otherwise
  228. //
  229. //
  230. // Store Data value
  231. //
  232. // virtual EAsiBoolean storeValue (...);
  233. //
  234. // These functions allow to store data into class derived from
  235. // the CAsiData. Source data is converted to the actual type of the CAsiData
  236. // If conversion is possible and data was successfully stored and kAsiTrue is
  237. // returned, if conversion is impossible, kAsiFalse is returned.
  238. //
  239. //
  240. // Get data value
  241. //
  242. // virtual void getValue (...)
  243. //
  244. // Store value of the CAsiData object into destination buffer and perform all
  245. // needed converisons. If operation succeeded, kAsiTrue is returned, if not
  246. // kSiFalse is returned and contents of destination buffer is undefined.
  247. // If null value is stored, destination buffer contents is undefined.
  248. //
  249. // EAsiBoolean SQLType (CAsiUcStr * dst) const
  250. // EAsiBoolean SQLLiteral (CAsiUcStr * dst) const
  251. //
  252. // This functions stores SQL data type string and SQL literal into destination
  253. // buffer. For example, for Year to month interval first function will
  254. // return INTERVAL YEAR TO MONTH, the second one - INTERVAL 'yy-dd' YEAR TO MONTH
  255. //
  256. // Duplicate
  257. //
  258. // virtual CAsiObject *duplicate (void) const
  259. //
  260. // Create duplicate of the CAsiData object.
  261. //
  262. //
  263. // Operations with the Internal Data (Operators)
  264. //
  265. // Each class derived from CAsiData defines a set of functions that
  266. // perform certain operations with it. These functions comprise:
  267. // - assignment operator;
  268. // - arithmetics operator;
  269. // - data specific operations
  270. //
  271. // For more details see appropriate class definition.
  272. //
  273. //
  274. {
  275. friend class CAsiColumn;
  276. public:
  277. // Construction destruction
  278. //
  279. CAsiData (void);
  280. virtual ~CAsiData (void);
  281. // Get data descriptor
  282. //
  283. virtual EAsiDataType Type (void) const = 0; // type of data
  284. virtual EAsiDTType DateTimeType (void) const; // Datetime type
  285. virtual EAsiIType IntervalType (void) const; // Interval type
  286. virtual int ImplDataType (void) const; // Implemetation defined type
  287. virtual uint Length (void) const; // Length of character or bit data
  288. virtual uint Precision (void) const; // Precision
  289. virtual uint Scale (void) const; // Scale
  290. virtual uint TimePrec (void) const; // Time Precision
  291. virtual uint TimeStampPrec (void) const; // Timestamp precision
  292. virtual uint LeadFieldPrec (void) const; // Leading field precision
  293. virtual uint FracSecPrec (void) const; // Fractional second precision
  294. virtual uint ReturnLength (void) const; // Actual length of data
  295. // is_ functions
  296. //
  297. virtual EAsiBoolean is_numeric (void) const;
  298. virtual EAsiBoolean is_exactnumeric (void) const;
  299. virtual EAsiBoolean is_approxnumeric (void) const;
  300. virtual EAsiBoolean is_character (void) const;
  301. virtual EAsiBoolean is_binary (void) const;
  302. virtual EAsiBoolean is_datetime (void) const;
  303. virtual EAsiBoolean is_interval (void) const;
  304. virtual EAsiBoolean is_yminterval (void) const;
  305. virtual EAsiBoolean is_dtinterval (void) const;
  306. virtual EAsiBoolean is_implement (void) const;
  307. virtual EAsiBoolean is_comparable (const CAsiData *) const;
  308. virtual EAsiBoolean is_storable (const CAsiData *) const;
  309. virtual EAsiBoolean is_castable (const CAsiData *) const;
  310. // Check certain operations and return resulting descriptor
  311. virtual CAsiData * checkAdd (const CAsiData *) const;
  312. virtual CAsiData * checkSub (const CAsiData *) const;
  313. virtual CAsiData * checkMul (const CAsiData *) const;
  314. virtual CAsiData * checkDiv (const CAsiData *) const;
  315. virtual CAsiData * checkCat (const CAsiData *) const;
  316. virtual CAsiData * checkSet (const CAsiData *) const; // Set Operation result
  317. // Equal & Greater than relations
  318. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  319. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  320. // Member function execution
  321. virtual CAsiImplDefFunc * getFuncDsc (const CAsiIdent &, const CAsiRow &) const;
  322. // NULL value manipulation
  323. //
  324. virtual void setNull (void); // Assign NULL
  325. virtual EAsiBoolean isNull (void) const; // Is Null ?
  326. // Store Data value
  327. //
  328. virtual EAsiBoolean storeValue (real); // Real
  329. virtual EAsiBoolean storeValue (integer); // Integer
  330. virtual EAsiBoolean storeValue (smallint); // Smallint
  331. virtual EAsiBoolean storeValue (char *, uint); // ASCII string
  332. virtual EAsiBoolean storeValue (const CAsiUcStr &); // Unicode string
  333. virtual EAsiBoolean storeValue (char *, uint, uint *); // Binary Buffer
  334. virtual EAsiBoolean storeValue (const CAsiData &); // store value to CAsiData (cast to)
  335. virtual EAsiBoolean storeValue (const AsiUcStr); // Store AsiUcStr
  336. virtual EAsiBoolean storeValue (const DECIMAL &);
  337. virtual EAsiBoolean storeValue (const DB_NUMERIC *);
  338. virtual EAsiBoolean storeValue (const DBDATE *);
  339. virtual EAsiBoolean storeValue (const DBTIME *);
  340. virtual EAsiBoolean storeValue (const DBTIMESTAMP *);
  341. // Retrive data value
  342. //
  343. virtual EAsiBoolean getValue (real *) const; // Real
  344. virtual EAsiBoolean getValue (integer *) const; // Integer
  345. virtual EAsiBoolean getValue (smallint *) const; // Smallint
  346. virtual EAsiBoolean getValue (char *, uint) const; // ASCII string
  347. virtual EAsiBoolean getValue (CAsiUcStr *) const; // Unicode string
  348. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  349. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  350. virtual EAsiBoolean getValue (CAsiData &) const; // Get value from CAsiData (cast from)
  351. virtual EAsiBoolean getValue (DECIMAL *) const;
  352. virtual EAsiBoolean getValue (DB_NUMERIC *) const;
  353. virtual EAsiBoolean getValue (DBDATE *) const;
  354. virtual EAsiBoolean getValue (DBTIME *) const;
  355. virtual EAsiBoolean getValue (DBTIMESTAMP *) const;
  356. virtual EAsiBoolean SQLType (CAsiUcStr *) const = 0; // SQL data type as string
  357. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const = 0; // SQL compatible literal
  358. // OLE DB To Asi mapping
  359. static CAsiData * MapColumnInfoToAsi (DBCOLUMNINFO * pColumnInfo);
  360. static CAsiData * MapParamInfoToAsi (DBPARAMINFO * pParamInfo);
  361. virtual DBCOLUMNINFO * MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  362. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  363. // Runtime class iteraction functions
  364. //
  365. // Duplicate itself
  366. //
  367. virtual CAsiObject* duplicate (void) const = 0;
  368. // Nullify all members
  369. virtual void Clear (void);
  370. protected:
  371. EAsiBoolean isnull; // kAsiTrue if data is null
  372. };
  373. ////////////////////////////////////////////////
  374. //
  375. //
  376. class CAsiNum : public CAsiData
  377. //
  378. // Numeric data
  379. //
  380. {
  381. friend class CAsiLex;
  382. protected:
  383. CAsiNum ();
  384. public:
  385. virtual ~CAsiNum ();
  386. // Get data descriptor
  387. //
  388. virtual uint Precision (void) const;
  389. virtual uint Scale (void) const;
  390. // is_ functions
  391. //
  392. virtual EAsiBoolean is_numeric (void) const;
  393. virtual EAsiBoolean is_exactnumeric (void) const;
  394. virtual EAsiBoolean is_approxnumeric(void) const;
  395. virtual EAsiBoolean is_comparable (const CAsiData *) const;
  396. virtual EAsiBoolean is_storable (const CAsiData *) const;
  397. virtual EAsiBoolean is_castable (const CAsiData *) const;
  398. virtual CAsiData * checkAdd (const CAsiData *) const;
  399. virtual CAsiData * checkSub (const CAsiData *) const;
  400. virtual CAsiData * checkMul (const CAsiData *) const;
  401. virtual CAsiData * checkDiv (const CAsiData *) const;
  402. // Get data value
  403. //
  404. virtual integer intValue (void) const;
  405. virtual real realValue (void) const;
  406. // virtual Comparision operators
  407. //
  408. virtual int operator> (const CAsiSmallInt &) const;
  409. virtual int operator> (const CAsiInt &) const;
  410. virtual int operator> (const CAsiNumeric &) const;
  411. virtual int operator> (const CAsiDecimal &) const;
  412. virtual int operator> (const CAsiFloat &) const;
  413. virtual int operator> (const CAsiReal &) const;
  414. virtual int operator> (const CAsiDouble &) const;
  415. virtual int operator> (const smallint) const;
  416. virtual int operator> (const integer) const;
  417. virtual int operator> (const real) const;
  418. virtual int operator> (const int) const;
  419. virtual int operator>= (const CAsiSmallInt &) const;
  420. virtual int operator>= (const CAsiInt &) const;
  421. virtual int operator>= (const CAsiNumeric &) const;
  422. virtual int operator>= (const CAsiDecimal &) const;
  423. virtual int operator>= (const CAsiFloat &) const;
  424. virtual int operator>= (const CAsiReal &) const;
  425. virtual int operator>= (const CAsiDouble &) const;
  426. virtual int operator>= (const smallint) const;
  427. virtual int operator>= (const integer) const;
  428. virtual int operator>= (const real) const;
  429. virtual int operator>= (const int) const;
  430. virtual int operator== (const CAsiSmallInt &) const;
  431. virtual int operator== (const CAsiInt &) const;
  432. virtual int operator== (const CAsiNumeric &) const;
  433. virtual int operator== (const CAsiDecimal &) const;
  434. virtual int operator== (const CAsiFloat &) const;
  435. virtual int operator== (const CAsiReal &) const;
  436. virtual int operator== (const CAsiDouble &) const;
  437. virtual int operator== (const smallint) const;
  438. virtual int operator== (const integer) const;
  439. virtual int operator== (const real) const;
  440. virtual int operator== (const int) const;
  441. virtual int operator<= (const CAsiSmallInt &) const;
  442. virtual int operator<= (const CAsiInt &) const;
  443. virtual int operator<= (const CAsiNumeric &) const;
  444. virtual int operator<= (const CAsiDecimal &) const;
  445. virtual int operator<= (const CAsiFloat &) const;
  446. virtual int operator<= (const CAsiReal &) const;
  447. virtual int operator<= (const CAsiDouble &) const;
  448. virtual int operator<= (const smallint) const;
  449. virtual int operator<= (const integer) const;
  450. virtual int operator<= (const real) const;
  451. virtual int operator<= (const int) const;
  452. virtual int operator< (const CAsiSmallInt &) const;
  453. virtual int operator< (const CAsiInt &) const;
  454. virtual int operator< (const CAsiNumeric &) const;
  455. virtual int operator< (const CAsiDecimal &) const;
  456. virtual int operator< (const CAsiFloat &) const;
  457. virtual int operator< (const CAsiReal &) const;
  458. virtual int operator< (const CAsiDouble &) const;
  459. virtual int operator< (const smallint) const;
  460. virtual int operator< (const integer) const;
  461. virtual int operator< (const real) const;
  462. virtual int operator< (const int) const;
  463. virtual int operator!= (const CAsiSmallInt &) const;
  464. virtual int operator!= (const CAsiInt &) const;
  465. virtual int operator!= (const CAsiNumeric &) const;
  466. virtual int operator!= (const CAsiDecimal &) const;
  467. virtual int operator!= (const CAsiFloat &) const;
  468. virtual int operator!= (const CAsiReal &) const;
  469. virtual int operator!= (const CAsiDouble &) const;
  470. virtual int operator!= (const smallint) const;
  471. virtual int operator!= (const integer) const;
  472. virtual int operator!= (const real) const;
  473. virtual int operator!= (const int) const;
  474. protected:
  475. uint precision;
  476. uint scale;
  477. };
  478. ////////////////////////////////////////////////
  479. //
  480. //
  481. class CAsiExactNum : public CAsiNum
  482. //
  483. // Exact numeric data
  484. //
  485. {
  486. protected:
  487. CAsiExactNum ();
  488. public:
  489. virtual ~CAsiExactNum ();
  490. // is_ functions
  491. //
  492. virtual EAsiBoolean is_exactnumeric (void) const;
  493. CAsiData * checkAdd (const CAsiData *) const;
  494. // Comparision operators
  495. //
  496. virtual int operator> (const CAsiSmallInt &) const;
  497. virtual int operator> (const CAsiInt &) const;
  498. virtual int operator> (const CAsiNumeric &) const;
  499. virtual int operator> (const CAsiDecimal &) const;
  500. virtual int operator> (const CAsiFloat &) const;
  501. virtual int operator> (const CAsiReal &) const;
  502. virtual int operator> (const CAsiDouble &) const;
  503. virtual int operator> (const smallint) const;
  504. virtual int operator> (const integer) const;
  505. virtual int operator> (const real) const;
  506. virtual int operator> (const int) const;
  507. virtual int operator>= (const CAsiSmallInt &) const;
  508. virtual int operator>= (const CAsiInt &) const;
  509. virtual int operator>= (const CAsiNumeric &) const;
  510. virtual int operator>= (const CAsiDecimal &) const;
  511. virtual int operator>= (const CAsiFloat &) const;
  512. virtual int operator>= (const CAsiReal &) const;
  513. virtual int operator>= (const CAsiDouble &) const;
  514. virtual int operator>= (const smallint) const;
  515. virtual int operator>= (const integer) const;
  516. virtual int operator>= (const real) const;
  517. virtual int operator>= (const int) const;
  518. virtual int operator== (const CAsiSmallInt &) const;
  519. virtual int operator== (const CAsiInt &) const;
  520. virtual int operator== (const CAsiNumeric &) const;
  521. virtual int operator== (const CAsiDecimal &) const;
  522. virtual int operator== (const CAsiFloat &) const;
  523. virtual int operator== (const CAsiReal &) const;
  524. virtual int operator== (const CAsiDouble &) const;
  525. virtual int operator== (const smallint) const;
  526. virtual int operator== (const integer) const;
  527. virtual int operator== (const real) const;
  528. virtual int operator== (const int) const;
  529. virtual int operator<= (const CAsiSmallInt &) const;
  530. virtual int operator<= (const CAsiInt &) const;
  531. virtual int operator<= (const CAsiNumeric &) const;
  532. virtual int operator<= (const CAsiDecimal &) const;
  533. virtual int operator<= (const CAsiFloat &) const;
  534. virtual int operator<= (const CAsiReal &) const;
  535. virtual int operator<= (const CAsiDouble &) const;
  536. virtual int operator<= (const smallint) const;
  537. virtual int operator<= (const integer) const;
  538. virtual int operator<= (const real) const;
  539. virtual int operator<= (const int) const;
  540. virtual int operator< (const CAsiSmallInt &) const;
  541. virtual int operator< (const CAsiInt &) const;
  542. virtual int operator< (const CAsiNumeric &) const;
  543. virtual int operator< (const CAsiDecimal &) const;
  544. virtual int operator< (const CAsiFloat &) const;
  545. virtual int operator< (const CAsiReal &) const;
  546. virtual int operator< (const CAsiDouble &) const;
  547. virtual int operator< (const smallint) const;
  548. virtual int operator< (const integer) const;
  549. virtual int operator< (const real) const;
  550. virtual int operator< (const int) const;
  551. virtual int operator!= (const CAsiSmallInt &) const;
  552. virtual int operator!= (const CAsiInt &) const;
  553. virtual int operator!= (const CAsiNumeric &) const;
  554. virtual int operator!= (const CAsiDecimal &) const;
  555. virtual int operator!= (const CAsiFloat &) const;
  556. virtual int operator!= (const CAsiReal &) const;
  557. virtual int operator!= (const CAsiDouble &) const;
  558. virtual int operator!= (const smallint) const;
  559. virtual int operator!= (const integer) const;
  560. virtual int operator!= (const real) const;
  561. virtual int operator!= (const int) const;
  562. protected:
  563. int cmpeqlen(const CAsiExactNum *) const;
  564. int cmpeqlan(const CAsiNum *) const;
  565. int cmpeqlenC(const real) const;
  566. int cmpneqen(const CAsiExactNum *) const;
  567. int cmpneqan(const CAsiNum *) const;
  568. int cmpneqenC(const real) const;
  569. int cmpltren(const CAsiExactNum *) const;
  570. int cmpltran(const CAsiNum *) const;
  571. int cmpltrenC(const real) const;
  572. int cmplteen(const CAsiExactNum *) const;
  573. int cmpltean(const CAsiNum *) const;
  574. int cmplteenC(const real) const;
  575. int cmpgtren(const CAsiExactNum *) const;
  576. int cmpgtran(const CAsiNum *) const;
  577. int cmpgtrenC(const real) const;
  578. int cmpgteen(const CAsiExactNum *) const;
  579. int cmpgtean(const CAsiNum *) const;
  580. int cmpgteenC(const real) const;
  581. };
  582. ////////////////////////////////////////////////
  583. //
  584. //
  585. class CAsiApproxNum : public CAsiNum
  586. //
  587. // Approximate numeric data
  588. //
  589. {
  590. protected:
  591. CAsiApproxNum (); // Constructor
  592. public:
  593. virtual ~CAsiApproxNum (); // Destructor
  594. // is_ functions
  595. //
  596. virtual EAsiBoolean is_approxnumeric (void) const;
  597. // Comparision operators
  598. //
  599. virtual int operator> (const CAsiSmallInt &) const;
  600. virtual int operator> (const CAsiInt &) const;
  601. virtual int operator> (const CAsiNumeric &) const;
  602. virtual int operator> (const CAsiDecimal &) const;
  603. virtual int operator> (const CAsiFloat &) const;
  604. virtual int operator> (const CAsiReal &) const;
  605. virtual int operator> (const CAsiDouble &) const;
  606. virtual int operator> (const smallint) const;
  607. virtual int operator> (const integer) const;
  608. virtual int operator> (const real) const;
  609. virtual int operator> (const int) const;
  610. virtual int operator>= (const CAsiSmallInt &) const;
  611. virtual int operator>= (const CAsiInt &) const;
  612. virtual int operator>= (const CAsiNumeric &) const;
  613. virtual int operator>= (const CAsiDecimal &) const;
  614. virtual int operator>= (const CAsiFloat &) const;
  615. virtual int operator>= (const CAsiReal &) const;
  616. virtual int operator>= (const CAsiDouble &) const;
  617. virtual int operator>= (const smallint) const;
  618. virtual int operator>= (const integer) const;
  619. virtual int operator>= (const real) const;
  620. virtual int operator>= (const int) const;
  621. virtual int operator== (const CAsiSmallInt &) const;
  622. virtual int operator== (const CAsiInt &) const;
  623. virtual int operator== (const CAsiNumeric &) const;
  624. virtual int operator== (const CAsiDecimal &) const;
  625. virtual int operator== (const CAsiFloat &) const;
  626. virtual int operator== (const CAsiReal &) const;
  627. virtual int operator== (const CAsiDouble &) const;
  628. virtual int operator== (const smallint) const;
  629. virtual int operator== (const integer) const;
  630. virtual int operator== (const real) const;
  631. virtual int operator== (const int) const;
  632. virtual int operator<= (const CAsiSmallInt &) const;
  633. virtual int operator<= (const CAsiInt &) const;
  634. virtual int operator<= (const CAsiNumeric &) const;
  635. virtual int operator<= (const CAsiDecimal &) const;
  636. virtual int operator<= (const CAsiFloat &) const;
  637. virtual int operator<= (const CAsiReal &) const;
  638. virtual int operator<= (const CAsiDouble &) const;
  639. virtual int operator<= (const smallint) const;
  640. virtual int operator<= (const integer) const;
  641. virtual int operator<= (const real) const;
  642. virtual int operator<= (const int) const;
  643. virtual int operator< (const CAsiSmallInt &) const;
  644. virtual int operator< (const CAsiInt &) const;
  645. virtual int operator< (const CAsiNumeric &) const;
  646. virtual int operator< (const CAsiDecimal &) const;
  647. virtual int operator< (const CAsiFloat &) const;
  648. virtual int operator< (const CAsiReal &) const;
  649. virtual int operator< (const CAsiDouble &) const;
  650. virtual int operator< (const smallint) const;
  651. virtual int operator< (const integer) const;
  652. virtual int operator< (const real) const;
  653. virtual int operator< (const int) const;
  654. virtual int operator!= (const CAsiSmallInt &) const;
  655. virtual int operator!= (const CAsiInt &) const;
  656. virtual int operator!= (const CAsiNumeric &) const;
  657. virtual int operator!= (const CAsiDecimal &) const;
  658. virtual int operator!= (const CAsiFloat &) const;
  659. virtual int operator!= (const CAsiReal &) const;
  660. virtual int operator!= (const CAsiDouble &) const;
  661. virtual int operator!= (const smallint) const;
  662. virtual int operator!= (const integer) const;
  663. virtual int operator!= (const real) const;
  664. virtual int operator!= (const int) const;
  665. protected:
  666. };
  667. ////////////////////////////////////////////////
  668. //
  669. //
  670. class CAsiSmallInt : public CAsiExactNum
  671. //
  672. // SMALL INTEGER
  673. //
  674. {
  675. public:
  676. CAsiSmallInt (void);
  677. CAsiSmallInt (const CAsiSmallInt &);
  678. virtual ~CAsiSmallInt (void);
  679. // Get data descriptor
  680. //
  681. virtual EAsiDataType Type (void) const;
  682. virtual uint ReturnLength (void) const;
  683. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  684. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  685. virtual CAsiData * checkAdd (const CAsiData *) const;
  686. virtual CAsiData * checkSub (const CAsiData *) const;
  687. virtual CAsiData * checkMul (const CAsiData *) const;
  688. virtual CAsiData * checkDiv (const CAsiData *) const;
  689. virtual CAsiData * checkSet (const CAsiData *) const;
  690. // Store Data value
  691. //
  692. virtual EAsiBoolean storeValue (real) ;
  693. virtual EAsiBoolean storeValue (integer) ;
  694. virtual EAsiBoolean storeValue (smallint) ;
  695. virtual EAsiBoolean storeValue (char *, uint) ;
  696. virtual EAsiBoolean storeValue (const CAsiUcStr &) ;
  697. virtual EAsiBoolean storeValue (const CAsiData &);
  698. // ****
  699. virtual EAsiBoolean storeValue (char *, uint, uint *);
  700. virtual EAsiBoolean storeValue (const AsiUcStr);
  701. // Get data value
  702. //
  703. virtual integer intValue (void) const;
  704. virtual real realValue (void) const;
  705. virtual EAsiBoolean getValue (real *) const;
  706. virtual EAsiBoolean getValue (integer *) const;
  707. virtual EAsiBoolean getValue (smallint *) const;
  708. virtual EAsiBoolean getValue (char *, uint) const;
  709. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  710. // ****
  711. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  712. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  713. virtual EAsiBoolean getValue (CAsiData &) const;
  714. virtual DBCOLUMNINFO * MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  715. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  716. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  717. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  718. // Runtime class iteraction functions
  719. //
  720. virtual unsigned long packSize (void) const;
  721. virtual unsigned long packTo (CAsiObjPack *) const;
  722. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  723. virtual unsigned long packValueSize (void) const;
  724. virtual unsigned long packValueTo (CAsiObjPack *) const;
  725. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *) ;
  726. // Duplicate itself
  727. //
  728. virtual CAsiObject *duplicate (void) const;
  729. // Operators
  730. //
  731. // Assignment
  732. CAsiSmallInt &operator= (const CAsiSmallInt &);
  733. CAsiSmallInt &operator= (const CAsiInt &);
  734. CAsiSmallInt &operator= (const CAsiNumeric &);
  735. CAsiSmallInt &operator= (const CAsiDecimal &);
  736. CAsiSmallInt &operator= (const CAsiFloat &);
  737. CAsiSmallInt &operator= (const CAsiReal &);
  738. CAsiSmallInt &operator= (const CAsiDouble &);
  739. CAsiSmallInt &operator= (const smallint);
  740. CAsiSmallInt &operator= (const integer);
  741. CAsiSmallInt &operator= (const real);
  742. CAsiSmallInt &operator= (const int);
  743. // Arithmetic operators
  744. CAsiSmallInt &operator+= (const CAsiSmallInt &);
  745. CAsiSmallInt &operator+= (const CAsiInt &);
  746. CAsiSmallInt &operator+= (const CAsiNumeric &);
  747. CAsiSmallInt &operator+= (const CAsiDecimal &);
  748. CAsiSmallInt &operator+= (const CAsiFloat &);
  749. CAsiSmallInt &operator+= (const CAsiReal &);
  750. CAsiSmallInt &operator+= (const CAsiDouble &);
  751. CAsiSmallInt &operator+= (const smallint);
  752. CAsiSmallInt &operator+= (const integer);
  753. CAsiSmallInt &operator+= (const real);
  754. CAsiSmallInt &operator+= (const int);
  755. CAsiSmallInt &operator-= (const CAsiSmallInt &);
  756. CAsiSmallInt &operator-= (const CAsiInt &);
  757. CAsiSmallInt &operator-= (const CAsiNumeric &);
  758. CAsiSmallInt &operator-= (const CAsiDecimal &);
  759. CAsiSmallInt &operator-= (const CAsiFloat &);
  760. CAsiSmallInt &operator-= (const CAsiReal &);
  761. CAsiSmallInt &operator-= (const CAsiDouble &);
  762. CAsiSmallInt &operator-= (const smallint);
  763. CAsiSmallInt &operator-= (const integer);
  764. CAsiSmallInt &operator-= (const real);
  765. CAsiSmallInt &operator-= (const int);
  766. CAsiSmallInt &operator*= (const CAsiSmallInt &);
  767. CAsiSmallInt &operator*= (const CAsiInt &);
  768. CAsiSmallInt &operator*= (const CAsiNumeric &);
  769. CAsiSmallInt &operator*= (const CAsiDecimal &);
  770. CAsiSmallInt &operator*= (const CAsiFloat &);
  771. CAsiSmallInt &operator*= (const CAsiReal &);
  772. CAsiSmallInt &operator*= (const CAsiDouble &);
  773. CAsiSmallInt &operator*= (const smallint);
  774. CAsiSmallInt &operator*= (const integer);
  775. CAsiSmallInt &operator*= (const real);
  776. CAsiSmallInt &operator*= (const int);
  777. CAsiSmallInt &operator/= (const CAsiSmallInt &);
  778. CAsiSmallInt &operator/= (const CAsiInt &);
  779. CAsiSmallInt &operator/= (const CAsiNumeric &);
  780. CAsiSmallInt &operator/= (const CAsiDecimal &);
  781. CAsiSmallInt &operator/= (const CAsiFloat &);
  782. CAsiSmallInt &operator/= (const CAsiReal &);
  783. CAsiSmallInt &operator/= (const CAsiDouble &);
  784. CAsiSmallInt &operator/= (const smallint);
  785. CAsiSmallInt &operator/= (const integer);
  786. CAsiSmallInt &operator/= (const real);
  787. CAsiSmallInt &operator/= (const int);
  788. CAsiDouble operator+ (const CAsiSmallInt &) const;
  789. CAsiDouble operator+ (const smallint) const;
  790. CAsiDouble operator+ (const integer) const;
  791. CAsiDouble operator+ (const real) const;
  792. CAsiDouble operator+ (const int) const;
  793. friend CAsiDouble DLLScope operator+ (const smallint, const CAsiSmallInt &);
  794. friend CAsiDouble DLLScope operator+ (const integer, const CAsiSmallInt &);
  795. friend CAsiDouble DLLScope operator+ (const real, const CAsiSmallInt &);
  796. friend CAsiDouble DLLScope operator+ (const int, const CAsiSmallInt &);
  797. CAsiDouble operator- (const CAsiSmallInt &) const;
  798. CAsiDouble operator- (const smallint) const;
  799. CAsiDouble operator- (const integer) const;
  800. CAsiDouble operator- (const real) const;
  801. CAsiDouble operator- (const int) const;
  802. friend CAsiDouble DLLScope operator- (const smallint, const CAsiSmallInt &);
  803. friend CAsiDouble DLLScope operator- (const integer, const CAsiSmallInt &);
  804. friend CAsiDouble DLLScope operator- (const real, const CAsiSmallInt &);
  805. friend CAsiDouble DLLScope operator- (const int, const CAsiSmallInt &);
  806. CAsiDouble operator* (const CAsiSmallInt &) const;
  807. CAsiDouble operator* (const smallint) const;
  808. CAsiDouble operator* (const integer) const;
  809. CAsiDouble operator* (const real) const;
  810. CAsiDouble operator* (const int) const;
  811. friend CAsiDouble DLLScope operator* (const smallint, const CAsiSmallInt &);
  812. friend CAsiDouble DLLScope operator* (const integer, const CAsiSmallInt &);
  813. friend CAsiDouble DLLScope operator* (const real, const CAsiSmallInt &);
  814. friend CAsiDouble DLLScope operator* (const int, const CAsiSmallInt &);
  815. CAsiDouble operator/ (const CAsiSmallInt &) const;
  816. CAsiDouble operator/ (const smallint) const;
  817. CAsiDouble operator/ (const integer) const;
  818. CAsiDouble operator/ (const real) const;
  819. CAsiDouble operator/ (const int) const;
  820. friend CAsiDouble DLLScope operator/ (const smallint, const CAsiSmallInt &);
  821. friend CAsiDouble DLLScope operator/ (const integer, const CAsiSmallInt &);
  822. friend CAsiDouble DLLScope operator/ (const real, const CAsiSmallInt &);
  823. friend CAsiDouble DLLScope operator/ (const int, const CAsiSmallInt &);
  824. CAsiSmallInt &operator-- (void);
  825. CAsiSmallInt &operator++ (void);
  826. CAsiSmallInt &operator- (void);
  827. private:
  828. smallint sivalue;
  829. };
  830. ////////////////////////////////////////////////
  831. //
  832. //
  833. class CAsiInt : public CAsiExactNum
  834. //
  835. // INTEGER
  836. //
  837. // This class introduces functionality of the SQL INTEGER data type.
  838. // It redefines all arithmetic and comparision operators in which
  839. // integer number can be involved in SQL. Memeber functions also allow
  840. // to set and retrieve value of the internal integer number in double and
  841. // integer formats.
  842. //
  843. {
  844. public:
  845. CAsiInt ();
  846. CAsiInt (const CAsiInt &);
  847. virtual ~CAsiInt ();
  848. // Get data descriptor
  849. //
  850. virtual EAsiDataType Type (void) const;
  851. virtual uint ReturnLength (void) const;
  852. virtual CAsiData * checkAdd (const CAsiData *) const;
  853. virtual CAsiData * checkSub (const CAsiData *) const;
  854. virtual CAsiData * checkMul (const CAsiData *) const;
  855. virtual CAsiData * checkDiv (const CAsiData *) const;
  856. virtual CAsiData * checkSet (const CAsiData *) const;
  857. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  858. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  859. // Store Data value
  860. //
  861. virtual EAsiBoolean storeValue (real);
  862. virtual EAsiBoolean storeValue (integer);
  863. virtual EAsiBoolean storeValue (smallint);
  864. virtual EAsiBoolean storeValue (char *, uint);
  865. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  866. virtual EAsiBoolean storeValue (const CAsiData &);
  867. // ****
  868. virtual EAsiBoolean storeValue (char *, uint, uint *);
  869. virtual EAsiBoolean storeValue (const AsiUcStr);
  870. // Get data value
  871. //
  872. virtual integer intValue (void) const;
  873. virtual real realValue (void) const;
  874. virtual EAsiBoolean getValue (real *) const;
  875. virtual EAsiBoolean getValue (integer *) const;
  876. virtual EAsiBoolean getValue (smallint *) const;
  877. virtual EAsiBoolean getValue (char *, uint) const;
  878. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  879. // ****
  880. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  881. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  882. virtual EAsiBoolean getValue (CAsiData &) const;
  883. virtual DBCOLUMNINFO * MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  884. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  885. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  886. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  887. // Runtime class iteraction functions
  888. //
  889. virtual unsigned long packSize (void) const;
  890. virtual unsigned long packTo (CAsiObjPack *) const;
  891. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  892. virtual unsigned long packValueSize (void) const;
  893. virtual unsigned long packValueTo (CAsiObjPack *) const;
  894. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *) ;
  895. // Duplicate itself
  896. //
  897. virtual CAsiObject *duplicate (void) const;
  898. // Operators
  899. //
  900. // Assignment
  901. CAsiInt &operator= (const CAsiSmallInt &);
  902. CAsiInt &operator= (const CAsiInt &);
  903. CAsiInt &operator= (const CAsiNumeric &);
  904. CAsiInt &operator= (const CAsiDecimal &);
  905. CAsiInt &operator= (const CAsiFloat &);
  906. CAsiInt &operator= (const CAsiReal &);
  907. CAsiInt &operator= (const CAsiDouble &);
  908. CAsiInt &operator= (const smallint);
  909. CAsiInt &operator= (const integer);
  910. CAsiInt &operator= (const real);
  911. CAsiInt &operator= (const int);
  912. // Arithmetic operators
  913. CAsiInt &operator+= (const CAsiSmallInt &);
  914. CAsiInt &operator+= (const CAsiInt &);
  915. CAsiInt &operator+= (const CAsiNumeric &);
  916. CAsiInt &operator+= (const CAsiDecimal &);
  917. CAsiInt &operator+= (const CAsiFloat &);
  918. CAsiInt &operator+= (const CAsiReal &);
  919. CAsiInt &operator+= (const CAsiDouble &);
  920. CAsiInt &operator+= (const smallint);
  921. CAsiInt &operator+= (const integer);
  922. CAsiInt &operator+= (const real);
  923. CAsiInt &operator+= (const int);
  924. CAsiInt &operator-= (const CAsiSmallInt &);
  925. CAsiInt &operator-= (const CAsiInt &);
  926. CAsiInt &operator-= (const CAsiNumeric &);
  927. CAsiInt &operator-= (const CAsiDecimal &);
  928. CAsiInt &operator-= (const CAsiFloat &);
  929. CAsiInt &operator-= (const CAsiReal &);
  930. CAsiInt &operator-= (const CAsiDouble &);
  931. CAsiInt &operator-= (const smallint);
  932. CAsiInt &operator-= (const integer);
  933. CAsiInt &operator-= (const real);
  934. CAsiInt &operator-= (const int);
  935. CAsiInt &operator*= (const CAsiSmallInt &);
  936. CAsiInt &operator*= (const CAsiInt &);
  937. CAsiInt &operator*= (const CAsiNumeric &);
  938. CAsiInt &operator*= (const CAsiDecimal &);
  939. CAsiInt &operator*= (const CAsiFloat &);
  940. CAsiInt &operator*= (const CAsiReal &);
  941. CAsiInt &operator*= (const CAsiDouble &);
  942. CAsiInt &operator*= (const smallint);
  943. CAsiInt &operator*= (const integer);
  944. CAsiInt &operator*= (const real);
  945. CAsiInt &operator*= (const int);
  946. CAsiInt &operator/= (const CAsiSmallInt &);
  947. CAsiInt &operator/= (const CAsiInt &);
  948. CAsiInt &operator/= (const CAsiNumeric &);
  949. CAsiInt &operator/= (const CAsiDecimal &);
  950. CAsiInt &operator/= (const CAsiFloat &);
  951. CAsiInt &operator/= (const CAsiReal &);
  952. CAsiInt &operator/= (const CAsiDouble &);
  953. CAsiInt &operator/= (const smallint);
  954. CAsiInt &operator/= (const integer);
  955. CAsiInt &operator/= (const real);
  956. CAsiInt &operator/= (const int);
  957. CAsiDouble operator+ (const CAsiSmallInt &) const;
  958. friend CAsiDouble DLLScope operator+ (const CAsiSmallInt &, const CAsiInt &);
  959. CAsiDouble operator+ (const CAsiInt &) const;
  960. CAsiDouble operator+ (const smallint) const;
  961. friend CAsiDouble DLLScope operator+ (const smallint, const CAsiInt &);
  962. CAsiDouble operator+ (const integer) const;
  963. friend CAsiDouble DLLScope operator+ (const integer, const CAsiInt &);
  964. CAsiDouble operator+ (const real) const;
  965. friend CAsiDouble DLLScope operator+ (const real, const CAsiInt &);
  966. CAsiDouble operator+ (const int) const;
  967. friend CAsiDouble DLLScope operator+ (const int, const CAsiInt &);
  968. CAsiDouble operator- (const CAsiSmallInt &) const;
  969. friend CAsiDouble DLLScope operator- (const CAsiSmallInt &, const CAsiInt &);
  970. CAsiDouble operator- (const CAsiInt &) const;
  971. CAsiDouble operator- (const smallint) const;
  972. friend CAsiDouble DLLScope operator- (const smallint, const CAsiInt &);
  973. CAsiDouble operator- (const integer) const;
  974. friend CAsiDouble DLLScope operator- (const integer, const CAsiInt &);
  975. CAsiDouble operator- (const real) const;
  976. friend CAsiDouble DLLScope operator- (const real, const CAsiInt &);
  977. CAsiDouble operator- (const int) const;
  978. friend CAsiDouble DLLScope operator- (const int, const CAsiInt &);
  979. CAsiDouble operator* (const CAsiSmallInt &) const;
  980. friend CAsiDouble DLLScope operator* (const CAsiSmallInt &, const CAsiInt &);
  981. CAsiDouble operator* (const CAsiInt &) const;
  982. CAsiDouble operator* (const smallint) const;
  983. friend CAsiDouble DLLScope operator* (const smallint, const CAsiInt &);
  984. CAsiDouble operator* (const integer) const;
  985. friend CAsiDouble DLLScope operator* (const integer, const CAsiInt &);
  986. CAsiDouble operator* (const real) const;
  987. friend CAsiDouble DLLScope operator* (const real, const CAsiInt &);
  988. CAsiDouble operator* (const int) const;
  989. friend CAsiDouble DLLScope operator* (const int, const CAsiInt &);
  990. CAsiDouble operator/ (const CAsiSmallInt &) const;
  991. friend CAsiDouble DLLScope operator/ (const CAsiSmallInt &, const CAsiInt &);
  992. CAsiDouble operator/ (const CAsiInt &) const;
  993. CAsiDouble operator/ (const smallint) const;
  994. friend CAsiDouble DLLScope operator/ (const smallint, const CAsiInt &);
  995. CAsiDouble operator/ (const integer) const;
  996. friend CAsiDouble DLLScope operator/ (const integer, const CAsiInt &);
  997. CAsiDouble operator/ (const real) const;
  998. friend CAsiDouble DLLScope operator/ (const real, const CAsiInt &);
  999. CAsiDouble operator/ (const int) const;
  1000. friend CAsiDouble DLLScope operator/ (const int, const CAsiInt &);
  1001. CAsiInt &operator-- (void);
  1002. CAsiInt &operator++ (void);
  1003. CAsiInt &operator- (void);
  1004. private:
  1005. integer ivalue;
  1006. };
  1007. ////////////////////////////////////////////////
  1008. //
  1009. //
  1010. class CAsiNumeric: public CAsiExactNum
  1011. //
  1012. // NUMERIC
  1013. //
  1014. {
  1015. friend class CAsiDecimal;
  1016. private:
  1017. // private helper
  1018. EAsiBoolean SetNumeric (real);
  1019. //
  1020. public:
  1021. CAsiNumeric (uint, uint);
  1022. CAsiNumeric (uint);
  1023. CAsiNumeric (const CAsiNumeric &);
  1024. CAsiNumeric (void);
  1025. virtual ~CAsiNumeric (void);
  1026. // Get data descriptor
  1027. //
  1028. virtual EAsiDataType Type (void) const;
  1029. virtual uint ReturnLength (void) const;
  1030. virtual CAsiData * checkAdd (const CAsiData *) const;
  1031. virtual CAsiData * checkSub (const CAsiData *) const;
  1032. virtual CAsiData * checkMul (const CAsiData *) const;
  1033. virtual CAsiData * checkDiv (const CAsiData *) const;
  1034. virtual CAsiData * checkSet (const CAsiData *) const;
  1035. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  1036. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  1037. // Store Data value
  1038. //
  1039. virtual EAsiBoolean storeValue (real);
  1040. virtual EAsiBoolean storeValue (integer);
  1041. virtual EAsiBoolean storeValue (smallint);
  1042. virtual EAsiBoolean storeValue (char *, uint);
  1043. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  1044. virtual EAsiBoolean storeValue (const CAsiData &);
  1045. virtual EAsiBoolean storeValue (const DB_NUMERIC *);
  1046. // ****
  1047. virtual EAsiBoolean storeValue (char *, uint, uint *);
  1048. virtual EAsiBoolean storeValue (const AsiUcStr);
  1049. virtual DBCOLUMNINFO * MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  1050. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  1051. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  1052. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  1053. // Get data value
  1054. //
  1055. virtual integer intValue (void) const;
  1056. virtual real realValue (void) const;
  1057. virtual EAsiBoolean getValue (real *) const;
  1058. virtual EAsiBoolean getValue (integer *) const;
  1059. virtual EAsiBoolean getValue (smallint *) const;
  1060. virtual EAsiBoolean getValue (char *, uint) const;
  1061. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  1062. virtual EAsiBoolean getValue (DB_NUMERIC *) const;
  1063. // ****
  1064. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  1065. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  1066. virtual EAsiBoolean getValue (CAsiData &) const;
  1067. // Runtime class iteraction functions
  1068. //
  1069. virtual unsigned long packSize (void) const;
  1070. virtual unsigned long packTo (CAsiObjPack *) const;
  1071. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  1072. virtual unsigned long packValueSize (void) const;
  1073. virtual unsigned long packValueTo (CAsiObjPack *) const;
  1074. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *) ;
  1075. // Duplicate itself
  1076. //
  1077. virtual CAsiObject *duplicate (void) const;
  1078. // Operators
  1079. //
  1080. // Assignment
  1081. CAsiNumeric &operator= (const CAsiSmallInt &);
  1082. CAsiNumeric &operator= (const CAsiInt &);
  1083. CAsiNumeric &operator= (const CAsiNumeric &);
  1084. CAsiNumeric &operator= (const CAsiDecimal &);
  1085. CAsiNumeric &operator= (const CAsiFloat &);
  1086. CAsiNumeric &operator= (const CAsiReal &);
  1087. CAsiNumeric &operator= (const CAsiDouble &);
  1088. CAsiNumeric &operator= (const smallint);
  1089. CAsiNumeric &operator= (const integer);
  1090. CAsiNumeric &operator= (const real);
  1091. CAsiNumeric &operator= (const int);
  1092. // Arithmetic operators
  1093. CAsiNumeric &operator+= (const CAsiSmallInt &);
  1094. CAsiNumeric &operator+= (const CAsiInt &);
  1095. CAsiNumeric &operator+= (const CAsiNumeric &);
  1096. CAsiNumeric &operator+= (const CAsiDecimal &);
  1097. CAsiNumeric &operator+= (const CAsiFloat &);
  1098. CAsiNumeric &operator+= (const CAsiReal &);
  1099. CAsiNumeric &operator+= (const CAsiDouble &);
  1100. CAsiNumeric &operator+= (const smallint);
  1101. CAsiNumeric &operator+= (const integer);
  1102. CAsiNumeric &operator+= (const real);
  1103. CAsiNumeric &operator+= (const int);
  1104. CAsiNumeric &operator-= (const CAsiSmallInt &);
  1105. CAsiNumeric &operator-= (const CAsiInt &);
  1106. CAsiNumeric &operator-= (const CAsiNumeric &);
  1107. CAsiNumeric &operator-= (const CAsiDecimal &);
  1108. CAsiNumeric &operator-= (const CAsiFloat &);
  1109. CAsiNumeric &operator-= (const CAsiReal &);
  1110. CAsiNumeric &operator-= (const CAsiDouble &);
  1111. CAsiNumeric &operator-= (const smallint);
  1112. CAsiNumeric &operator-= (const integer);
  1113. CAsiNumeric &operator-= (const real);
  1114. CAsiNumeric &operator-= (const int);
  1115. CAsiNumeric &operator*= (const CAsiSmallInt &);
  1116. CAsiNumeric &operator*= (const CAsiInt &);
  1117. CAsiNumeric &operator*= (const CAsiNumeric &);
  1118. CAsiNumeric &operator*= (const CAsiDecimal &);
  1119. CAsiNumeric &operator*= (const CAsiFloat &);
  1120. CAsiNumeric &operator*= (const CAsiReal &);
  1121. CAsiNumeric &operator*= (const CAsiDouble &);
  1122. CAsiNumeric &operator*= (const smallint);
  1123. CAsiNumeric &operator*= (const integer);
  1124. CAsiNumeric &operator*= (const real);
  1125. CAsiNumeric &operator*= (const int);
  1126. CAsiNumeric &operator/= (const CAsiSmallInt &);
  1127. CAsiNumeric &operator/= (const CAsiInt &);
  1128. CAsiNumeric &operator/= (const CAsiNumeric &);
  1129. CAsiNumeric &operator/= (const CAsiDecimal &);
  1130. CAsiNumeric &operator/= (const CAsiFloat &);
  1131. CAsiNumeric &operator/= (const CAsiReal &);
  1132. CAsiNumeric &operator/= (const CAsiDouble &);
  1133. CAsiNumeric &operator/= (const smallint);
  1134. CAsiNumeric &operator/= (const integer);
  1135. CAsiNumeric &operator/= (const real);
  1136. CAsiNumeric &operator/= (const int);
  1137. CAsiDouble operator+ (const CAsiSmallInt &) const;
  1138. CAsiDouble operator+ (const CAsiInt &) const;
  1139. CAsiDouble operator+ (const CAsiNumeric &) const;
  1140. friend CAsiDouble DLLScope operator+ (const CAsiSmallInt &, const CAsiNumeric &);
  1141. friend CAsiDouble DLLScope operator+ (const CAsiInt &, const CAsiNumeric &);
  1142. CAsiDouble operator+ (const smallint) const;
  1143. CAsiDouble operator+ (const integer) const;
  1144. CAsiDouble operator+ (const real) const;
  1145. CAsiDouble operator+ (const int) const;
  1146. friend CAsiDouble DLLScope operator+ (const smallint, const CAsiNumeric &);
  1147. friend CAsiDouble DLLScope operator+ (const integer, const CAsiNumeric &);
  1148. friend CAsiDouble DLLScope operator+ (const real, const CAsiNumeric &);
  1149. friend CAsiDouble DLLScope operator+ (const int, const CAsiNumeric &);
  1150. CAsiDouble operator- (const CAsiSmallInt &) const;
  1151. CAsiDouble operator- (const CAsiInt &) const;
  1152. CAsiDouble operator- (const CAsiNumeric &) const;
  1153. friend CAsiDouble DLLScope operator- (const CAsiSmallInt &, const CAsiNumeric &);
  1154. friend CAsiDouble DLLScope operator- (const CAsiInt &, const CAsiNumeric &);
  1155. CAsiDouble operator- (const smallint) const;
  1156. CAsiDouble operator- (const integer) const;
  1157. CAsiDouble operator- (const real) const;
  1158. CAsiDouble operator- (const int) const;
  1159. friend CAsiDouble DLLScope operator- (const smallint, const CAsiNumeric &);
  1160. friend CAsiDouble DLLScope operator- (const integer, const CAsiNumeric &);
  1161. friend CAsiDouble DLLScope operator- (const real, const CAsiNumeric &);
  1162. friend CAsiDouble DLLScope operator- (const int, const CAsiNumeric &) ;
  1163. CAsiDouble operator* (const CAsiSmallInt &) const;
  1164. CAsiDouble operator* (const CAsiInt &) const;
  1165. CAsiDouble operator* (const CAsiNumeric &) const;
  1166. friend CAsiDouble DLLScope operator* (const CAsiSmallInt &, const CAsiNumeric &);
  1167. friend CAsiDouble DLLScope operator* (const CAsiInt &, const CAsiNumeric &);
  1168. CAsiDouble operator* (const smallint) const;
  1169. CAsiDouble operator* (const integer) const;
  1170. CAsiDouble operator* (const real) const;
  1171. CAsiDouble operator* (const int) const;
  1172. friend CAsiDouble DLLScope operator* (const smallint, const CAsiNumeric &);
  1173. friend CAsiDouble DLLScope operator* (const integer, const CAsiNumeric &) ;
  1174. friend CAsiDouble DLLScope operator* (const real, const CAsiNumeric &) ;
  1175. friend CAsiDouble DLLScope operator* (const int, const CAsiNumeric &) ;
  1176. CAsiDouble operator/ (const CAsiSmallInt &) const;
  1177. CAsiDouble operator/ (const CAsiInt &) const;
  1178. CAsiDouble operator/ (const CAsiNumeric &) const;
  1179. friend CAsiDouble DLLScope operator/ (const CAsiSmallInt &, const CAsiNumeric &);
  1180. friend CAsiDouble DLLScope operator/ (const CAsiInt &, const CAsiNumeric &) ;
  1181. CAsiDouble operator/ (const smallint) const;
  1182. CAsiDouble operator/ (const integer) const;
  1183. CAsiDouble operator/ (const real) const;
  1184. CAsiDouble operator/ (const int) const;
  1185. friend CAsiDouble DLLScope operator/ (const smallint, const CAsiNumeric &);
  1186. friend CAsiDouble DLLScope operator/ (const integer, const CAsiNumeric &) ;
  1187. friend CAsiDouble DLLScope operator/ (const real, const CAsiNumeric &) ;
  1188. friend CAsiDouble DLLScope operator/ (const int, const CAsiNumeric &) ;
  1189. CAsiNumeric &operator++ (void);
  1190. CAsiNumeric &operator-- (void);
  1191. CAsiNumeric &operator- (void);
  1192. private:
  1193. ASIBCD bcdvalue;
  1194. };
  1195. ////////////////////////////////////////////////
  1196. //
  1197. //
  1198. class CAsiDecimal: public CAsiExactNum
  1199. //
  1200. // DECIMAL
  1201. //
  1202. {
  1203. friend class CAsiNumeric;
  1204. private:
  1205. // private helper
  1206. EAsiBoolean SetDecimal (real);
  1207. public:
  1208. CAsiDecimal (uint, uint);
  1209. CAsiDecimal (uint);
  1210. CAsiDecimal (const CAsiDecimal &);
  1211. CAsiDecimal (void);
  1212. virtual ~CAsiDecimal (void);
  1213. // Get data descriptor
  1214. //
  1215. virtual EAsiDataType Type (void) const;
  1216. virtual uint ReturnLength (void) const;
  1217. virtual CAsiData * checkAdd (const CAsiData *) const;
  1218. virtual CAsiData * checkSub (const CAsiData *) const;
  1219. virtual CAsiData * checkMul (const CAsiData *) const;
  1220. virtual CAsiData * checkDiv (const CAsiData *) const;
  1221. virtual CAsiData * checkSet (const CAsiData *) const;
  1222. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  1223. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  1224. // Store Data value
  1225. //
  1226. virtual EAsiBoolean storeValue (real);
  1227. virtual EAsiBoolean storeValue (integer);
  1228. virtual EAsiBoolean storeValue (smallint);
  1229. virtual EAsiBoolean storeValue (char *, uint);
  1230. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  1231. virtual EAsiBoolean storeValue (const CAsiData &);
  1232. virtual EAsiBoolean storeValue (LARGE_INTEGER);
  1233. virtual EAsiBoolean storeValue (ULARGE_INTEGER);
  1234. virtual EAsiBoolean storeValue (const DECIMAL &);
  1235. // ****
  1236. virtual EAsiBoolean storeValue (char *, uint, uint *);
  1237. virtual EAsiBoolean storeValue (const AsiUcStr);
  1238. virtual DBCOLUMNINFO * MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  1239. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  1240. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  1241. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  1242. // Get data value
  1243. //
  1244. virtual integer intValue (void) const;
  1245. virtual real realValue (void) const;
  1246. virtual EAsiBoolean getValue (real *) const;
  1247. virtual EAsiBoolean getValue (integer *) const;
  1248. virtual EAsiBoolean getValue (smallint *) const;
  1249. virtual EAsiBoolean getValue (char *, uint) const;
  1250. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  1251. virtual EAsiBoolean getValue (LARGE_INTEGER *) const;
  1252. virtual EAsiBoolean getValue (ULARGE_INTEGER *) const;
  1253. virtual EAsiBoolean getValue (DECIMAL *) const;
  1254. // ****
  1255. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  1256. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  1257. virtual EAsiBoolean getValue (CAsiData &) const;
  1258. // Runtime class iteraction functions
  1259. //
  1260. virtual unsigned long packSize (void) const;
  1261. virtual unsigned long packTo (CAsiObjPack *) const;
  1262. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  1263. virtual unsigned long packValueSize (void) const;
  1264. virtual unsigned long packValueTo (CAsiObjPack *) const;
  1265. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  1266. // Duplicate itself
  1267. //
  1268. virtual CAsiObject *duplicate (void) const;
  1269. // Operators
  1270. //
  1271. // Assignment
  1272. CAsiDecimal &operator= (const CAsiSmallInt &);
  1273. CAsiDecimal &operator= (const CAsiInt &);
  1274. CAsiDecimal &operator= (const CAsiNumeric &);
  1275. CAsiDecimal &operator= (const CAsiDecimal &);
  1276. CAsiDecimal &operator= (const CAsiFloat &);
  1277. CAsiDecimal &operator= (const CAsiReal &);
  1278. CAsiDecimal &operator= (const CAsiDouble &);
  1279. CAsiDecimal &operator= (const smallint);
  1280. CAsiDecimal &operator= (const integer);
  1281. CAsiDecimal &operator= (const real);
  1282. CAsiDecimal &operator= (const int);
  1283. // Arithmetic operators
  1284. CAsiDecimal &operator+= (const CAsiSmallInt &);
  1285. CAsiDecimal &operator+= (const CAsiInt &);
  1286. CAsiDecimal &operator+= (const CAsiNumeric &);
  1287. CAsiDecimal &operator+= (const CAsiDecimal &);
  1288. CAsiDecimal &operator+= (const CAsiFloat &);
  1289. CAsiDecimal &operator+= (const CAsiReal &);
  1290. CAsiDecimal &operator+= (const CAsiDouble &);
  1291. CAsiDecimal &operator+= (const smallint);
  1292. CAsiDecimal &operator+= (const integer);
  1293. CAsiDecimal &operator+= (const real);
  1294. CAsiDecimal &operator+= (const int);
  1295. CAsiDecimal &operator-= (const CAsiSmallInt &);
  1296. CAsiDecimal &operator-= (const CAsiInt &);
  1297. CAsiDecimal &operator-= (const CAsiNumeric &);
  1298. CAsiDecimal &operator-= (const CAsiDecimal &);
  1299. CAsiDecimal &operator-= (const CAsiFloat &);
  1300. CAsiDecimal &operator-= (const CAsiReal &);
  1301. CAsiDecimal &operator-= (const CAsiDouble &);
  1302. CAsiDecimal &operator-= (const smallint);
  1303. CAsiDecimal &operator-= (const integer);
  1304. CAsiDecimal &operator-= (const real);
  1305. CAsiDecimal &operator-= (const int);
  1306. CAsiDecimal &operator*= (const CAsiSmallInt &);
  1307. CAsiDecimal &operator*= (const CAsiInt &);
  1308. CAsiDecimal &operator*= (const CAsiNumeric &);
  1309. CAsiDecimal &operator*= (const CAsiDecimal &);
  1310. CAsiDecimal &operator*= (const CAsiFloat &);
  1311. CAsiDecimal &operator*= (const CAsiReal &);
  1312. CAsiDecimal &operator*= (const CAsiDouble &);
  1313. CAsiDecimal &operator*= (const smallint);
  1314. CAsiDecimal &operator*= (const integer);
  1315. CAsiDecimal &operator*= (const real);
  1316. CAsiDecimal &operator*= (const int);
  1317. CAsiDecimal &operator/= (const CAsiSmallInt &);
  1318. CAsiDecimal &operator/= (const CAsiInt &);
  1319. CAsiDecimal &operator/= (const CAsiNumeric &);
  1320. CAsiDecimal &operator/= (const CAsiDecimal &);
  1321. CAsiDecimal &operator/= (const CAsiFloat &);
  1322. CAsiDecimal &operator/= (const CAsiReal &);
  1323. CAsiDecimal &operator/= (const CAsiDouble &);
  1324. CAsiDecimal &operator/= (const smallint);
  1325. CAsiDecimal &operator/= (const integer);
  1326. CAsiDecimal &operator/= (const real);
  1327. CAsiDecimal &operator/= (const int);
  1328. CAsiDouble operator+ (const CAsiSmallInt &) const;
  1329. CAsiDouble operator+ (const CAsiInt &) const;
  1330. CAsiDouble operator+ (const CAsiNumeric &) const;
  1331. CAsiDouble operator+ (const CAsiDecimal &) const;
  1332. friend CAsiDouble DLLScope operator+ (const CAsiSmallInt &, const CAsiDecimal &);
  1333. friend CAsiDouble DLLScope operator+ (const CAsiInt &, const CAsiDecimal &) ;
  1334. friend CAsiDouble DLLScope operator+ (const CAsiNumeric &, const CAsiDecimal &) ;
  1335. CAsiDouble operator+ (const smallint) const;
  1336. CAsiDouble operator+ (const integer) const;
  1337. CAsiDouble operator+ (const real) const;
  1338. friend CAsiDouble DLLScope operator+ (const smallint, const CAsiDecimal &);
  1339. friend CAsiDouble DLLScope operator+ (const integer, const CAsiDecimal &) ;
  1340. friend CAsiDouble DLLScope operator+ (const real, const CAsiDecimal &) ;
  1341. CAsiDouble operator+ (const int) const;
  1342. friend CAsiDouble operator+ (const int, const CAsiDecimal &);
  1343. CAsiDouble operator- (const CAsiSmallInt &) const;
  1344. CAsiDouble operator- (const CAsiInt &) const;
  1345. CAsiDouble operator- (const CAsiNumeric &) const;
  1346. CAsiDouble operator- (const CAsiDecimal &) const;
  1347. friend CAsiDouble DLLScope operator- (const CAsiSmallInt &, const CAsiDecimal &);
  1348. friend CAsiDouble DLLScope operator- (const CAsiInt &, const CAsiDecimal &);
  1349. friend CAsiDouble DLLScope operator- (const CAsiNumeric &, const CAsiDecimal &);
  1350. CAsiDouble operator- (const smallint) const;
  1351. CAsiDouble operator- (const integer) const;
  1352. CAsiDouble operator- (const real) const;
  1353. friend CAsiDouble DLLScope operator- (const smallint, const CAsiDecimal &);
  1354. friend CAsiDouble DLLScope operator- (const integer, const CAsiDecimal &) ;
  1355. friend CAsiDouble DLLScope operator- (const real, const CAsiDecimal &) ;
  1356. CAsiDouble operator- (const int) const;
  1357. friend CAsiDouble DLLScope operator- (const int, const CAsiDecimal &);
  1358. CAsiDouble operator* (const CAsiSmallInt &) const;
  1359. CAsiDouble operator* (const CAsiInt &) const;
  1360. CAsiDouble operator* (const CAsiNumeric &) const;
  1361. CAsiDouble operator* (const CAsiDecimal &) const;
  1362. friend CAsiDouble DLLScope operator* (const CAsiSmallInt &, const CAsiDecimal &);
  1363. friend CAsiDouble DLLScope operator* (const CAsiInt &, const CAsiDecimal &) ;
  1364. friend CAsiDouble DLLScope operator* (const CAsiNumeric &, const CAsiDecimal &) ;
  1365. CAsiDouble operator* (const smallint) const;
  1366. CAsiDouble operator* (const integer) const;
  1367. CAsiDouble operator* (const real) const;
  1368. friend CAsiDouble DLLScope operator* (const smallint, const CAsiDecimal &);
  1369. friend CAsiDouble DLLScope operator* (const integer, const CAsiDecimal &) ;
  1370. friend CAsiDouble DLLScope operator* (const real, const CAsiDecimal &) ;
  1371. CAsiDouble operator* (const int) const ;
  1372. friend CAsiDouble DLLScope operator* (const int, const CAsiDecimal &) ;
  1373. CAsiDouble operator/ (const CAsiSmallInt &) const;
  1374. CAsiDouble operator/ (const CAsiInt &) const;
  1375. CAsiDouble operator/ (const CAsiNumeric &) const;
  1376. CAsiDouble operator/ (const CAsiDecimal &) const;
  1377. friend CAsiDouble DLLScope operator/ (const CAsiSmallInt &, const CAsiDecimal &);
  1378. friend CAsiDouble DLLScope operator/ (const CAsiInt &, const CAsiDecimal &);
  1379. friend CAsiDouble DLLScope operator/ (const CAsiNumeric &, const CAsiDecimal &);
  1380. CAsiDouble operator/ (const smallint) const;
  1381. CAsiDouble operator/ (const integer) const;
  1382. CAsiDouble operator/ (const real) const;
  1383. friend CAsiDouble DLLScope operator/ (const smallint, const CAsiDecimal &);
  1384. friend CAsiDouble DLLScope operator/ (const integer, const CAsiDecimal &) ;
  1385. friend CAsiDouble DLLScope operator/ (const real, const CAsiDecimal &) ;
  1386. CAsiDouble operator/ (const int) const;
  1387. friend CAsiDouble DLLScope operator/ (const int, const CAsiDecimal &);
  1388. CAsiDecimal &operator++ (void);
  1389. CAsiDecimal &operator-- (void);
  1390. CAsiDecimal &operator- (void);
  1391. private:
  1392. EAsiBoolean fmt;
  1393. ASIBCD bcdvalue;
  1394. double realvalue;
  1395. };
  1396. ////////////////////////////////////////////////
  1397. //
  1398. //
  1399. class CAsiFloat: public CAsiApproxNum
  1400. //
  1401. // FLOAT
  1402. //
  1403. {
  1404. public:
  1405. CAsiFloat (void);
  1406. CAsiFloat (uint);
  1407. CAsiFloat (const CAsiFloat &);
  1408. virtual ~CAsiFloat (void);
  1409. // Get data descriptor
  1410. //
  1411. virtual EAsiDataType Type (void) const;
  1412. virtual uint ReturnLength (void) const;
  1413. virtual CAsiData * checkAdd (const CAsiData *) const;
  1414. virtual CAsiData * checkSub (const CAsiData *) const;
  1415. virtual CAsiData * checkMul (const CAsiData *) const;
  1416. virtual CAsiData * checkDiv (const CAsiData *) const;
  1417. virtual CAsiData * checkSet (const CAsiData *) const;
  1418. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  1419. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  1420. // Store Data value
  1421. //
  1422. virtual EAsiBoolean storeValue (real);
  1423. virtual EAsiBoolean storeValue (integer);
  1424. virtual EAsiBoolean storeValue (smallint);
  1425. virtual EAsiBoolean storeValue (char *, uint);
  1426. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  1427. virtual EAsiBoolean storeValue (const CAsiData &);
  1428. // ****
  1429. virtual EAsiBoolean storeValue (char *, uint, uint *);
  1430. virtual EAsiBoolean storeValue (const AsiUcStr);
  1431. virtual DBCOLUMNINFO *MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  1432. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  1433. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  1434. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  1435. // Get data value
  1436. //
  1437. virtual integer intValue (void) const;
  1438. virtual real realValue (void) const;
  1439. virtual EAsiBoolean getValue (real *) const;
  1440. virtual EAsiBoolean getValue (integer *) const;
  1441. virtual EAsiBoolean getValue (smallint *) const;
  1442. virtual EAsiBoolean getValue (char *, uint) const;
  1443. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  1444. // ****
  1445. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  1446. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  1447. virtual EAsiBoolean getValue (CAsiData &) const;
  1448. // Runtime class iteraction functions
  1449. //
  1450. virtual unsigned long packSize (void) const;
  1451. virtual unsigned long packTo (CAsiObjPack *) const;
  1452. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  1453. virtual unsigned long packValueSize (void) const;
  1454. virtual unsigned long packValueTo (CAsiObjPack *) const;
  1455. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  1456. // Duplicate itself
  1457. //
  1458. virtual CAsiObject *duplicate (void) const;
  1459. // Operators
  1460. //
  1461. // Assignment
  1462. CAsiFloat &operator= (const CAsiSmallInt &);
  1463. CAsiFloat &operator= (const CAsiInt &);
  1464. CAsiFloat &operator= (const CAsiNumeric &);
  1465. CAsiFloat &operator= (const CAsiDecimal &);
  1466. CAsiFloat &operator= (const CAsiFloat &);
  1467. CAsiFloat &operator= (const CAsiReal &);
  1468. CAsiFloat &operator= (const CAsiDouble &);
  1469. CAsiFloat &operator= (const smallint);
  1470. CAsiFloat &operator= (const integer);
  1471. CAsiFloat &operator= (const real);
  1472. CAsiFloat &operator= (const int);
  1473. // Arithmetic operators
  1474. CAsiFloat &operator+= (const CAsiSmallInt &);
  1475. CAsiFloat &operator+= (const CAsiInt &);
  1476. CAsiFloat &operator+= (const CAsiNumeric &);
  1477. CAsiFloat &operator+= (const CAsiDecimal &);
  1478. CAsiFloat &operator+= (const CAsiFloat &);
  1479. CAsiFloat &operator+= (const CAsiReal &);
  1480. CAsiFloat &operator+= (const CAsiDouble &);
  1481. CAsiFloat &operator+= (const smallint);
  1482. CAsiFloat &operator+= (const integer);
  1483. CAsiFloat &operator+= (const real);
  1484. CAsiFloat &operator+= (const int);
  1485. CAsiFloat &operator-= (const CAsiSmallInt &);
  1486. CAsiFloat &operator-= (const CAsiInt &);
  1487. CAsiFloat &operator-= (const CAsiNumeric &);
  1488. CAsiFloat &operator-= (const CAsiDecimal &);
  1489. CAsiFloat &operator-= (const CAsiFloat &);
  1490. CAsiFloat &operator-= (const CAsiReal &);
  1491. CAsiFloat &operator-= (const CAsiDouble &);
  1492. CAsiFloat &operator-= (const smallint);
  1493. CAsiFloat &operator-= (const integer);
  1494. CAsiFloat &operator-= (const real);
  1495. CAsiFloat &operator-= (const int);
  1496. CAsiFloat &operator*= (const CAsiSmallInt &);
  1497. CAsiFloat &operator*= (const CAsiInt &);
  1498. CAsiFloat &operator*= (const CAsiNumeric &);
  1499. CAsiFloat &operator*= (const CAsiDecimal &);
  1500. CAsiFloat &operator*= (const CAsiFloat &);
  1501. CAsiFloat &operator*= (const CAsiReal &);
  1502. CAsiFloat &operator*= (const CAsiDouble &);
  1503. CAsiFloat &operator*= (const smallint);
  1504. CAsiFloat &operator*= (const integer);
  1505. CAsiFloat &operator*= (const real);
  1506. CAsiFloat &operator*= (const int);
  1507. CAsiFloat &operator/= (const CAsiSmallInt &);
  1508. CAsiFloat &operator/= (const CAsiInt &);
  1509. CAsiFloat &operator/= (const CAsiNumeric &);
  1510. CAsiFloat &operator/= (const CAsiDecimal &);
  1511. CAsiFloat &operator/= (const CAsiFloat &);
  1512. CAsiFloat &operator/= (const CAsiReal &);
  1513. CAsiFloat &operator/= (const CAsiDouble &);
  1514. CAsiFloat &operator/= (const smallint);
  1515. CAsiFloat &operator/= (const integer);
  1516. CAsiFloat &operator/= (const real);
  1517. CAsiFloat &operator/= (const int);
  1518. CAsiFloat operator+ (const CAsiSmallInt &) const;
  1519. CAsiFloat operator+ (const CAsiInt &) const;
  1520. CAsiFloat operator+ (const CAsiNumeric &) const;
  1521. CAsiFloat operator+ (const CAsiDecimal &) const;
  1522. CAsiFloat operator+ (const CAsiFloat &) const;
  1523. friend CAsiFloat DLLScope operator+ (const CAsiSmallInt &, const CAsiFloat &);
  1524. friend CAsiFloat DLLScope operator+ (const CAsiInt &, const CAsiFloat &) ;
  1525. friend CAsiFloat DLLScope operator+ (const CAsiNumeric &, const CAsiFloat &) ;
  1526. friend CAsiFloat DLLScope operator+ (const CAsiDecimal &, const CAsiFloat &) ;
  1527. CAsiFloat operator+ (const smallint) const;
  1528. CAsiFloat operator+ (const integer) const;
  1529. CAsiFloat operator+ (const real) const;
  1530. friend CAsiFloat DLLScope operator+ (const smallint, const CAsiFloat &);
  1531. friend CAsiFloat DLLScope operator+ (const integer, const CAsiFloat &) ;
  1532. friend CAsiFloat DLLScope operator+ (const real, const CAsiFloat &) ;
  1533. CAsiFloat operator+ (const int) const;
  1534. friend CAsiFloat DLLScope operator+ (const int, const CAsiFloat &);
  1535. CAsiFloat operator- (const CAsiSmallInt &) const;
  1536. CAsiFloat operator- (const CAsiInt &) const;
  1537. CAsiFloat operator- (const CAsiNumeric &) const;
  1538. CAsiFloat operator- (const CAsiDecimal &) const;
  1539. CAsiFloat operator- (const CAsiFloat &) const;
  1540. friend CAsiFloat DLLScope operator- (const CAsiSmallInt &, const CAsiFloat &);
  1541. friend CAsiFloat DLLScope operator- (const CAsiInt &, const CAsiFloat &);
  1542. friend CAsiFloat DLLScope operator- (const CAsiNumeric &, const CAsiFloat &);
  1543. friend CAsiFloat DLLScope operator- (const CAsiDecimal &, const CAsiFloat &);
  1544. CAsiFloat operator- (const smallint) const;
  1545. CAsiFloat operator- (const integer) const;
  1546. CAsiFloat operator- (const real) const;
  1547. friend CAsiFloat DLLScope operator- (const smallint, const CAsiFloat &);
  1548. friend CAsiFloat DLLScope operator- (const integer, const CAsiFloat &);
  1549. friend CAsiFloat DLLScope operator- (const real, const CAsiFloat &);
  1550. CAsiFloat operator- (const int) const;
  1551. friend CAsiFloat DLLScope operator- (const int, const CAsiFloat &);
  1552. CAsiFloat operator* (const CAsiSmallInt &) const;
  1553. CAsiFloat operator* (const CAsiInt &) const;
  1554. CAsiFloat operator* (const CAsiNumeric &) const;
  1555. CAsiFloat operator* (const CAsiDecimal &) const;
  1556. CAsiFloat operator* (const CAsiFloat &) const;
  1557. friend CAsiFloat DLLScope operator* (const CAsiSmallInt &, const CAsiFloat &);
  1558. friend CAsiFloat DLLScope operator* (const CAsiInt &, const CAsiFloat &);
  1559. friend CAsiFloat DLLScope operator* (const CAsiNumeric &, const CAsiFloat &);
  1560. friend CAsiFloat DLLScope operator* (const CAsiDecimal &, const CAsiFloat &);
  1561. CAsiFloat operator* (const smallint) const;
  1562. CAsiFloat operator* (const integer) const;
  1563. CAsiFloat operator* (const real) const;
  1564. friend CAsiFloat DLLScope operator* (const smallint, const CAsiFloat &);
  1565. friend CAsiFloat DLLScope operator* (const integer, const CAsiFloat &);
  1566. friend CAsiFloat DLLScope operator* (const real, const CAsiFloat &);
  1567. CAsiFloat operator* (const int) const;
  1568. friend CAsiFloat DLLScope operator* (const int, const CAsiFloat &);
  1569. CAsiFloat operator/ (const CAsiSmallInt &) const;
  1570. CAsiFloat operator/ (const CAsiInt &) const;
  1571. CAsiFloat operator/ (const CAsiNumeric &) const;
  1572. CAsiFloat operator/ (const CAsiDecimal &) const;
  1573. CAsiFloat operator/ (const CAsiFloat &) const;
  1574. friend CAsiFloat DLLScope operator/ (const CAsiSmallInt &, const CAsiFloat &);
  1575. friend CAsiFloat DLLScope operator/ (const CAsiInt &, const CAsiFloat &);
  1576. friend CAsiFloat DLLScope operator/ (const CAsiNumeric &, const CAsiFloat &);
  1577. friend CAsiFloat DLLScope operator/ (const CAsiDecimal &, const CAsiFloat &);
  1578. CAsiFloat operator/ (const smallint) const;
  1579. CAsiFloat operator/ (const integer) const;
  1580. CAsiFloat operator/ (const real) const;
  1581. friend CAsiFloat DLLScope operator/ (const smallint, const CAsiFloat &);
  1582. friend CAsiFloat DLLScope operator/ (const integer, const CAsiFloat &);
  1583. friend CAsiFloat DLLScope operator/ (const real, const CAsiFloat &) ;
  1584. CAsiFloat operator/ (const int) const;
  1585. friend CAsiFloat DLLScope operator/ (const int, const CAsiFloat &);
  1586. CAsiFloat &operator++ (void);
  1587. CAsiFloat &operator-- (void);
  1588. CAsiFloat &operator- (void);
  1589. private:
  1590. real fvalue;
  1591. };
  1592. ////////////////////////////////////////////////
  1593. //
  1594. //
  1595. class CAsiReal: public CAsiApproxNum
  1596. //
  1597. // REAL
  1598. //
  1599. // This class introduces functionality of the SQL REAL data.
  1600. // It redefines all arithmetic and comparision operators in which
  1601. // real number can be involved in SQL. Memeber functions also allow
  1602. // to set and retrieve value of the internal real number in double and
  1603. // integer formats.
  1604. {
  1605. public:
  1606. CAsiReal (void);
  1607. CAsiReal (const CAsiReal &);
  1608. virtual ~CAsiReal (void);
  1609. // Get data descriptor
  1610. //
  1611. virtual EAsiDataType Type (void) const;
  1612. virtual uint ReturnLength (void) const;
  1613. virtual CAsiData * checkAdd (const CAsiData *) const;
  1614. virtual CAsiData * checkSub (const CAsiData *) const;
  1615. virtual CAsiData * checkMul (const CAsiData *) const;
  1616. virtual CAsiData * checkDiv (const CAsiData *) const;
  1617. virtual CAsiData * checkSet (const CAsiData *) const;
  1618. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  1619. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  1620. // Store Data value
  1621. //
  1622. virtual EAsiBoolean storeValue (real);
  1623. virtual EAsiBoolean storeValue (integer);
  1624. virtual EAsiBoolean storeValue (smallint);
  1625. virtual EAsiBoolean storeValue (char *, uint);
  1626. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  1627. virtual EAsiBoolean storeValue (const CAsiData &);
  1628. // ****
  1629. virtual EAsiBoolean storeValue (char *, uint, uint *);
  1630. virtual EAsiBoolean storeValue (const AsiUcStr);
  1631. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  1632. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  1633. // Get data value
  1634. //
  1635. virtual integer intValue (void) const;
  1636. virtual real realValue (void) const;
  1637. virtual EAsiBoolean getValue (real *) const;
  1638. virtual EAsiBoolean getValue (integer *) const;
  1639. virtual EAsiBoolean getValue (smallint *) const;
  1640. virtual EAsiBoolean getValue (char *, uint) const;
  1641. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  1642. // ****
  1643. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  1644. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  1645. virtual EAsiBoolean getValue (CAsiData &) const;
  1646. virtual DBCOLUMNINFO * MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  1647. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  1648. // Runtime class iteraction functions
  1649. //
  1650. virtual unsigned long packSize (void) const;
  1651. virtual unsigned long packTo (CAsiObjPack *) const;
  1652. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  1653. virtual unsigned long packValueSize (void) const;
  1654. virtual unsigned long packValueTo (CAsiObjPack *) const;
  1655. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  1656. // Duplicate itself
  1657. //
  1658. virtual CAsiObject * duplicate (void) const;
  1659. // Operators
  1660. //
  1661. // Assignment
  1662. CAsiReal &operator= (const CAsiSmallInt &);
  1663. CAsiReal &operator= (const CAsiInt &);
  1664. CAsiReal &operator= (const CAsiNumeric &);
  1665. CAsiReal &operator= (const CAsiDecimal &);
  1666. CAsiReal &operator= (const CAsiFloat &);
  1667. CAsiReal &operator= (const CAsiReal &);
  1668. CAsiReal &operator= (const CAsiDouble &);
  1669. CAsiReal &operator= (const smallint);
  1670. CAsiReal &operator= (const integer);
  1671. CAsiReal &operator= (const real);
  1672. CAsiReal &operator= (const int);
  1673. // Arithmetic operators
  1674. CAsiReal &operator+= (const CAsiSmallInt &);
  1675. CAsiReal &operator+= (const CAsiInt &);
  1676. CAsiReal &operator+= (const CAsiNumeric &);
  1677. CAsiReal &operator+= (const CAsiDecimal &);
  1678. CAsiReal &operator+= (const CAsiFloat &);
  1679. CAsiReal &operator+= (const CAsiReal &);
  1680. CAsiReal &operator+= (const CAsiDouble &);
  1681. CAsiReal &operator+= (const smallint);
  1682. CAsiReal &operator+= (const integer);
  1683. CAsiReal &operator+= (const real);
  1684. CAsiReal &operator+= (const int);
  1685. CAsiReal &operator-= (const CAsiSmallInt &);
  1686. CAsiReal &operator-= (const CAsiInt &);
  1687. CAsiReal &operator-= (const CAsiNumeric &);
  1688. CAsiReal &operator-= (const CAsiDecimal &);
  1689. CAsiReal &operator-= (const CAsiFloat &);
  1690. CAsiReal &operator-= (const CAsiReal &);
  1691. CAsiReal &operator-= (const CAsiDouble &);
  1692. CAsiReal &operator-= (const smallint);
  1693. CAsiReal &operator-= (const integer);
  1694. CAsiReal &operator-= (const real);
  1695. CAsiReal &operator-= (const int);
  1696. CAsiReal &operator*= (const CAsiSmallInt &);
  1697. CAsiReal &operator*= (const CAsiInt &);
  1698. CAsiReal &operator*= (const CAsiNumeric &);
  1699. CAsiReal &operator*= (const CAsiDecimal &);
  1700. CAsiReal &operator*= (const CAsiFloat &);
  1701. CAsiReal &operator*= (const CAsiReal &);
  1702. CAsiReal &operator*= (const CAsiDouble &);
  1703. CAsiReal &operator*= (const smallint);
  1704. CAsiReal &operator*= (const integer);
  1705. CAsiReal &operator*= (const real);
  1706. CAsiReal &operator*= (const int);
  1707. CAsiReal &operator/= (const CAsiSmallInt &);
  1708. CAsiReal &operator/= (const CAsiInt &);
  1709. CAsiReal &operator/= (const CAsiNumeric &);
  1710. CAsiReal &operator/= (const CAsiDecimal &);
  1711. CAsiReal &operator/= (const CAsiFloat &);
  1712. CAsiReal &operator/= (const CAsiReal &);
  1713. CAsiReal &operator/= (const CAsiDouble &);
  1714. CAsiReal &operator/= (const smallint);
  1715. CAsiReal &operator/= (const integer);
  1716. CAsiReal &operator/= (const real);
  1717. CAsiReal &operator/= (const int);
  1718. CAsiReal operator+ (const CAsiSmallInt &) const;
  1719. CAsiReal operator+ (const CAsiInt &) const;
  1720. CAsiReal operator+ (const CAsiNumeric &) const;
  1721. CAsiReal operator+ (const CAsiDecimal &) const;
  1722. CAsiReal operator+ (const CAsiFloat &) const;
  1723. CAsiReal operator+ (const CAsiReal &) const;
  1724. friend CAsiReal DLLScope operator+ (const CAsiSmallInt &, const CAsiReal &);
  1725. friend CAsiReal DLLScope operator+ (const CAsiInt &, const CAsiReal &);
  1726. friend CAsiReal DLLScope operator+ (const CAsiNumeric &, const CAsiReal &);
  1727. friend CAsiReal DLLScope operator+ (const CAsiDecimal &, const CAsiReal &);
  1728. friend CAsiReal DLLScope operator+ (const CAsiFloat &, const CAsiReal &) ;
  1729. CAsiReal operator+ (const smallint) const;
  1730. CAsiReal operator+ (const integer) const;
  1731. CAsiReal operator+ (const real) const;
  1732. friend CAsiReal DLLScope operator+ (const smallint, const CAsiReal &);
  1733. friend CAsiReal DLLScope operator+ (const integer, const CAsiReal &) ;
  1734. friend CAsiReal DLLScope operator+ (const real, const CAsiReal &) ;
  1735. CAsiReal operator+ (const int) const;
  1736. friend CAsiReal DLLScope operator+ (const int, const CAsiReal &);
  1737. CAsiReal operator- (const CAsiSmallInt &) const;
  1738. CAsiReal operator- (const CAsiInt &) const;
  1739. CAsiReal operator- (const CAsiNumeric &) const;
  1740. CAsiReal operator- (const CAsiDecimal &) const;
  1741. CAsiReal operator- (const CAsiFloat &) const;
  1742. CAsiReal operator- (const CAsiReal &) const;
  1743. friend CAsiReal DLLScope operator- (const CAsiSmallInt &, const CAsiReal &);
  1744. friend CAsiReal DLLScope operator- (const CAsiInt &, const CAsiReal &);
  1745. friend CAsiReal DLLScope operator- (const CAsiNumeric &, const CAsiReal &);
  1746. friend CAsiReal DLLScope operator- (const CAsiDecimal &, const CAsiReal &);
  1747. friend CAsiReal DLLScope operator- (const CAsiFloat &, const CAsiReal &) ;
  1748. CAsiReal operator- (const smallint) const;
  1749. CAsiReal operator- (const integer) const;
  1750. CAsiReal operator- (const real) const;
  1751. friend CAsiReal DLLScope operator- (const smallint, const CAsiReal &);
  1752. friend CAsiReal DLLScope operator- (const integer, const CAsiReal &);
  1753. friend CAsiReal DLLScope operator- (const real, const CAsiReal &);
  1754. CAsiReal operator- (const int) const;
  1755. friend CAsiReal DLLScope operator- (const int, const CAsiReal &);
  1756. CAsiReal operator* (const CAsiSmallInt &) const;
  1757. CAsiReal operator* (const CAsiInt &) const;
  1758. CAsiReal operator* (const CAsiNumeric &) const;
  1759. CAsiReal operator* (const CAsiDecimal &) const;
  1760. CAsiReal operator* (const CAsiFloat &) const;
  1761. CAsiReal operator* (const CAsiReal &) const;
  1762. friend CAsiReal DLLScope operator* (const CAsiSmallInt &, const CAsiReal &);
  1763. friend CAsiReal DLLScope operator* (const CAsiInt &, const CAsiReal &);
  1764. friend CAsiReal DLLScope operator* (const CAsiNumeric &, const CAsiReal &);
  1765. friend CAsiReal DLLScope operator* (const CAsiDecimal &, const CAsiReal &);
  1766. friend CAsiReal DLLScope operator* (const CAsiFloat &, const CAsiReal &) ;
  1767. CAsiReal operator* (const smallint) const;
  1768. CAsiReal operator* (const integer) const;
  1769. CAsiReal operator* (const real) const;
  1770. friend CAsiReal DLLScope operator* (const smallint, const CAsiReal &);
  1771. friend CAsiReal DLLScope operator* (const integer, const CAsiReal &) ;
  1772. friend CAsiReal DLLScope operator* (const real, const CAsiReal &) ;
  1773. CAsiReal operator* (const int) const;
  1774. friend CAsiReal DLLScope operator* (const int, const CAsiReal &);
  1775. CAsiReal operator/ (const CAsiSmallInt &) const;
  1776. CAsiReal operator/ (const CAsiInt &) const;
  1777. CAsiReal operator/ (const CAsiNumeric &) const;
  1778. CAsiReal operator/ (const CAsiDecimal &) const;
  1779. CAsiReal operator/ (const CAsiFloat &) const;
  1780. CAsiReal operator/ (const CAsiReal &) const;
  1781. friend CAsiReal DLLScope operator/ (const CAsiSmallInt &, const CAsiReal &);
  1782. friend CAsiReal DLLScope operator/ (const CAsiInt &, const CAsiReal &);
  1783. friend CAsiReal DLLScope operator/ (const CAsiNumeric &, const CAsiReal &);
  1784. friend CAsiReal DLLScope operator/ (const CAsiDecimal &, const CAsiReal &);
  1785. friend CAsiReal DLLScope operator/ (const CAsiFloat &, const CAsiReal &) ;
  1786. CAsiReal operator/ (const smallint) const;
  1787. CAsiReal operator/ (const integer) const;
  1788. CAsiReal operator/ (const real) const;
  1789. friend CAsiReal DLLScope operator/ (const smallint, const CAsiReal &);
  1790. friend CAsiReal DLLScope operator/ (const integer, const CAsiReal &) ;
  1791. friend CAsiReal DLLScope operator/ (const real, const CAsiReal &);
  1792. CAsiReal operator/ (const int) const;
  1793. friend CAsiReal DLLScope operator/ (const int, const CAsiReal &);
  1794. CAsiReal &operator++ (void);
  1795. CAsiReal &operator-- (void);
  1796. CAsiReal &operator- (void);
  1797. private:
  1798. real rvalue;
  1799. };
  1800. ////////////////////////////////////////////////
  1801. //
  1802. //
  1803. class CAsiDouble: public CAsiApproxNum
  1804. //
  1805. // DOUBLE PRECISION
  1806. //
  1807. {
  1808. public:
  1809. CAsiDouble (void);
  1810. CAsiDouble (const CAsiDouble &);
  1811. virtual ~CAsiDouble (void);
  1812. // Get data descriptor
  1813. //
  1814. virtual EAsiDataType Type (void) const;
  1815. virtual uint ReturnLength (void) const;
  1816. virtual CAsiData * checkAdd (const CAsiData *) const;
  1817. virtual CAsiData * checkSub (const CAsiData *) const;
  1818. virtual CAsiData * checkMul (const CAsiData *) const;
  1819. virtual CAsiData * checkDiv (const CAsiData *) const;
  1820. virtual CAsiData * checkSet (const CAsiData *) const;
  1821. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  1822. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  1823. // Store Data value
  1824. //
  1825. virtual EAsiBoolean storeValue (real);
  1826. virtual EAsiBoolean storeValue (integer);
  1827. virtual EAsiBoolean storeValue (smallint);
  1828. virtual EAsiBoolean storeValue (char *, uint);
  1829. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  1830. virtual EAsiBoolean storeValue (const CAsiData &);
  1831. // ****
  1832. virtual EAsiBoolean storeValue (char *, uint, uint *);
  1833. virtual EAsiBoolean storeValue (const AsiUcStr);
  1834. // Get data value
  1835. //
  1836. virtual integer intValue (void) const;
  1837. virtual real realValue (void) const;
  1838. virtual EAsiBoolean getValue (real *) const;
  1839. virtual EAsiBoolean getValue (integer *) const;
  1840. virtual EAsiBoolean getValue (smallint *) const;
  1841. virtual EAsiBoolean getValue (char *, uint) const;
  1842. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  1843. // ****
  1844. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  1845. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  1846. virtual EAsiBoolean getValue (CAsiData &) const;
  1847. virtual DBCOLUMNINFO * MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  1848. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  1849. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  1850. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  1851. // Runtime class iteraction functions
  1852. //
  1853. virtual unsigned long packSize (void) const;
  1854. virtual unsigned long packTo (CAsiObjPack *) const;
  1855. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  1856. virtual unsigned long packValueSize (void) const;
  1857. virtual unsigned long packValueTo (CAsiObjPack *) const;
  1858. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  1859. // Duplicate itself
  1860. //
  1861. virtual CAsiObject *duplicate (void) const;
  1862. // Operators
  1863. //
  1864. // Assignment
  1865. CAsiDouble &operator= (const CAsiSmallInt &);
  1866. CAsiDouble &operator= (const CAsiInt &);
  1867. CAsiDouble &operator= (const CAsiNumeric &);
  1868. CAsiDouble &operator= (const CAsiDecimal &);
  1869. CAsiDouble &operator= (const CAsiFloat &);
  1870. CAsiDouble &operator= (const CAsiReal &);
  1871. CAsiDouble &operator= (const CAsiDouble &);
  1872. CAsiDouble &operator= (const smallint);
  1873. CAsiDouble &operator= (const integer);
  1874. CAsiDouble &operator= (const real);
  1875. CAsiDouble &operator= (const int);
  1876. // Arithmetic operators
  1877. CAsiDouble &operator+= (const CAsiSmallInt &);
  1878. CAsiDouble &operator+= (const CAsiInt &);
  1879. CAsiDouble &operator+= (const CAsiNumeric &);
  1880. CAsiDouble &operator+= (const CAsiDecimal &);
  1881. CAsiDouble &operator+= (const CAsiFloat &);
  1882. CAsiDouble &operator+= (const CAsiReal &);
  1883. CAsiDouble &operator+= (const CAsiDouble &);
  1884. CAsiDouble &operator+= (const smallint);
  1885. CAsiDouble &operator+= (const integer);
  1886. CAsiDouble &operator+= (const real);
  1887. CAsiDouble &operator+= (const int);
  1888. CAsiDouble &operator-= (const CAsiSmallInt &);
  1889. CAsiDouble &operator-= (const CAsiInt &);
  1890. CAsiDouble &operator-= (const CAsiNumeric &);
  1891. CAsiDouble &operator-= (const CAsiDecimal &);
  1892. CAsiDouble &operator-= (const CAsiFloat &);
  1893. CAsiDouble &operator-= (const CAsiReal &);
  1894. CAsiDouble &operator-= (const CAsiDouble &);
  1895. CAsiDouble &operator-= (const smallint);
  1896. CAsiDouble &operator-= (const integer);
  1897. CAsiDouble &operator-= (const real);
  1898. CAsiDouble &operator-= (const int);
  1899. CAsiDouble &operator*= (const CAsiSmallInt &);
  1900. CAsiDouble &operator*= (const CAsiInt &);
  1901. CAsiDouble &operator*= (const CAsiNumeric &);
  1902. CAsiDouble &operator*= (const CAsiDecimal &);
  1903. CAsiDouble &operator*= (const CAsiFloat &);
  1904. CAsiDouble &operator*= (const CAsiReal &);
  1905. CAsiDouble &operator*= (const CAsiDouble &);
  1906. CAsiDouble &operator*= (const smallint);
  1907. CAsiDouble &operator*= (const integer);
  1908. CAsiDouble &operator*= (const real);
  1909. CAsiDouble &operator*= (const int);
  1910. CAsiDouble &operator/= (const CAsiSmallInt &);
  1911. CAsiDouble &operator/= (const CAsiInt &);
  1912. CAsiDouble &operator/= (const CAsiNumeric &);
  1913. CAsiDouble &operator/= (const CAsiDecimal &);
  1914. CAsiDouble &operator/= (const CAsiFloat &);
  1915. CAsiDouble &operator/= (const CAsiReal &);
  1916. CAsiDouble &operator/= (const CAsiDouble &);
  1917. CAsiDouble &operator/= (const smallint);
  1918. CAsiDouble &operator/= (const integer);
  1919. CAsiDouble &operator/= (const real);
  1920. CAsiDouble &operator/= (const int);
  1921. CAsiDouble operator+ (const CAsiSmallInt &) const;
  1922. CAsiDouble operator+ (const CAsiInt &) const;
  1923. CAsiDouble operator+ (const CAsiNumeric &) const;
  1924. CAsiDouble operator+ (const CAsiDecimal &) const;
  1925. CAsiDouble operator+ (const CAsiFloat &) const;
  1926. CAsiDouble operator+ (const CAsiReal &) const;
  1927. CAsiDouble operator+ (const CAsiDouble &) const;
  1928. friend CAsiDouble DLLScope operator+ (const CAsiSmallInt &, const CAsiDouble &);
  1929. friend CAsiDouble DLLScope operator+ (const CAsiInt &, const CAsiDouble &);
  1930. friend CAsiDouble DLLScope operator+ (const CAsiNumeric &, const CAsiDouble &);
  1931. friend CAsiDouble DLLScope operator+ (const CAsiDecimal &, const CAsiDouble &);
  1932. friend CAsiDouble DLLScope operator+ (const CAsiFloat &, const CAsiDouble &);
  1933. friend CAsiDouble DLLScope operator+ (const CAsiReal &, const CAsiDouble &);
  1934. CAsiDouble operator+ (const smallint) const;
  1935. CAsiDouble operator+ (const integer) const;
  1936. CAsiDouble operator+ (const real) const;
  1937. friend CAsiDouble DLLScope operator+ (const smallint, const CAsiDouble &);
  1938. friend CAsiDouble DLLScope operator+ (const integer, const CAsiDouble &) ;
  1939. friend CAsiDouble DLLScope operator+ (const real, const CAsiDouble &) ;
  1940. CAsiDouble operator+ (const int) const;
  1941. friend CAsiDouble DLLScope operator+ (const int, const CAsiDouble &);
  1942. CAsiDouble operator- (const CAsiSmallInt &) const;
  1943. CAsiDouble operator- (const CAsiInt &) const;
  1944. CAsiDouble operator- (const CAsiNumeric &) const;
  1945. CAsiDouble operator- (const CAsiDecimal &) const;
  1946. CAsiDouble operator- (const CAsiFloat &) const;
  1947. CAsiDouble operator- (const CAsiReal &) const;
  1948. CAsiDouble operator- (const CAsiDouble &) const;
  1949. friend CAsiDouble DLLScope operator- (const CAsiSmallInt &, const CAsiDouble &);
  1950. friend CAsiDouble DLLScope operator- (const CAsiInt &, const CAsiDouble &);
  1951. friend CAsiDouble DLLScope operator- (const CAsiNumeric &, const CAsiDouble &);
  1952. friend CAsiDouble DLLScope operator- (const CAsiDecimal &, const CAsiDouble &);
  1953. friend CAsiDouble DLLScope operator- (const CAsiFloat &, const CAsiDouble &) ;
  1954. friend CAsiDouble DLLScope operator- (const CAsiReal &, const CAsiDouble &);
  1955. CAsiDouble operator- (const smallint) const;
  1956. CAsiDouble operator- (const integer) const;
  1957. CAsiDouble operator- (const real) const;
  1958. friend CAsiDouble DLLScope operator- (const smallint, const CAsiDouble &);
  1959. friend CAsiDouble DLLScope operator- (const integer, const CAsiDouble &);
  1960. friend CAsiDouble DLLScope operator- (const real, const CAsiDouble &);
  1961. CAsiDouble operator- (const int) const;
  1962. friend CAsiDouble DLLScope operator- (const int, const CAsiDouble &);
  1963. CAsiDouble operator* (const CAsiSmallInt &) const;
  1964. CAsiDouble operator* (const CAsiInt &) const;
  1965. CAsiDouble operator* (const CAsiNumeric &) const;
  1966. CAsiDouble operator* (const CAsiDecimal &) const;
  1967. CAsiDouble operator* (const CAsiFloat &) const;
  1968. CAsiDouble operator* (const CAsiReal &) const;
  1969. CAsiDouble operator* (const CAsiDouble &) const;
  1970. friend CAsiDouble DLLScope operator* (const CAsiSmallInt &, const CAsiDouble &);
  1971. friend CAsiDouble DLLScope operator* (const CAsiInt &, const CAsiDouble &);
  1972. friend CAsiDouble DLLScope operator* (const CAsiNumeric &, const CAsiDouble &);
  1973. friend CAsiDouble DLLScope operator* (const CAsiDecimal &, const CAsiDouble &);
  1974. friend CAsiDouble DLLScope operator* (const CAsiFloat &, const CAsiDouble &);
  1975. friend CAsiDouble DLLScope operator* (const CAsiReal &, const CAsiDouble &);
  1976. CAsiDouble operator* (const smallint) const;
  1977. CAsiDouble operator* (const integer) const;
  1978. CAsiDouble operator* (const real) const;
  1979. friend CAsiDouble DLLScope operator* (const smallint, const CAsiDouble &);
  1980. friend CAsiDouble DLLScope operator* (const integer, const CAsiDouble &);
  1981. friend CAsiDouble DLLScope operator* (const real, const CAsiDouble &);
  1982. CAsiDouble operator* (const int) const;
  1983. friend CAsiDouble DLLScope operator* (const int, const CAsiDouble &);
  1984. CAsiDouble operator/ (const CAsiSmallInt &) const;
  1985. CAsiDouble operator/ (const CAsiInt &) const;
  1986. CAsiDouble operator/ (const CAsiNumeric &) const;
  1987. CAsiDouble operator/ (const CAsiDecimal &) const;
  1988. CAsiDouble operator/ (const CAsiFloat &) const;
  1989. CAsiDouble operator/ (const CAsiReal &) const;
  1990. CAsiDouble operator/ (const CAsiDouble &) const;
  1991. friend CAsiDouble DLLScope operator/ (const CAsiSmallInt &, const CAsiDouble &);
  1992. friend CAsiDouble DLLScope operator/ (const CAsiInt &, const CAsiDouble &);
  1993. friend CAsiDouble DLLScope operator/ (const CAsiNumeric &, const CAsiDouble &);
  1994. friend CAsiDouble DLLScope operator/ (const CAsiDecimal &, const CAsiDouble &);
  1995. friend CAsiDouble DLLScope operator/ (const CAsiFloat &, const CAsiDouble &);
  1996. friend CAsiDouble DLLScope operator/ (const CAsiReal &, const CAsiDouble &);
  1997. CAsiDouble operator/ (const smallint) const;
  1998. CAsiDouble operator/ (const integer) const;
  1999. CAsiDouble operator/ (const real) const;
  2000. friend CAsiDouble DLLScope operator/ (const smallint, const CAsiDouble &);
  2001. friend CAsiDouble DLLScope operator/ (const integer, const CAsiDouble &);
  2002. friend CAsiDouble DLLScope operator/ (const real, const CAsiDouble &);
  2003. CAsiDouble operator/ (const int) const;
  2004. friend CAsiDouble DLLScope operator/ (const int, const CAsiDouble &);
  2005. CAsiDouble &operator++ (void);
  2006. CAsiDouble &operator-- (void);
  2007. CAsiDouble &operator- (void);
  2008. private:
  2009. real dvalue;
  2010. };
  2011. ////////////////////////////////////////////////
  2012. //
  2013. //
  2014. class CAsiChar: public CAsiData
  2015. //
  2016. // CHARACTER and CHAR VARYING
  2017. //
  2018. {
  2019. friend class CAsiTempTable;
  2020. public:
  2021. // Construction/Destruction
  2022. //
  2023. CAsiChar ();
  2024. CAsiChar (uint);
  2025. CAsiChar (const CAsiChar &);
  2026. virtual ~CAsiChar ();
  2027. // Set Varying, National, Character set name, and Collation
  2028. void setVarying (void);
  2029. void setNational (void);
  2030. void setCharSet (const CAsiUcStr &);
  2031. void setDefCharSet (void);
  2032. void setCollName (const CAsiUcStr &);
  2033. void setCollIdent (AsiUcIdCLT);
  2034. void setCoerc (EAsiCAttr);
  2035. // Get data descriptor
  2036. //
  2037. virtual EAsiDataType Type (void) const;
  2038. virtual uint Length (void) const;
  2039. virtual uint ReturnLength (void) const;
  2040. uint ByteSize (void) const;
  2041. const CAsiUcStr & CollName (void) const;
  2042. const CAsiUcStr & CharSetName (void) const;
  2043. AsiUcIdCLT CollIdent (void) const;
  2044. AsiUcIdCCT CharSetIdent (void) const;
  2045. EAsiCAttr Coercibility (void) const;
  2046. // is_ functions
  2047. //
  2048. virtual EAsiBoolean is_character (void) const;
  2049. virtual EAsiBoolean is_comparable (const CAsiData *) const;
  2050. virtual EAsiBoolean is_storable (const CAsiData *) const;
  2051. virtual EAsiBoolean is_castable (const CAsiData *) const;
  2052. EAsiBoolean is_national (void) const;
  2053. virtual CAsiData * checkCat (const CAsiData *) const;
  2054. virtual CAsiData * checkSet (const CAsiData *) const;
  2055. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  2056. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  2057. // Store Data value
  2058. //
  2059. virtual EAsiBoolean storeValue (real);
  2060. virtual EAsiBoolean storeValue (integer);
  2061. virtual EAsiBoolean storeValue (smallint);
  2062. virtual EAsiBoolean storeValue (char *, uint);
  2063. EAsiBoolean storeValue (char *, uint, AsiUcIdCCT);
  2064. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  2065. virtual EAsiBoolean storeValue (const CAsiData &);
  2066. virtual EAsiBoolean storeValue (const AsiUcStr);
  2067. EAsiBoolean storeValue (GUID *);
  2068. virtual EAsiBoolean storeValue (char *, uint, uint *); // Binary Buffer
  2069. // Get data value
  2070. //
  2071. const CAsiUcStr & charValue (void) const; // Reference to string
  2072. virtual EAsiBoolean getValue (real *) const;
  2073. virtual EAsiBoolean getValue (integer *) const;
  2074. virtual EAsiBoolean getValue (smallint *) const;
  2075. virtual EAsiBoolean getValue (char *, uint) const;
  2076. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  2077. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  2078. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  2079. virtual EAsiBoolean getValue (CAsiData &) const;
  2080. EAsiBoolean getValue (GUID *) const;
  2081. virtual DBCOLUMNINFO * MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  2082. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  2083. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  2084. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  2085. // Runtime class iteraction functions
  2086. //
  2087. virtual unsigned long packSize (void) const;
  2088. virtual unsigned long packTo (CAsiObjPack *) const;
  2089. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  2090. virtual unsigned long packValueSize (void) const;
  2091. virtual unsigned long packValueTo (CAsiObjPack *) const;
  2092. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  2093. // Duplicate itself
  2094. //
  2095. virtual CAsiObject * duplicate (void) const;
  2096. // Nullify all members
  2097. virtual void Clear (void);
  2098. // Like predicate and string functions
  2099. //
  2100. EAsiBoolean Like (const CAsiChar &, const CAsiChar &) const;
  2101. CAsiChar Substring (uint) const;
  2102. CAsiChar Substring (uint, uint) const;
  2103. CAsiChar Upper (void) const;
  2104. CAsiChar Lower (void) const;
  2105. CAsiChar Trim (EAsiTrimSpec, const CAsiChar &) const;
  2106. CAsiNumeric Position (const CAsiChar &) const;
  2107. // Operators
  2108. //
  2109. // Assignment
  2110. CAsiChar & operator= (const CAsiChar &);
  2111. CAsiChar & operator= (const CAsiUcStr &);
  2112. // Cancatenation
  2113. CAsiChar operator+ (const CAsiChar &) const;
  2114. CAsiChar operator+ (const CAsiUcStr &) const;
  2115. // Comparision
  2116. int operator> (const CAsiChar &) const;
  2117. int operator> (const CAsiUcStr &) const;
  2118. friend int DLLScope operator> (const CAsiUcStr &, const CAsiChar &);
  2119. int operator>= (const CAsiChar &) const;
  2120. int operator>= (const CAsiUcStr &) const;
  2121. friend int DLLScope operator>= (const CAsiUcStr &, const CAsiChar &);
  2122. int operator== (const CAsiChar &) const;
  2123. int operator== (const CAsiUcStr &) const;
  2124. friend int DLLScope operator== (const CAsiUcStr &, const CAsiChar &);
  2125. int operator<= (const CAsiChar &) const;
  2126. int operator<= (const CAsiUcStr &) const;
  2127. friend int DLLScope operator<= (const CAsiUcStr &, const CAsiChar &);
  2128. int operator< (const CAsiChar &) const;
  2129. int operator< (const CAsiUcStr &) const;
  2130. friend int DLLScope operator< (const CAsiUcStr &, const CAsiChar &);
  2131. int operator!= (const CAsiChar &) const;
  2132. int operator!= (const CAsiUcStr &) const;
  2133. friend int DLLScope operator!= (const CAsiUcStr &, const CAsiChar &);
  2134. private:
  2135. EAsiBoolean isCompColSet(const AsiUcIdCLT, EAsiCAttr) const;
  2136. AsiUcIdCLT CompColSet(const AsiUcIdCLT, EAsiCAttr) const;
  2137. EAsiBoolean isDyadicOpColSet(const AsiUcIdCLT, EAsiCAttr) const;
  2138. AsiUcIdCLT DyadicOpColSet(const AsiUcIdCLT, EAsiCAttr *, EAsiCAttr) const;
  2139. private:
  2140. uint maxlength; // Length of character data
  2141. uint retlength; // Length of the stored data
  2142. CAsiUcStr chvalue; // Value
  2143. short mod; // Type modifiers
  2144. AsiUcIdCCT CharSetId; // Character set identifier
  2145. CAsiUcStr CharSet; // Character set name
  2146. AsiUcIdCLT ColId; // Collation identifier
  2147. CAsiUcStr CName; // Collation name
  2148. EAsiCAttr coercibility; // Coercibility attribute
  2149. };
  2150. ////////////////////////////////////////////////
  2151. //
  2152. //
  2153. class CAsiBinary: public CAsiData
  2154. //
  2155. // BIT and BIT VARYING
  2156. //
  2157. // This class introduces functionality of the BIT and BIT VARYING SQL
  2158. // data type
  2159. // It defines assignment and binary concatenation operations which are
  2160. // associated with = and + operators.
  2161. //
  2162. //
  2163. {
  2164. friend class CAsiTempTable;
  2165. public:
  2166. // Construction/Destruction
  2167. //
  2168. CAsiBinary ();
  2169. CAsiBinary (uint);
  2170. CAsiBinary (const CAsiBinary &);
  2171. virtual ~CAsiBinary ();
  2172. // Set BIT VARYING
  2173. void setVarying (void);
  2174. // Get data descriptor
  2175. //
  2176. virtual EAsiDataType Type (void) const;
  2177. virtual uint Length (void) const; // Binary length
  2178. virtual uint ReturnLength (void) const;
  2179. // is_ functions
  2180. //
  2181. virtual EAsiBoolean is_binary (void) const;
  2182. virtual EAsiBoolean is_comparable (const CAsiData *) const;
  2183. virtual EAsiBoolean is_storable (const CAsiData *) const;
  2184. virtual EAsiBoolean is_castable (const CAsiData *) const;
  2185. virtual CAsiData * checkCat (const CAsiData *) const;
  2186. virtual CAsiData * checkSet (const CAsiData *) const;
  2187. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  2188. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  2189. // Store Data value
  2190. //
  2191. EAsiBoolean storeHexValue (char *, uint, uint *);
  2192. EAsiBoolean storeHexValue (const CAsiUcStr &);
  2193. EAsiBoolean storeBinValue (char *, uint, uint *);
  2194. EAsiBoolean storeBinValue (const CAsiUcStr &);
  2195. virtual EAsiBoolean storeValue (char *, uint);
  2196. virtual EAsiBoolean storeValue (char *, uint, uint *);
  2197. virtual EAsiBoolean storeValue (const CAsiData &);
  2198. // ****
  2199. virtual EAsiBoolean storeValue (real); // Real
  2200. virtual EAsiBoolean storeValue (integer); // Integer
  2201. virtual EAsiBoolean storeValue (smallint); // Smallint
  2202. virtual EAsiBoolean storeValue (const CAsiUcStr &); // Unicode string
  2203. virtual EAsiBoolean storeValue (const AsiUcStr); // Store AsiUcStr
  2204. // Get data value
  2205. //
  2206. EAsiBoolean getHexValue (char *, uint, uint *) const;
  2207. EAsiBoolean getHexValue (CAsiUcStr *) const;
  2208. EAsiBoolean getBinValue (char *, uint, uint *) const;
  2209. EAsiBoolean getBinValue (CAsiUcStr *) const;
  2210. virtual EAsiBoolean getValue (char *, uint) const;
  2211. virtual EAsiBoolean getValue (char *, uint, uint *) const;
  2212. // *****
  2213. virtual EAsiBoolean getValue (real *) const; // Real
  2214. virtual EAsiBoolean getValue (integer *) const; // Integer
  2215. virtual EAsiBoolean getValue (smallint *) const; // Smallint
  2216. virtual EAsiBoolean getValue (CAsiUcStr *) const; // Unicode string
  2217. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  2218. virtual EAsiBoolean getValue (CAsiData &) const;
  2219. virtual DBCOLUMNINFO *MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  2220. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  2221. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  2222. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  2223. // Runtime class iteraction functions
  2224. //
  2225. virtual unsigned long packSize (void) const;
  2226. virtual unsigned long packTo (CAsiObjPack *) const;
  2227. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  2228. virtual unsigned long packValueSize (void) const;
  2229. virtual unsigned long packValueTo (CAsiObjPack *) const;
  2230. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  2231. // Duplicate itself
  2232. //
  2233. virtual CAsiObject *duplicate(void) const;
  2234. // Nullify all members
  2235. virtual void Clear (void);
  2236. // Utility
  2237. //
  2238. CAsiBinary Substring(uint);
  2239. CAsiBinary Substring(uint,uint);
  2240. // Operators
  2241. //
  2242. // Assignment
  2243. CAsiBinary &operator= (const CAsiBinary &);
  2244. // Cancatenation
  2245. CAsiBinary operator+ (const CAsiBinary &) const;
  2246. // Comparision
  2247. int operator> (const CAsiBinary &) const;
  2248. int operator>= (const CAsiBinary &) const;
  2249. int operator== (const CAsiBinary &) const;
  2250. int operator<= (const CAsiBinary &) const;
  2251. int operator< (const CAsiBinary &) const;
  2252. int operator!= (const CAsiBinary &) const;
  2253. private:
  2254. uint blength; // Length of binary data
  2255. uint alength; // Actual length
  2256. uint buflen; // Allocated length
  2257. uchar * value; // Value
  2258. short mod; // Modifier
  2259. };
  2260. /////////////////////////////////////////////////////////////////////////////
  2261. class CAsiIQualifier : public CAsiData
  2262. //
  2263. // Interval Qualifier
  2264. //
  2265. {
  2266. friend class CAsiInterval;
  2267. friend class CAsiDatetime;
  2268. public:
  2269. // Construction/Destruction
  2270. //
  2271. CAsiIQualifier (void);
  2272. CAsiIQualifier (EAsiIType);
  2273. CAsiIQualifier (EAsiIType, uint);
  2274. CAsiIQualifier (EAsiIType, uint, uint);
  2275. CAsiIQualifier (const CAsiIQualifier &);
  2276. virtual ~CAsiIQualifier (void);
  2277. // Set Interval qualifier type and characteristics
  2278. //
  2279. virtual EAsiBoolean setIType (EAsiIType); // Set interval type
  2280. void setLeadFieldPrec (uint); // Set Leading field precision
  2281. void setFracSecPrec (uint); // Set Fractional sec prec
  2282. // Get access to interval characteristics
  2283. //
  2284. virtual EAsiDataType Type (void) const;
  2285. virtual EAsiIType IntervalType (void) const;
  2286. virtual uint LeadFieldPrec (void) const;
  2287. virtual uint FracSecPrec (void) const;
  2288. virtual uint ReturnLength (void) const;
  2289. // Return interval type
  2290. virtual EAsiBoolean is_interval (void) const;
  2291. virtual EAsiBoolean is_yminterval (void) const;
  2292. virtual EAsiBoolean is_dtinterval (void) const;
  2293. virtual EAsiBoolean is_storable (const CAsiData *) const;
  2294. virtual EAsiBoolean is_comparable (const CAsiData *) const;
  2295. EAsiBoolean is_moreaccurate (const CAsiIQualifier *) const;
  2296. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  2297. private:
  2298. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  2299. public:
  2300. // Assignment operator
  2301. CAsiIQualifier &operator= (const CAsiIQualifier &);
  2302. // Runtime class iteraction functions
  2303. //
  2304. // Duplicate itself
  2305. //
  2306. virtual CAsiObject *duplicate(void) const;
  2307. protected:
  2308. EAsiIType itype; // Interval type
  2309. uint lfp; // Leading field precision
  2310. uint fsp; // Fractional second precision
  2311. };
  2312. ////////////////////////////////////////////////
  2313. //
  2314. //
  2315. class CAsiInterval : public CAsiIQualifier
  2316. //
  2317. // INTERVAL
  2318. //
  2319. // This is a base class for datetime intervals. The basic functionality
  2320. // for class includes setting and retrieving interval sign.
  2321. {
  2322. friend class CAsiDate;
  2323. friend class CAsiTime;
  2324. friend class CAsiTimeStamp;
  2325. public:
  2326. // Constructors/Destructors
  2327. //
  2328. CAsiInterval (void);
  2329. virtual ~CAsiInterval (void);
  2330. virtual EAsiBoolean SQLType (CAsiUcStr *) const;
  2331. virtual CAsiData * checkAdd (const CAsiData *) const;
  2332. virtual CAsiData * checkSub (const CAsiData *) const;
  2333. virtual CAsiData * checkMul (const CAsiData *) const;
  2334. virtual CAsiData * checkDiv (const CAsiData *) const;
  2335. virtual CAsiData * checkSet (const CAsiData *) const;
  2336. // Set/get interval sign
  2337. //
  2338. void setSign (EAsiBoolean);
  2339. EAsiBoolean Sign (void) const;
  2340. protected:
  2341. EAsiBoolean sign; // Interval sign
  2342. };
  2343. ////////////////////////////////////////////////
  2344. //
  2345. //
  2346. class CAsiYM : public CAsiInterval
  2347. //
  2348. // Year Month Intervals
  2349. //
  2350. // Constructors/Destructor
  2351. //
  2352. // CAsiYM ()
  2353. // CAsiYM (
  2354. // EAsiIType itype) // Year Month Interval type
  2355. // CAsiYM (
  2356. // EAsiIType itype, // Year Month Interval type
  2357. // uint lprec // Leading fields precision
  2358. // )
  2359. //
  2360. // Different forms of constructor allow to specify interval type, and leading
  2361. // field precision
  2362. // Interval type shall be a valid Year Month interval type.
  2363. // If invalid interval type was specified, interval will be set to kAsiIUnknown.
  2364. //
  2365. // EAsiBoolean set (
  2366. // EAsiBoolean sign, // Interval sign kAsiFalse (+), kAsiTrue (-)
  2367. // uint years, // Years
  2368. // uint months) // Months
  2369. //
  2370. // EAsiBoolean setYears (
  2371. // uint years) // Years
  2372. //
  2373. // EAsiBoolean setMonths (
  2374. // uint months) // Months
  2375. //
  2376. // Interval fields set functions allow to set interval. They return
  2377. // boolean value, because they must validate input.
  2378. //
  2379. //
  2380. // Get interval fields
  2381. //
  2382. // void get (
  2383. // EAsiBoolean *sign, // Interval sign kAsiFalse (+), kAsiTrue (-)
  2384. // uint *years, // Years
  2385. // uint *months) const // Months
  2386. //
  2387. // EAsiBoolean getYears (
  2388. // uint *years) const // Years
  2389. //
  2390. // EAsiBoolean getMonths (
  2391. // uint *months) const // Months
  2392. //
  2393. // The functions above retrieve interval fields. Return kAsiTrue if
  2394. // specified interval field present in interval and kAsiFalse otherwise.
  2395. //
  2396. //
  2397. // Operators
  2398. //
  2399. // Operators overload interval arithmetics operations like +, -, /, *, and
  2400. // unary minus. Besides them all boolean operators are redefined.
  2401. //
  2402. //
  2403. {
  2404. friend class CAsiDate;
  2405. friend class CAsiTime;
  2406. friend class CAsiTimeStamp;
  2407. friend class CAsiTempTable;
  2408. public:
  2409. // Construction/Destruction
  2410. //
  2411. CAsiYM (void);
  2412. CAsiYM (EAsiIType);
  2413. CAsiYM (EAsiIType, uint);
  2414. CAsiYM (const CAsiYM &);
  2415. virtual ~CAsiYM (void);
  2416. virtual EAsiBoolean setIType (EAsiIType); // Set interval type
  2417. virtual EAsiBoolean is_castable (const CAsiData *) const;
  2418. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  2419. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  2420. // Store Data value
  2421. //
  2422. virtual EAsiBoolean storeValue (integer);
  2423. virtual EAsiBoolean storeValue (smallint);
  2424. virtual EAsiBoolean storeValue (char *, uint);
  2425. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  2426. virtual EAsiBoolean storeValue (const CAsiData &);
  2427. // ******
  2428. virtual EAsiBoolean storeValue (real); // Real
  2429. virtual EAsiBoolean storeValue (char *, uint, uint *); // Binary Buffer
  2430. virtual EAsiBoolean storeValue (const AsiUcStr); // Store AsiUcStr
  2431. // Set data value
  2432. //
  2433. EAsiBoolean set (ASI_IYEAR *);
  2434. EAsiBoolean set (ASI_IYEARTOMONTH *);
  2435. EAsiBoolean set (ASI_IMONTH *);
  2436. EAsiBoolean set (EAsiBoolean, uint, uint);
  2437. EAsiBoolean setYears (uint);
  2438. EAsiBoolean setMonths (uint);
  2439. // Get data value in the Unicode character string format
  2440. //
  2441. virtual EAsiBoolean getValue (integer *) const;
  2442. virtual EAsiBoolean getValue (smallint *) const;
  2443. virtual EAsiBoolean getValue (char *, uint) const;
  2444. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  2445. // ******
  2446. virtual EAsiBoolean getValue (real *) const; // Real
  2447. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  2448. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  2449. virtual EAsiBoolean getValue (CAsiData &) const;
  2450. virtual DBCOLUMNINFO *MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  2451. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  2452. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  2453. EAsiBoolean get (ASI_IYEAR *) const;
  2454. EAsiBoolean get (ASI_IYEARTOMONTH *) const;
  2455. EAsiBoolean get (ASI_IMONTH *) const;
  2456. EAsiBoolean get (EAsiBoolean *, uint *, uint *) const;
  2457. EAsiBoolean getYears (uint *) const;
  2458. EAsiBoolean getMonths (uint *) const;
  2459. // Runtime class iteraction functions
  2460. //
  2461. virtual unsigned long packSize (void) const;
  2462. virtual unsigned long packTo (CAsiObjPack *) const;
  2463. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  2464. virtual unsigned long packValueSize (void) const;
  2465. virtual unsigned long packValueTo (CAsiObjPack *) const;
  2466. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  2467. // Duplicate itself
  2468. //
  2469. virtual CAsiObject *duplicate (void) const;
  2470. // Operators
  2471. CAsiYM &operator= (const CAsiYM &);
  2472. CAsiYM &operator= (const CAsiSmallInt &);
  2473. CAsiYM &operator= (const CAsiInt &);
  2474. CAsiYM &operator= (const CAsiNumeric &);
  2475. CAsiYM &operator= (const CAsiDecimal &);
  2476. CAsiYM &operator= (integer);
  2477. CAsiYM operator+ (const CAsiYM &) const;
  2478. friend CAsiDate DLLScope operator+ (const CAsiYM &, const CAsiDate &);
  2479. CAsiYM operator- (const CAsiYM &) const;
  2480. CAsiYM operator* (const CAsiSmallInt &) const;
  2481. CAsiYM operator* (const CAsiInt &) const;
  2482. CAsiYM operator* (const CAsiNumeric &) const;
  2483. CAsiYM operator* (const CAsiDecimal &) const;
  2484. CAsiYM operator* (integer) const;
  2485. friend CAsiYM DLLScope operator* (const CAsiSmallInt &,const CAsiYM &);
  2486. friend CAsiYM DLLScope operator* (const CAsiInt &, const CAsiYM &);
  2487. friend CAsiYM DLLScope operator* (const CAsiNumeric &, const CAsiYM &);
  2488. friend CAsiYM DLLScope operator* (const CAsiDecimal &, const CAsiYM &);
  2489. friend CAsiYM DLLScope operator* (integer, const CAsiYM &);
  2490. CAsiYM operator/ (const CAsiSmallInt &) const;
  2491. CAsiYM operator/ (const CAsiInt &) const;
  2492. CAsiYM operator/ (const CAsiNumeric &) const;
  2493. CAsiYM operator/ (const CAsiDecimal &) const;
  2494. CAsiYM operator/ (integer) const;
  2495. CAsiYM &operator- (void);
  2496. // Comparision predicates
  2497. //
  2498. int operator> (const CAsiYM &) const;
  2499. int operator>= (const CAsiYM &) const;
  2500. int operator== (const CAsiYM &) const;
  2501. int operator<= (const CAsiYM &) const;
  2502. int operator< (const CAsiYM &) const;
  2503. int operator!= (const CAsiYM &) const;
  2504. private:
  2505. char * getYMString (char *, size_t) const;
  2506. protected:
  2507. ulong ivalue; // Interval value in months
  2508. };
  2509. ////////////////////////////////////////////////
  2510. //
  2511. //
  2512. class CAsiDT : public CAsiInterval
  2513. //
  2514. // Day Time Intervals
  2515. //
  2516. // This class introduces functionality of the Day Time intervals.
  2517. //
  2518. // MEMBER FUNCTIONS
  2519. // ----------------
  2520. // Constructors/Destructor
  2521. //
  2522. // CAsiDT ()
  2523. // CAsiDT (
  2524. // EAsiIType itype // Interval type
  2525. // )
  2526. // CAsiDT (
  2527. // EAsiIType itype, // Interval type
  2528. // uint lprec // Leading fields precision
  2529. // )
  2530. // CAsiDT (
  2531. // EAsiIType itype // Interval type
  2532. // uint lprec, // Leading fields precision
  2533. // uint fprec // Fractional second precision
  2534. // )
  2535. // Constructors allow to set interval type, leading field precision and fractional
  2536. // seconds precision
  2537. // Interval type shall specify valid day time interval type.
  2538. // If invalid interval type was specified, interval will be set to kAsiIUnknown.
  2539. //
  2540. //
  2541. // EAsiBoolean set (
  2542. // EAsiBoolean sign, // Interval sign kAsiFalse (+), kAsiTrue (-)
  2543. // uint days, // Days
  2544. // uint hours, // Hours
  2545. // uint minutes, // Minutes
  2546. // double seconds) // Seconds
  2547. //
  2548. // EAsiBoolean setDays (
  2549. // uint days) // Days
  2550. //
  2551. // EAsiBoolean setHours (
  2552. // uint hours) // Hours
  2553. //
  2554. // EAsiBoolean setMinutes (
  2555. // uint minutes) // Minutes
  2556. //
  2557. // EAsiBoolean getSeconds (
  2558. // double seconds) // Seconds
  2559. //
  2560. // Interval fields set functions allow to set interval. They return
  2561. // boolean value, because they must validate input.
  2562. //
  2563. //
  2564. // Get interval fields
  2565. //
  2566. // void get (
  2567. // EAsiBoolean *sign, // Interval sign kAsiFalse (+), kAsiTrue (-)
  2568. // uint *days, // Days
  2569. // uint *hours, // Hours
  2570. // uint *minutes, // Minutes
  2571. // double *seconds) const // Seconds with fraction
  2572. //
  2573. // EAsiBoolean getDays (
  2574. // uint *days // Days
  2575. // ) const
  2576. //
  2577. // EAsiBoolean getHours (
  2578. // uint *hours // Hours
  2579. // ) const;
  2580. //
  2581. // EAsiBoolean getMinutes (
  2582. // uint *minutes // Minutes
  2583. // ) const;
  2584. //
  2585. // EAsiBoolean getSeconds (
  2586. // double *seconds) const; // Seconds with fraction
  2587. //
  2588. // The functions above retrieve interval fields
  2589. //
  2590. //
  2591. // Operators
  2592. //
  2593. // Operators overload interval arithmetics operations like +, -, /, *, and
  2594. // unary minus. Besides them all boolean operators are redefined.
  2595. //
  2596. //
  2597. {
  2598. // Friend classes
  2599. friend class CAsiDate;
  2600. friend class CAsiTime;
  2601. friend class CAsiTimeStamp;
  2602. friend class CAsiTempTable;
  2603. private:
  2604. // private helpers
  2605. void ChkMul (real);
  2606. void ChkDiv (real);
  2607. int cmpDTI (const CAsiDT&) const;
  2608. EAsiBoolean ChkSet (double);
  2609. void ChkSet2 (double);
  2610. double LocalToUTC (double) const;
  2611. double UTCToLocal (double) const;
  2612. public:
  2613. // Constructors/Destructors
  2614. //
  2615. CAsiDT (void);
  2616. CAsiDT (EAsiIType);
  2617. CAsiDT (EAsiIType, uint);
  2618. CAsiDT (EAsiIType, uint, uint);
  2619. CAsiDT (const CAsiDT &);
  2620. virtual ~CAsiDT (void);
  2621. virtual EAsiBoolean setIType (EAsiIType); // Set interval type
  2622. virtual EAsiBoolean is_castable (const CAsiData *) const;
  2623. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  2624. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  2625. // Store Data value
  2626. //
  2627. virtual EAsiBoolean storeValue (integer);
  2628. virtual EAsiBoolean storeValue (smallint);
  2629. virtual EAsiBoolean storeValue (char *, uint);
  2630. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  2631. virtual EAsiBoolean storeValue (const CAsiData &);
  2632. // ******
  2633. virtual EAsiBoolean storeValue (real); // Real
  2634. virtual EAsiBoolean storeValue (char *, uint, uint *); // Binary Buffer
  2635. virtual EAsiBoolean storeValue (const AsiUcStr); // Store AsiUcStr
  2636. // Set data value
  2637. //
  2638. EAsiBoolean set (ASI_IDAY *);
  2639. EAsiBoolean set (ASI_IHOUR *);
  2640. EAsiBoolean set (ASI_IMINUTE *);
  2641. EAsiBoolean set (ASI_ISECOND *);
  2642. EAsiBoolean set (ASI_IDAYTOHOUR *);
  2643. EAsiBoolean set (ASI_IDAYTOMINUTE *);
  2644. EAsiBoolean set (ASI_IDAYTOSECOND *);
  2645. EAsiBoolean set (ASI_IHOURTOMINUTE *);
  2646. EAsiBoolean set (ASI_IHOURTOSECOND *);
  2647. EAsiBoolean set (ASI_IMINUTETOSECOND *);
  2648. EAsiBoolean set (EAsiBoolean, uint, uint, uint, double);
  2649. EAsiBoolean setDays (uint);
  2650. EAsiBoolean setHours (uint);
  2651. EAsiBoolean setMinutes (uint);
  2652. EAsiBoolean setSeconds (double);
  2653. // Get data value in the Unicode character string format
  2654. //
  2655. virtual EAsiBoolean getValue (integer *) const;
  2656. virtual EAsiBoolean getValue (smallint *) const;
  2657. virtual EAsiBoolean getValue (char *, uint) const;
  2658. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  2659. // ******
  2660. virtual EAsiBoolean getValue (real *) const; // Real
  2661. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  2662. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  2663. virtual EAsiBoolean getValue (CAsiData &) const;
  2664. virtual DBCOLUMNINFO *MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  2665. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  2666. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  2667. EAsiBoolean get (ASI_IDAY *) const;
  2668. EAsiBoolean get (ASI_IHOUR *) const;
  2669. EAsiBoolean get (ASI_IMINUTE *) const;
  2670. EAsiBoolean get (ASI_ISECOND *) const;
  2671. EAsiBoolean get (ASI_IDAYTOHOUR *) const;
  2672. EAsiBoolean get (ASI_IDAYTOMINUTE *) const;
  2673. EAsiBoolean get (ASI_IDAYTOSECOND *) const;
  2674. EAsiBoolean get (ASI_IHOURTOMINUTE *) const;
  2675. EAsiBoolean get (ASI_IHOURTOSECOND *) const;
  2676. EAsiBoolean get (ASI_IMINUTETOSECOND *) const;
  2677. EAsiBoolean get (EAsiBoolean *, uint *, uint *, uint *,
  2678. double *) const;
  2679. EAsiBoolean getDays (uint *) const;
  2680. EAsiBoolean getHours (uint *) const;
  2681. EAsiBoolean getMinutes (uint *) const;
  2682. EAsiBoolean getSeconds (double *) const;
  2683. // Runtime class iteraction functions
  2684. //
  2685. virtual unsigned long packSize (void) const;
  2686. virtual unsigned long packTo (CAsiObjPack *) const;
  2687. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  2688. virtual unsigned long packValueSize (void) const;
  2689. virtual unsigned long packValueTo (CAsiObjPack *) const;
  2690. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  2691. // Duplicate itself
  2692. //
  2693. virtual CAsiObject *duplicate (void) const;
  2694. // Operators
  2695. CAsiDT &operator= (const CAsiDT &);
  2696. CAsiDT &operator= (const CAsiSmallInt &);
  2697. CAsiDT &operator= (const CAsiInt &);
  2698. CAsiDT &operator= (const CAsiNumeric &);
  2699. CAsiDT &operator= (const CAsiDecimal &);
  2700. CAsiDT &operator= (integer);
  2701. CAsiDT operator+ (const CAsiDT &) const;
  2702. CAsiDT operator- (const CAsiDT &) const;
  2703. CAsiDT operator* (const CAsiSmallInt &) const;
  2704. CAsiDT operator* (const CAsiInt &) const;
  2705. CAsiDT operator* (const CAsiNumeric &) const;
  2706. CAsiDT operator* (const CAsiDecimal &) const;
  2707. CAsiDT operator* (integer) const;
  2708. friend CAsiDT DLLScope operator* (const CAsiSmallInt &,const CAsiDT &);
  2709. friend CAsiDT DLLScope operator* (const CAsiInt &, const CAsiDT &);
  2710. friend CAsiDT DLLScope operator* (const CAsiNumeric &, const CAsiDT &);
  2711. friend CAsiDT DLLScope operator* (const CAsiDecimal &, const CAsiDT &);
  2712. friend CAsiDT DLLScope operator* (integer, const CAsiDT &);
  2713. CAsiDT operator/ (const CAsiSmallInt &) const;
  2714. CAsiDT operator/ (const CAsiInt &) const;
  2715. CAsiDT operator/ (const CAsiNumeric &) const;
  2716. CAsiDT operator/ (const CAsiDecimal &) const;
  2717. CAsiDT operator/ (integer) const;
  2718. CAsiDT &operator- (void);
  2719. // Comparision predicates
  2720. //
  2721. int operator> (const CAsiDT &) const;
  2722. int operator>= (const CAsiDT &) const;
  2723. int operator== (const CAsiDT &) const;
  2724. int operator<= (const CAsiDT &) const;
  2725. int operator< (const CAsiDT &) const;
  2726. int operator!= (const CAsiDT &) const;
  2727. private:
  2728. char * getDTString (char * , size_t) const;
  2729. protected:
  2730. double ivalue; // Interval value in seconds with fraction
  2731. };
  2732. ////////////////////////////////////////////////
  2733. //
  2734. //
  2735. class CAsiDatetime : public CAsiData
  2736. //
  2737. // Datetime
  2738. //
  2739. {
  2740. public:
  2741. // Construction/Destruction
  2742. //
  2743. CAsiDatetime ();
  2744. virtual ~CAsiDatetime ();
  2745. // Get data descriptor
  2746. //
  2747. virtual EAsiDataType Type (void) const;
  2748. // is_ functions
  2749. //
  2750. virtual EAsiBoolean is_datetime (void) const;
  2751. virtual EAsiBoolean is_comparable (const CAsiData *) const;
  2752. virtual CAsiData * checkAdd (const CAsiData *) const;
  2753. virtual CAsiData * checkSub (const CAsiData *) const;
  2754. virtual CAsiData * checkSet (const CAsiData *) const;
  2755. // Get datetime field value
  2756. //
  2757. virtual ushort Year (void) const = 0;
  2758. virtual ushort Month (void) const = 0;
  2759. virtual ushort Day (void) const = 0;
  2760. virtual ushort Hour (void) const = 0;
  2761. virtual ushort Minute (void) const = 0;
  2762. virtual double Second (void) const = 0;
  2763. protected:
  2764. };
  2765. ////////////////////////////////////////////////
  2766. //
  2767. //
  2768. class CAsiDate: public CAsiDatetime
  2769. //
  2770. // DATE
  2771. //
  2772. {
  2773. friend class CAsiTimeStamp;
  2774. friend class CAsiTempTable;
  2775. public:
  2776. // Construction/Destruction
  2777. //
  2778. CAsiDate ();
  2779. CAsiDate (const CAsiDate &);
  2780. virtual ~CAsiDate (void);
  2781. // Get data descriptor
  2782. //
  2783. virtual EAsiDTType DateTimeType (void) const;
  2784. virtual uint ReturnLength (void) const;
  2785. // Check storable
  2786. virtual EAsiBoolean is_storable (const CAsiData *) const;
  2787. virtual EAsiBoolean is_castable (const CAsiData *) const;
  2788. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  2789. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  2790. // Store Data value
  2791. //
  2792. virtual EAsiBoolean storeValue (char *, uint);
  2793. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  2794. virtual EAsiBoolean storeValue (const CAsiData &);
  2795. virtual EAsiBoolean storeValue (const DBDATE *);
  2796. virtual EAsiBoolean storeValue (DATE);
  2797. // *******
  2798. // virtual EAsiBoolean storeValue (real); // Real == DATE
  2799. virtual EAsiBoolean storeValue (integer); // Integer
  2800. virtual EAsiBoolean storeValue (smallint); // Smallint
  2801. virtual EAsiBoolean storeValue (char *, uint, uint *); // Binary Buffer
  2802. virtual EAsiBoolean storeValue (const AsiUcStr); // Store AsiUcStr
  2803. // Set date fields
  2804. //
  2805. EAsiBoolean set (ASI_DTDATE *);
  2806. EAsiBoolean set (const DBDATE *);
  2807. EAsiBoolean set (ushort, ushort, ushort);
  2808. EAsiBoolean setYear (ushort);
  2809. EAsiBoolean setMonth (ushort);
  2810. EAsiBoolean setDay (ushort);
  2811. // Get data value
  2812. //
  2813. EAsiBoolean get (ASI_DTDATE *) const;
  2814. EAsiBoolean get (DBDATE *) const;
  2815. virtual EAsiBoolean getValue (char *, uint) const;
  2816. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  2817. virtual EAsiBoolean getValue (DBDATE *) const; // OLE DB date
  2818. virtual EAsiBoolean getValue (DATE *) const; // OLE DB "double" date
  2819. // *****
  2820. // virtual EAsiBoolean getValue (real *) const; // Real == DATE
  2821. virtual EAsiBoolean getValue (integer *) const; // Integer
  2822. virtual EAsiBoolean getValue (smallint *) const; // Smallint
  2823. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  2824. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  2825. virtual EAsiBoolean getValue (CAsiData &) const;
  2826. virtual DBCOLUMNINFO *MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  2827. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  2828. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  2829. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  2830. virtual ushort Year (void) const;
  2831. virtual ushort Month (void) const;
  2832. virtual ushort Day (void) const;
  2833. virtual ushort Hour (void) const;
  2834. virtual ushort Minute (void) const;
  2835. virtual double Second (void) const;
  2836. // Runtime class iteraction functions
  2837. //
  2838. virtual unsigned long packSize (void) const;
  2839. virtual unsigned long packTo (CAsiObjPack *) const;
  2840. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  2841. virtual unsigned long packValueSize (void) const;
  2842. virtual unsigned long packValueTo (CAsiObjPack *) const;
  2843. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  2844. // Duplicate itself
  2845. //
  2846. virtual CAsiObject *duplicate (void) const;
  2847. // Operators
  2848. //
  2849. // Assignments
  2850. CAsiDate &operator= (const CAsiDate &);
  2851. // Arithmatics
  2852. CAsiDate operator+ (const CAsiYM &) const;
  2853. CAsiDate operator+ (const CAsiDT &) const;
  2854. friend CAsiDate DLLScope operator+ (const CAsiYM &, const CAsiDate &);
  2855. friend CAsiDate DLLScope operator+ (const CAsiDT &, const CAsiDate &);
  2856. CAsiDate operator- (const CAsiYM &) const;
  2857. CAsiDate operator- (const CAsiDT &) const;
  2858. // Dates difference , result corresponds with EAsiType value
  2859. CAsiYM YMDiff (const CAsiDate &, const CAsiYM &) const;
  2860. CAsiDT DTDiff (const CAsiDate &, const CAsiDT &) const;
  2861. // Comparision
  2862. int operator> (const CAsiDate &) const;
  2863. int operator>= (const CAsiDate &) const;
  2864. int operator== (const CAsiDate &) const;
  2865. int operator<= (const CAsiDate &) const;
  2866. int operator< (const CAsiDate &) const;
  2867. int operator!= (const CAsiDate &) const;
  2868. protected:
  2869. ulong month; // Months since 00-00-00
  2870. ushort day; // Day of the month
  2871. };
  2872. ///////////////////////////////////////////
  2873. //
  2874. //
  2875. class CAsiTime : public CAsiDatetime
  2876. //
  2877. // TIME and TIME WITH TIME ZONE
  2878. //
  2879. {
  2880. friend class CAsiTimeStamp;
  2881. friend class CAsiTempTable;
  2882. public:
  2883. // Construction/Destruction
  2884. //
  2885. CAsiTime (void);
  2886. CAsiTime (const CAsiDT&);
  2887. CAsiTime (uint);
  2888. CAsiTime (uint, const CAsiDT&);
  2889. CAsiTime (const CAsiTime &);
  2890. virtual ~CAsiTime (void);
  2891. void setWithTimeZone (EAsiBoolean f = kAsiTrue );
  2892. // Get data descriptor
  2893. //
  2894. virtual EAsiDTType DateTimeType (void) const;
  2895. virtual uint TimePrec (void) const;
  2896. virtual uint ReturnLength (void) const;
  2897. // Check storable
  2898. virtual EAsiBoolean is_storable (const CAsiData *) const;
  2899. virtual EAsiBoolean is_castable (const CAsiData *) const;
  2900. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  2901. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  2902. // Store Data value
  2903. //
  2904. virtual EAsiBoolean storeValue (char *, uint);
  2905. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  2906. virtual EAsiBoolean storeValue (const CAsiData &);
  2907. virtual EAsiBoolean storeValue (const DBTIME *);
  2908. // *******
  2909. virtual EAsiBoolean storeValue (real); // Real
  2910. virtual EAsiBoolean storeValue (integer); // Integer
  2911. virtual EAsiBoolean storeValue (smallint); // Smallint
  2912. virtual EAsiBoolean storeValue (char *, uint, uint *); // Binary Buffer
  2913. virtual EAsiBoolean storeValue (const AsiUcStr); // Store AsiUcStr
  2914. // Set date value
  2915. //
  2916. EAsiBoolean set (ASI_DTTIME *);
  2917. EAsiBoolean set (const DBTIME *);
  2918. EAsiBoolean set (ushort, ushort, double);
  2919. EAsiBoolean setHour (ushort);
  2920. EAsiBoolean setMinute (ushort);
  2921. EAsiBoolean setSecond (double);
  2922. EAsiBoolean setTimeZone (const CAsiDT &);
  2923. // Get data value
  2924. //
  2925. EAsiBoolean get (ASI_DTTIME *) const;
  2926. EAsiBoolean get (DBTIME *) const;
  2927. virtual EAsiBoolean getValue (char *, uint) const;
  2928. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  2929. virtual EAsiBoolean getValue (DBTIME *) const; // OLE DB time
  2930. // *****
  2931. virtual EAsiBoolean getValue (real *) const; // Real
  2932. virtual EAsiBoolean getValue (integer *) const; // Integer
  2933. virtual EAsiBoolean getValue (smallint *) const; // Smallint
  2934. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  2935. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  2936. virtual EAsiBoolean getValue (CAsiData &) const;
  2937. virtual DBCOLUMNINFO *MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  2938. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  2939. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  2940. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  2941. virtual ushort Year (void) const {return 0;};
  2942. virtual ushort Month (void) const {return 0;};
  2943. virtual ushort Day (void) const {return 0;};
  2944. virtual ushort Hour (void) const;
  2945. virtual ushort Minute (void) const;
  2946. virtual double Second (void) const;
  2947. const CAsiDT &TimeZone (void) const;
  2948. // Runtime class iteraction functions
  2949. //
  2950. virtual unsigned long packSize (void) const;
  2951. virtual unsigned long packTo (CAsiObjPack *) const;
  2952. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  2953. virtual unsigned long packValueSize (void) const;
  2954. virtual unsigned long packValueTo (CAsiObjPack *) const;
  2955. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  2956. // Duplicate itself
  2957. //
  2958. virtual CAsiObject *duplicate (void) const;
  2959. // Operators
  2960. //
  2961. // Assignments
  2962. CAsiTime &operator= (const CAsiTime &);
  2963. // Arithmatics
  2964. CAsiTime operator+ (const CAsiDT &) const;
  2965. friend CAsiTime DLLScope operator+ (const CAsiDT &, const CAsiTime &);
  2966. CAsiTime operator- (const CAsiDT &) const;
  2967. // Difference
  2968. CAsiDT DTDiff (const CAsiTime &,const CAsiDT &) const;
  2969. // Comparision
  2970. int operator> (const CAsiTime &) const;
  2971. int operator>= (const CAsiTime &) const;
  2972. int operator== (const CAsiTime &) const;
  2973. int operator<= (const CAsiTime &) const;
  2974. int operator< (const CAsiTime &) const;
  2975. int operator!= (const CAsiTime &) const;
  2976. private:
  2977. ushort timeprec; // Time precision
  2978. double seconds; // Seconds since 0:0 AM with fraction
  2979. short mod; // Modifiyer
  2980. CAsiDT timezone;
  2981. };
  2982. ///////////////////////////////////////////
  2983. //
  2984. //
  2985. class CAsiTimeStamp: public CAsiDatetime
  2986. //
  2987. // TIMESTAMP and TIMESTAMP WITH TIME ZONE
  2988. //
  2989. // This class introduces functionality of the TIMESTAMP SQL data type
  2990. //
  2991. // MEMBER FUNCTIONS
  2992. // ----------------
  2993. // Constructors/Destructor
  2994. //
  2995. // CAsiTimeStamp ()
  2996. // CAsiTimeStamp (
  2997. // uint tprec) // Timestamp precision
  2998. //
  2999. // Two forms of constructor are provided. The second form allows to define
  3000. // timestamp precision. If the first form of constructor
  3001. // is used, timestamp precision is set to 0.
  3002. //
  3003. //
  3004. // Set Timestamp fields
  3005. //
  3006. // EAsiBoolean set (
  3007. // ushort year, // Year
  3008. // ushort month, // Month
  3009. // ushort day, // Day
  3010. // ushort hour, // Hour
  3011. // ushort minute, // Minute
  3012. // double second) // Second with fraction
  3013. //
  3014. // EAsiBoolean setYear (
  3015. // ushort year) // Year
  3016. //
  3017. // EAsiBoolean setMonth (
  3018. // ushort month) // Month
  3019. //
  3020. // EAsiBoolean setDay (
  3021. // ushort day) // Day
  3022. //
  3023. // EAsiBoolean setHour (
  3024. // ushort hour) // Hour
  3025. //
  3026. // EAsiBoolean setMinute (
  3027. // ushort minute) // Minute
  3028. //
  3029. // EAsiBoolean setSecond (
  3030. // double second) // Second with fraction
  3031. //
  3032. // These fiunctions are used to set datetime type and datetime fields.
  3033. //
  3034. // Year shall be greater or equal than 0;
  3035. // Month >= 1 and <= 12;
  3036. // Day >= 1 and <= actual number of days for each month;
  3037. // Hour >= 0 and <= 23
  3038. // Minute >= 0 and <= 59
  3039. // Second >= 0 and <= 59
  3040. // Second fraction is an unsigned short number that holds second fraction.
  3041. //
  3042. // Most of functions return boolean value bacause they must validate
  3043. // input arguments. For example, seconds can't be stored to the DATE or
  3044. // month can be greater than 12.
  3045. //
  3046. //
  3047. // void get (
  3048. // ushort *year, // Year
  3049. // ushort *month, // Month
  3050. // ushort *day, // Day
  3051. // ushort *hour, // Hour
  3052. // ushort *minute, // Minute
  3053. // double *second) // Second with fraction
  3054. //
  3055. // ushort Year ()
  3056. //
  3057. // ushort Month ()
  3058. //
  3059. // ushort Day ()
  3060. //
  3061. // ushort Hour ()
  3062. //
  3063. // ushort Minute ()
  3064. //
  3065. // double Second ()
  3066. //
  3067. // The functions above extracts all or specified datetime fields.
  3068. //
  3069. //
  3070. // Operators
  3071. //
  3072. // All meaningful arithmetic and comparision operators are redefined by
  3073. // this class. Description of them can be found in SQL/ISO standard (6.14).
  3074. // Besides them special datetime operations are defined for the datetime
  3075. // data.
  3076. //
  3077. // CAsiIDateTime & at_time_zone (
  3078. // CAsiDT &tz) // Time zone value
  3079. //
  3080. // This function translate TIME or TIMESTAMP datetime according to the
  3081. // time zone value specified as a internal hour or hour to minute day time
  3082. // interval (see 6.14 SQL/ISO). Interval value shall be between -'12:59 and
  3083. // +'13:00'. If wrong interval type was passed or
  3084. {
  3085. friend class CAsiDate;
  3086. friend class CAsiTime;
  3087. friend class CAsiTempTable;
  3088. public:
  3089. CAsiTimeStamp ();
  3090. CAsiTimeStamp (uint);
  3091. CAsiTimeStamp (const CAsiDT &);
  3092. CAsiTimeStamp (uint, const CAsiDT &);
  3093. CAsiTimeStamp (const CAsiTimeStamp &);
  3094. virtual ~CAsiTimeStamp (void);
  3095. virtual void setNull (void); // Assign NULL
  3096. void setWithTimeZone (EAsiBoolean f = kAsiTrue );
  3097. // Get data descriptor
  3098. //
  3099. virtual EAsiDTType DateTimeType (void) const;
  3100. virtual uint TimeStampPrec (void) const;
  3101. virtual uint ReturnLength (void) const;
  3102. // Check storable
  3103. virtual EAsiBoolean is_storable (const CAsiData *) const;
  3104. virtual EAsiBoolean is_castable (const CAsiData *) const;
  3105. virtual EAsiBoolean isEqualTo (const CAsiData &) const;
  3106. virtual EAsiBoolean isGreaterThan (const CAsiData &) const;
  3107. // Store Data value
  3108. //
  3109. virtual EAsiBoolean storeValue (char *, uint);
  3110. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  3111. virtual EAsiBoolean storeValue (const CAsiData &);
  3112. virtual EAsiBoolean storeValue (const DBTIMESTAMP *);
  3113. // *******
  3114. virtual EAsiBoolean storeValue (real); // Real
  3115. virtual EAsiBoolean storeValue (integer); // Integer
  3116. virtual EAsiBoolean storeValue (smallint); // Smallint
  3117. virtual EAsiBoolean storeValue (char *, uint, uint *); // Binary Buffer
  3118. virtual EAsiBoolean storeValue (const AsiUcStr); // Store AsiUcStr
  3119. // Set timestamp fields
  3120. //
  3121. EAsiBoolean set (ASI_DTTIMESTAMP *);
  3122. EAsiBoolean set (const DBTIMESTAMP *);
  3123. EAsiBoolean set (const CAsiDate &, const CAsiTime &);
  3124. EAsiBoolean set (ushort, ushort, ushort, ushort,
  3125. ushort, double);
  3126. EAsiBoolean setYear (ushort);
  3127. EAsiBoolean setMonth (ushort);
  3128. EAsiBoolean setDay (ushort);
  3129. EAsiBoolean setHour (ushort);
  3130. EAsiBoolean setMinute (ushort);
  3131. EAsiBoolean setSecond (double);
  3132. EAsiBoolean setTimeZone (const CAsiDT &);
  3133. // Get data value
  3134. //
  3135. EAsiBoolean get (ASI_DTTIMESTAMP *) const;
  3136. EAsiBoolean get (DBTIMESTAMP *) const;
  3137. virtual EAsiBoolean getValue (char *, uint) const;
  3138. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  3139. virtual EAsiBoolean getValue (DBTIMESTAMP *) const;
  3140. // *****
  3141. virtual EAsiBoolean getValue (real *) const; // Real
  3142. virtual EAsiBoolean getValue (integer *) const; // Integer
  3143. virtual EAsiBoolean getValue (smallint *) const; // Smallint
  3144. virtual EAsiBoolean getValue (char *, uint, uint *) const; // Binary Buffer
  3145. virtual EAsiBoolean getValue (AsiUcStr, uint) const; // Unicode string
  3146. virtual EAsiBoolean getValue (CAsiData &) const;
  3147. virtual DBCOLUMNINFO *MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  3148. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  3149. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  3150. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  3151. virtual ushort Year (void) const;
  3152. virtual ushort Month (void) const;
  3153. virtual ushort Day (void) const;
  3154. virtual ushort Hour (void) const;
  3155. virtual ushort Minute (void) const;
  3156. virtual double Second (void) const;
  3157. const CAsiDT &TimeZone (void) const;
  3158. // Runtime class iteraction functions
  3159. //
  3160. virtual unsigned long packSize (void) const;
  3161. virtual unsigned long packTo (CAsiObjPack *) const;
  3162. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  3163. virtual unsigned long packValueSize (void) const;
  3164. virtual unsigned long packValueTo (CAsiObjPack *) const;
  3165. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  3166. // Duplicate itself
  3167. //
  3168. virtual CAsiObject *duplicate (void) const;
  3169. // Operators
  3170. //
  3171. // Assignments
  3172. CAsiTimeStamp &operator= (const CAsiTimeStamp &);
  3173. CAsiTimeStamp &operator= (const CAsiDate &);
  3174. CAsiTimeStamp &operator= (const CAsiTime &);
  3175. // Arithmatics
  3176. CAsiTimeStamp operator+ (const CAsiYM &) const;
  3177. CAsiTimeStamp operator+ (const CAsiDT &) const;
  3178. friend CAsiTimeStamp DLLScope operator+ (const CAsiYM &, CAsiTimeStamp &);
  3179. friend CAsiTimeStamp DLLScope operator+ (const CAsiDT &, CAsiTimeStamp &);
  3180. CAsiTimeStamp operator- (const CAsiYM &) const;
  3181. CAsiTimeStamp operator- (const CAsiDT &) const;
  3182. // Difference between timestamps
  3183. CAsiYM YMDiff (const CAsiTimeStamp &, const CAsiYM &) const;
  3184. CAsiDT DTDiff (const CAsiTimeStamp &, const CAsiDT &) const;
  3185. // Comparision
  3186. int operator> (const CAsiTimeStamp &) const;
  3187. int operator>= (const CAsiTimeStamp &) const;
  3188. int operator== (const CAsiTimeStamp &) const;
  3189. int operator<= (const CAsiTimeStamp &) const;
  3190. int operator< (const CAsiTimeStamp &) const;
  3191. int operator!= (const CAsiTimeStamp &) const;
  3192. private:
  3193. CAsiTime time;
  3194. CAsiDate date;
  3195. };
  3196. ////////////////////////////////////////////////////////////////////////////////
  3197. // OLEDB BLOBs
  3198. class CAsiBlob : public CAsiData
  3199. {
  3200. public:
  3201. // BLOB types used by ASI
  3202. //
  3203. typedef enum {
  3204. kUnknown = 0,
  3205. kBlob,
  3206. kIPersist,
  3207. kNonIPersist,
  3208. kADT
  3209. } EBlobType;
  3210. // BLOB print format
  3211. //
  3212. typedef enum {
  3213. kUnk = 0,
  3214. kHex,
  3215. kDec,
  3216. kChr,
  3217. kOct,
  3218. kBin
  3219. } EBlobFormat;
  3220. // Construction/Destruction
  3221. //
  3222. CAsiBlob ();
  3223. CAsiBlob (const CAsiBlob &);
  3224. virtual ~CAsiBlob ();
  3225. void SetType (EBlobType);
  3226. EBlobType GetType () const;
  3227. // Get data descriptor
  3228. //
  3229. virtual EAsiDataType Type () const;
  3230. virtual uint Length () const;
  3231. virtual uint ReturnLength () const;
  3232. // Store Data value
  3233. //
  3234. virtual EAsiBoolean storeValue (real);
  3235. virtual EAsiBoolean storeValue (integer);
  3236. virtual EAsiBoolean storeValue (smallint);
  3237. virtual EAsiBoolean storeValue (char *, uint);
  3238. virtual EAsiBoolean storeValue (const CAsiUcStr &);
  3239. virtual EAsiBoolean storeValue (const CAsiData &);
  3240. virtual EAsiBoolean storeValue (char *, uint, uint *);
  3241. EAsiBoolean set (IUnknown *);
  3242. // Retrieve Data value
  3243. //
  3244. virtual EAsiBoolean getValue (real *) const;
  3245. virtual EAsiBoolean getValue (integer *) const;
  3246. virtual EAsiBoolean getValue (smallint *) const;
  3247. virtual EAsiBoolean getValue (char *, uint) const;
  3248. virtual EAsiBoolean getValue (CAsiUcStr *) const;
  3249. virtual EAsiBoolean getValue (CAsiData &) const;
  3250. EAsiBoolean get (IUnknown **);
  3251. virtual DBCOLUMNINFO * MapAsiToColumnInfo (DBCOLUMNINFO *) const;
  3252. virtual DBPARAMINFO * MapAsiToParamInfo (DBPARAMINFO *) const;
  3253. virtual EAsiBoolean SQLType (CAsiUcStr *) const; // SQL data type as string
  3254. virtual EAsiBoolean SQLLiteral (CAsiUcStr *) const; // SQL compatible literal
  3255. // Runtime class iteraction functions
  3256. //
  3257. virtual unsigned long packSize (void) const;
  3258. virtual unsigned long packTo (CAsiObjPack *) const;
  3259. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  3260. virtual unsigned long packValueSize () const;
  3261. virtual unsigned long packValueTo (CAsiObjPack *) const;
  3262. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  3263. // Duplicate itself
  3264. //
  3265. virtual CAsiObject * duplicate () const;
  3266. // Nullify all members
  3267. //
  3268. virtual void Clear ();
  3269. // Mostly useful interface
  3270. //
  3271. HRESULT Read (void *, ulong, ulong *);
  3272. HRESULT Write (void *, ulong, ulong *);
  3273. // ConvertToString functions
  3274. //
  3275. void SetFormat (EBlobFormat);
  3276. void SetPrintLen (int);
  3277. HRESULT ReadHead ();
  3278. private:
  3279. IUnknown * m_pIUnknown; // OLEDB interface to support I/O
  3280. EBlobType m_eBlobType;
  3281. EBlobFormat m_eBlobFormat;
  3282. int m_iHeadLen;
  3283. char m_cBlobHead[MaxCharLength];
  3284. };
  3285. ///////////////////////////////////////////////////////////////////////////////////////////
  3286. //
  3287. // class CAsiColumn
  3288. //
  3289. ///////////////////////////////////////////////////////////////////////////////////////////
  3290. class CAsiColumn : public CAsiObject
  3291. // This class introduces functionality of a table column. It holds a
  3292. // column descriptor and column data. Column descriptor includes the
  3293. // folowing issues, that can be set and retrieved by the CAsiColumn services:
  3294. //
  3295. // - Column name;
  3296. // - Whether column name is an implementation defined;
  3297. // - Domain, if column is based on it;
  3298. // - Data type descriptor ;
  3299. // - Collation name, if any;
  3300. // - Value of the default option
  3301. // - Nullability characteristics
  3302. // - Ordinal position of column within table
  3303. //
  3304. //
  3305. {
  3306. public:
  3307. CAsiColumn (void);
  3308. CAsiColumn (const CAsiIdent &);
  3309. CAsiColumn (const CAsiIdent &, const CAsiSmallInt &);
  3310. CAsiColumn (const CAsiIdent &, const CAsiInt &);
  3311. CAsiColumn (const CAsiIdent &, const CAsiNumeric &);
  3312. CAsiColumn (const CAsiIdent &, const CAsiDecimal &);
  3313. CAsiColumn (const CAsiIdent &, const CAsiFloat &);
  3314. CAsiColumn (const CAsiIdent &, const CAsiReal &);
  3315. CAsiColumn (const CAsiIdent &, const CAsiDouble &);
  3316. CAsiColumn (const CAsiIdent &, const CAsiChar &);
  3317. CAsiColumn (const CAsiIdent &, const CAsiBinary &);
  3318. CAsiColumn (const CAsiIdent &, const CAsiDate &);
  3319. CAsiColumn (const CAsiIdent &, const CAsiTime &);
  3320. CAsiColumn (const CAsiIdent &, const CAsiTimeStamp &);
  3321. CAsiColumn (const CAsiIdent &, const CAsiYM &);
  3322. CAsiColumn (const CAsiIdent &, const CAsiDT &);
  3323. CAsiColumn (const CAsiIdent &, const CAsiIdent &); // By domain name
  3324. CAsiColumn (const CAsiIdent &, CAsiData *); // By generic data
  3325. CAsiColumn (const CAsiColumn &); // copy constructor
  3326. CAsiColumn (const DBCOLUMNINFO *);
  3327. virtual ~CAsiColumn ();
  3328. // Setting Column Descriptor
  3329. //
  3330. void setName (const CAsiIdent &); // Set column name
  3331. void setNullable (EAsiBoolean); // Set nullability
  3332. void setNative (EAsiBoolean); // Set native flag
  3333. void setCollation (const CAsiUcStr &); // Set collation name
  3334. void setDefault (CAsiData *); // Set Default data
  3335. void setDomain (const CAsiIdent &); // Set Domain name
  3336. void setDataDsc (CAsiData *); // Set data descriptor
  3337. void setOffset (uint); // Set Ordinal position
  3338. // Read Column Descriptor
  3339. //
  3340. const CAsiIdent & Name (void) const; // Get column name
  3341. EAsiBoolean Nullable (void) const; // Get nullability
  3342. EAsiBoolean Native (void) const; // Get native flag
  3343. const CAsiUcStr * Collation (void) const; // Get collation name
  3344. CAsiData * Default (void) const; // Get Default data
  3345. const CAsiIdent & Domain (void) const; // Get Domain name
  3346. uint Offset (void) const; // Get Ordinal position
  3347. EAsiBoolean IsBookmark (void) const;
  3348. unsigned long ColumnFlags (void) const; // OLEDB column flags
  3349. const DBCOLUMNINFO & ColumnInfo (void) const;
  3350. // Get Access to Column Data Descriptor and Data
  3351. //
  3352. CAsiData * getData (void) const;
  3353. // Overloaded operators
  3354. CAsiColumn & operator= (const CAsiColumn &);
  3355. CAsiColumn & operator= (CAsiData *);
  3356. // Runtime class iteraction functions
  3357. //
  3358. virtual unsigned long packSize (void) const;
  3359. virtual unsigned long packTo (CAsiObjPack *) const;
  3360. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  3361. virtual unsigned long packValueSize (void) const;
  3362. virtual unsigned long packValueTo (CAsiObjPack *) const;
  3363. virtual EAsiBoolean unpackValueFrom (CAsiObjPack *);
  3364. // Duplicate column
  3365. //
  3366. virtual CAsiObject * duplicate (void) const;
  3367. // Release all members
  3368. //
  3369. virtual void Clear (void);
  3370. private:
  3371. static void setColumn (CAsiColumn * t, const CAsiIdent & colname,
  3372. CAsiData * datadsc);
  3373. protected:
  3374. CAsiIdent m_idName; // Column name
  3375. CAsiData * m_pData; // Column data descriptor and data
  3376. EAsiBoolean m_fNullable; // Nullability
  3377. EAsiBoolean m_fNative; // Is native
  3378. CAsiData * m_pDefval; // Default value
  3379. CAsiIdent m_idDomain; // Domain name
  3380. uint m_uiOffset; // Ordinal position
  3381. unsigned long m_dwColFlags; // Column flags (OLEDB column characteristics)
  3382. DBCOLUMNINFO m_sColumnInfo; // Column info
  3383. };
  3384. ////////////////////////////////////////////////
  3385. //
  3386. //
  3387. class CAsiRow : public CAsiObject
  3388. //
  3389. // This class introduces functionality of a column collection
  3390. //
  3391. {
  3392. public:
  3393. CAsiRow (int ColNum);
  3394. CAsiRow (const CAsiRow &);
  3395. virtual ~CAsiRow ();
  3396. int ColNum (void) const;
  3397. CAsiColumn & operator [] (int) const;
  3398. int findCol (const CAsiIdent &) const;
  3399. EAsiBoolean isDistinct (void) const;
  3400. virtual CAsiObject * duplicate (void) const;
  3401. virtual void Clear (void);
  3402. private:
  3403. CAsiColumn * m_pColumns; // Columns data
  3404. int m_iColnum; // Number of columns in row
  3405. };
  3406. ////////////////////////////////////////////////
  3407. //
  3408. //
  3409. class CAsiHostBuffer: public CAsiObject
  3410. //
  3411. // This class holds information about host variable buffer. Host variable
  3412. // buffer has a dual usage in ASI: it is either as a source for dynamic
  3413. // parameters input or a destination for column value output.
  3414. // CAsiHostBuffer is a base class for CAsiParameter class, designating the
  3415. // fact that parameter has to be linked with the host variable buffer.
  3416. //
  3417. // virtual EAsiBoolean setBind (
  3418. // CAsiData *pData // Pointer to host buffer
  3419. // )
  3420. // Bind parameter with data buffer in the host program. Host buffer
  3421. // is represented as a CAsiData object.
  3422. // Function returns kAsiTrue if succeeded and kAsiFalse otherwise.
  3423. //
  3424. //
  3425. //
  3426. // virtual EAsiBoolean getBind (
  3427. // CAsiData **ppData // Storage of pointer to host buffer
  3428. // )
  3429. //
  3430. // This function stores pointer to the host memory buffer into provided
  3431. // memory location.
  3432. // kAsiFalse is returned if parameter was not bound with host buffer, or
  3433. // other abnormal situation occured.
  3434. //
  3435. {
  3436. friend class CAsiCsr;
  3437. friend class CAsiStm;
  3438. public:
  3439. // Construction/descriptor
  3440. //
  3441. CAsiHostBuffer ();
  3442. virtual ~CAsiHostBuffer ();
  3443. // Getting bound variable address
  3444. //
  3445. virtual EAsiBoolean getBind (CAsiData **) const;
  3446. // Runtime class iteraction functions
  3447. //
  3448. protected:
  3449. // Binding parameter with host variable buffer
  3450. //
  3451. virtual EAsiBoolean setBind (CAsiData *);
  3452. protected:
  3453. CAsiData *pData; // Pointer to data
  3454. };
  3455. ////////////////////////////////////////////////
  3456. //
  3457. //
  3458. class CAsiParameter: public CAsiHostBuffer
  3459. //
  3460. // This class describes dynamic parameter or variable reference in the SQL
  3461. // statement and its link with the host program buffer. It inherits
  3462. // functionality of the CAsiHostBuffer supercalss and reloads setBind()
  3463. // member function.
  3464. //
  3465. // EAsiBoolean setBind (
  3466. // CAsiData *pData, // Pointer to host buffer
  3467. // )
  3468. //
  3469. // Bind parameter with the host program buffer. Function also checks
  3470. // whether the host variable type matches the parameter type. Return
  3471. // kAsiTrue if succeded, and kAsiFalse otherwise. Can set and push
  3472. // complition in DDA if types mismatch error was detected.
  3473. //
  3474. {
  3475. // Friend classes
  3476. //
  3477. friend class CAsiParser;
  3478. friend class CAsiStm;
  3479. friend class CAsiDDAParams;
  3480. friend class CAsiHostLink;
  3481. friend class CAsiInterDBCursor;
  3482. friend class CAsiEmulCursor;
  3483. friend class CAsiEmulTable;
  3484. public:
  3485. CAsiParameter ();
  3486. CAsiParameter (const DBPARAMINFO *);
  3487. virtual ~CAsiParameter ();
  3488. protected:
  3489. // Bind parameter with host buffer
  3490. //
  3491. virtual EAsiBoolean setBind (CAsiData *);
  3492. public:
  3493. // Setting parameter characteristics
  3494. //
  3495. void setName (const CAsiIdent &); // name
  3496. void setNullable (EAsiBoolean); // nullability characteristics
  3497. void setDsc (CAsiData*); // data descriptor
  3498. // Getting parameter characteristics
  3499. //
  3500. const CAsiIdent & Name (void) const; // name
  3501. EAsiBoolean isNullable (void) const; // nullability characteristics
  3502. CAsiData * Dsc (void) const; // data descriptor
  3503. // Runtime class iteraction functions
  3504. //
  3505. virtual unsigned long packSize (void) const;
  3506. virtual unsigned long packTo (CAsiObjPack *) const;
  3507. virtual EAsiBoolean unpackFrom (CAsiObjPack *);
  3508. private:
  3509. virtual CAsiObject * duplicate (void) const;
  3510. // Nullify all members
  3511. virtual void Clear (void);
  3512. private:
  3513. CAsiIdent ucParName; // Parameter name
  3514. CAsiData * pDataDescriptor; // Parameter data descriptor
  3515. EAsiBoolean eNul; // Nullability characteristics
  3516. };
  3517. /////////////////////////////////////////////////////////////////////////////
  3518. struct ListItem {
  3519. struct ListItem *next;
  3520. CAsiObject *item;
  3521. };
  3522. typedef ULONG_PTR ASILISTPOS; // List position
  3523. /////////////////////////////////////////////////////////////////////////////
  3524. //
  3525. // class CAsiList
  3526. //
  3527. /////////////////////////////////////////////////////////////////////////////
  3528. class CAsiList: public CAsiObject
  3529. {
  3530. public:
  3531. // Construction destruction
  3532. CAsiList ();
  3533. virtual ~ CAsiList ();
  3534. // Add item
  3535. //
  3536. EAsiBoolean addFirst (CAsiObject *); // Add First
  3537. EAsiBoolean addLast (CAsiObject *); // Add Last
  3538. // Delete items
  3539. EAsiBoolean del (CAsiObject *); // Delete
  3540. EAsiBoolean del (int); // Delete by number
  3541. EAsiBoolean detach (CAsiObject *); // Detach object
  3542. EAsiBoolean detach (int); // Detach by number
  3543. EAsiBoolean delFirst (void); // Delete First
  3544. EAsiBoolean delLast (void); // Delete Last
  3545. EAsiBoolean delTail (int); // Delete tail
  3546. EAsiBoolean detachFirst (void); // Detach First
  3547. EAsiBoolean detachLast (void); // Detach Last
  3548. EAsiBoolean detachTail (int); // Detach tail
  3549. // Replace item
  3550. EAsiBoolean replace (int, // Replace object.
  3551. CAsiObject *); // Delete the old one
  3552. EAsiBoolean overwrite (int, // Overwrite object.
  3553. CAsiObject *); // Don't delete the old one
  3554. // Manipulate list
  3555. //
  3556. CAsiObject * first (void); // first item
  3557. CAsiObject * next (void); // Next item
  3558. CAsiObject * next (ASILISTPOS); // Next item after position
  3559. CAsiObject * last (void); // Last item
  3560. int qnty (void) const; // number of items
  3561. void detachAll (void); // Clear list
  3562. ASILISTPOS position (void) const; // Get current position
  3563. CAsiObject * getCurrent (void) const; // Get current
  3564. CAsiObject * getAt (ASILISTPOS) const; // Get at position
  3565. // Operator []
  3566. CAsiObject *operator [] (int); // i-th item
  3567. // Duplicate node
  3568. virtual CAsiObject *duplicate () const;
  3569. virtual void Clear (void); // Clear list
  3570. private:
  3571. struct ListItem *head;
  3572. struct ListItem *tail;
  3573. struct ListItem *current;
  3574. };
  3575. ////////////////////////////////////////////////////////////////////////
  3576. //
  3577. // class CAsiIRow
  3578. //
  3579. ////////////////////////////////////////////////////////////////////////
  3580. class CAsiIRow : public CAsiObject
  3581. //
  3582. // This class represents an array of pointers to the CAsiData objects
  3583. //
  3584. {
  3585. public:
  3586. CAsiIRow (void);
  3587. CAsiIRow (const int);
  3588. CAsiIRow (const CAsiIRow &);
  3589. virtual ~CAsiIRow (void);
  3590. int Quantity (void) const; // Number of items
  3591. EAsiBoolean setItem (int, CAsiData *); // Initialize item
  3592. // Operators
  3593. //
  3594. CAsiData * operator [] (const int item) const;
  3595. // Misceleneous
  3596. //
  3597. virtual CAsiObject * duplicate (void) const;
  3598. virtual void Clear (void);
  3599. private:
  3600. CAsiData **values; // Data
  3601. int items; // Number of items in internal row
  3602. };
  3603. #pragma pack (pop)
  3604. #endif /* ASI_SDATA_HH */