00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <iostream.h>
00024 #include <OB/CORBA.h>
00025 #include <OB/CosNaming.h>
00026 #include "BridgeStub.h"
00027 #include "Parser.h"
00028 #include "StdAfx.h"
00029 #include "SoapCorba.h"
00030 #include "DbObjects.h"
00031 #include "ReadIR.h"
00032 #include "SoapBridge.h"
00033 #include "SoapBridge_skel.h"
00034 #include <sys/timeb.h>
00035 #include "sbimpl.h"
00036
00040 SOAPBridge_TypeConversions_impl::SOAPBridge_TypeConversions_impl(PortableServer::POA_ptr poa)
00041 : poa_(PortableServer::POA::_duplicate(poa))
00042 {
00043 }
00044
00045 SOAPBridge_TypeConversions_impl::~SOAPBridge_TypeConversions_impl()
00046 {
00047 }
00048
00049 PortableServer::POA_ptr
00050 SOAPBridge_TypeConversions_impl::_default_POA()
00051 {
00052 return PortableServer::POA::_duplicate(poa_);
00053 }
00054
00058 void
00059 SOAPBridge_TypeConversions_impl::Set(const SOAPBridge::TypeConversions::Specification& spec)
00060 throw(SOAPBridge::TypeConversions::BadSpecification,
00061 CORBA::SystemException)
00062 {
00063 const char *mp, *pn, *ci;
00064
00065 if (spec.methodPath == NULL) {
00066 mp = "";
00067 } else {
00068 mp = (const char *) spec.methodPath;
00069 }
00070 if (spec.parameterName == NULL) {
00071 pn = "";
00072 } else {
00073 pn = (const char *) spec.parameterName;
00074 }
00075 if (spec.userInfo == NULL) {
00076 ci = "";
00077 } else {
00078 ci = (const char *) spec.userInfo;
00079 }
00080
00081 IRPlus *pirp = (IRPlus *) irplusHandle;
00082 JTCSynchronized synchronized (pirp->monitor);
00083 DOQuery Q (pirp->pCon);
00084
00085 CString q;
00086 q.Format ("delete from irplus where methpath='%s' and param='%s'", mp, pn);
00087 Q.Query (q);
00088 if (spec.convUId) {
00089 q.Format ("insert into irplus(methpath,param,convid,convinfo) values ('%s','%s',%d,'%s')",
00090 mp, pn, spec.convUId, ci);
00091 Q.Query (q);
00092 }
00093 pirp->IRC.DeleteAllInterfaceMethod ();
00094 pirp->Init ();
00095 }
00096
00100 CORBA::Boolean
00101 SOAPBridge_TypeConversions_impl::Get(SOAPBridge::TypeConversions::Specification& spec,
00102 CORBA::Boolean getNext)
00103 throw(CORBA::SystemException)
00104 {
00105 CORBA::Boolean _r = false;
00106 char *mp, *pn;
00107
00108 if (spec.methodPath == NULL) {
00109 mp = "";
00110 } else {
00111 mp = (char *) spec.methodPath;
00112 }
00113 if (spec.parameterName == NULL) {
00114 pn = "";
00115 } else {
00116 pn = (char *) spec.parameterName;
00117 }
00118
00119 CString q;
00120 q = "select irmeth.methpath as mpath,irparm.param as mparm,convid,convinfo from irmeth,irparm,irplus ";
00121 q += "where irmeth.methuid=irparm.methuid and (irmeth.irplusid<>0 or irparm.irplusid<>0) ";
00122 q += "and (irmeth.irplusid=irplus.irplusid or irparm.irplusid=irplus.irplusid) ";
00123 if (getNext) {
00124 q += "and irmeth.methpath='";
00125 q += mp;
00126 q += "' and irparm.param>'";
00127 q += pn;
00128 q += "' ";
00129 } else {
00130 q += "and irmeth.methpath='";
00131 q += mp;
00132 q += "' and irparm.param='";
00133 q += pn;
00134 q += "' ";
00135 }
00136 q += "order by irmeth.methpath,irparm.param limit 1";
00137 IRPlus *pirp = (IRPlus *) irplusHandle;
00138 JTCSynchronized synchronized (pirp->monitor);
00139 DOQuery Q (pirp->pCon);
00140 Q.Query (q);
00141 if (Q.GetNumRows ()) {
00142 spec.methodPath = CORBA::string_dup (Q.FindQueryField ("mpath")->GetValue ());
00143 spec.parameterName = CORBA::string_dup (Q.FindQueryField ("mparm")->GetValue ());
00144 spec.convUId = atoi (Q.FindQueryField ("convid")->GetValue ());
00145 spec.userInfo = CORBA::string_dup (Q.FindQueryField ("convInfo")->GetValue ());
00146 _r = true;
00147 }
00148 if (!_r && getNext) {
00149 q = "select irmeth.methpath as mpath,irparm.param as mparm,convid,convinfo from irmeth,irparm,irplus ";
00150 q += "where irmeth.methuid=irparm.methuid and (irmeth.irplusid<>0 or irparm.irplusid<>0) ";
00151 q += "and (irmeth.irplusid=irplus.irplusid or irparm.irplusid=irplus.irplusid) ";
00152 q += "and irmeth.methpath>'";
00153 q += mp;
00154 q += "' ";
00155 q += "order by irmeth.methpath,irparm.param limit 1";
00156 Q.Query (q);
00157 if (Q.GetNumRows ()) {
00158 spec.methodPath = CORBA::string_dup (Q.FindQueryField ("mpath")->GetValue ());
00159 spec.parameterName = CORBA::string_dup (Q.FindQueryField ("mparm")->GetValue ());
00160 spec.convUId = atoi (Q.FindQueryField ("convid")->GetValue ());
00161 spec.userInfo = CORBA::string_dup (Q.FindQueryField ("convInfo")->GetValue ());
00162 _r = true;
00163 }
00164 }
00165 return _r;
00166 }
00167