You can subscribe to this list here.
2005 |
Jan
|
Feb
(1) |
Mar
(45) |
Apr
(150) |
May
(145) |
Jun
(150) |
Jul
(79) |
Aug
(313) |
Sep
(160) |
Oct
(309) |
Nov
(115) |
Dec
(60) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(160) |
Feb
(144) |
Mar
(127) |
Apr
(48) |
May
(102) |
Jun
(54) |
Jul
(245) |
Aug
(94) |
Sep
(152) |
Oct
(162) |
Nov
(166) |
Dec
(740) |
2007 |
Jan
(752) |
Feb
(437) |
Mar
(328) |
Apr
(373) |
May
(569) |
Jun
(399) |
Jul
(369) |
Aug
(627) |
Sep
(100) |
Oct
(306) |
Nov
(166) |
Dec
(282) |
2008 |
Jan
(68) |
Feb
(145) |
Mar
(180) |
Apr
(160) |
May
(277) |
Jun
(229) |
Jul
(1188) |
Aug
(51) |
Sep
(97) |
Oct
(99) |
Nov
(95) |
Dec
(170) |
2009 |
Jan
(39) |
Feb
(73) |
Mar
(120) |
Apr
(121) |
May
(104) |
Jun
(262) |
Jul
(57) |
Aug
(171) |
Sep
(131) |
Oct
(88) |
Nov
(64) |
Dec
(83) |
2010 |
Jan
(55) |
Feb
(67) |
Mar
(124) |
Apr
(64) |
May
(130) |
Jun
(75) |
Jul
(164) |
Aug
(64) |
Sep
(44) |
Oct
(17) |
Nov
(43) |
Dec
(31) |
2011 |
Jan
(21) |
Feb
(10) |
Mar
(43) |
Apr
(46) |
May
(52) |
Jun
(71) |
Jul
(7) |
Aug
(16) |
Sep
(51) |
Oct
(14) |
Nov
(33) |
Dec
(15) |
2012 |
Jan
(12) |
Feb
(61) |
Mar
(129) |
Apr
(76) |
May
(70) |
Jun
(52) |
Jul
(29) |
Aug
(41) |
Sep
(32) |
Oct
(23) |
Nov
(38) |
Dec
(26) |
2013 |
Jan
(35) |
Feb
(37) |
Mar
(51) |
Apr
(15) |
May
(52) |
Jun
(15) |
Jul
(23) |
Aug
(21) |
Sep
(46) |
Oct
(69) |
Nov
(57) |
Dec
(26) |
2014 |
Jan
(5) |
Feb
(13) |
Mar
(17) |
Apr
(1) |
May
(5) |
Jun
|
Jul
(2) |
Aug
(2) |
Sep
(1) |
Oct
(16) |
Nov
(8) |
Dec
(4) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
(4) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Gareth S B. <bes...@us...> - 2005-06-03 15:16:04
|
Update of /cvsroot/sblim/sfcb/regressionTests/LifeCycleIndications/schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29224/schema Removed Files: indications.mof indications.reg Log Message: remove old Lifecycle indication tests. Deprecated by new cmpi-tests/cmpi-lifecycleindicationtest provider --- indications.mof DELETED --- --- indications.reg DELETED --- |
From: Gareth S B. <bes...@us...> - 2005-06-03 15:16:04
|
Update of /cvsroot/sblim/sfcb/regressionTests/LifeCycleIndications In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29224 Removed Files: Makefile createInstIndTestProvider.c env rules wbemcli.ind Log Message: remove old Lifecycle indication tests. Deprecated by new cmpi-tests/cmpi-lifecycleindicationtest provider --- rules DELETED --- --- wbemcli.ind DELETED --- --- Makefile DELETED --- --- createInstIndTestProvider.c DELETED --- --- env DELETED --- |
From: Seyrich <se...@us...> - 2005-06-03 14:08:19
|
Update of /cvsroot/sblim/sfcb/jdbc/htmlviewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30926/jdbc/htmlviewer Modified Files: HFrame.java Log Message: FIX index-problem Index: HFrame.java =================================================================== RCS file: /cvsroot/sblim/sfcb/jdbc/htmlviewer/HFrame.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- HFrame.java 3 Jun 2005 10:31:58 -0000 1.1 +++ HFrame.java 3 Jun 2005 14:08:07 -0000 1.2 @@ -310,6 +310,7 @@ } catch (IOException e) { // TODO: handle exception + comandLineBox.addItem(""); } } |
From: Viktor M. <mih...@us...> - 2005-06-03 10:32:11
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13949 Modified Files: Makefile.am cimXmlRequest.c configure.ac control.c httpAdapter.c providerMgr.c sfcBroker.c sfcVersion.h trace.h Added Files: avltree.c avltree.h dbpAdapter.c sqlLexer.l sqlParser.y sqlStatement.c sqlStatement.h Log Message: Bug fixed 1214077: Added SQL Support (for JDBC). Index: cimXmlRequest.c =================================================================== RCS file: /cvsroot/sblim/sfcb/cimXmlRequest.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- cimXmlRequest.c 6 May 2005 02:11:58 -0000 1.10 +++ cimXmlRequest.c 3 Jun 2005 10:31:56 -0000 1.11 @@ -339,7 +339,6 @@ {0, iResponseIntro3}, {2, (char*)sb}, {0, iResponseTrailer1}} }; - _SFCB_ENTER(TRACE_CIMXMLPROC, "iMethodResponse"); _SFCB_RETURN(rs); }; @@ -761,7 +760,6 @@ _SFCB_TRACE(1, ("--- Calling Providers")); resp = invokeProviders(&binCtx, &err, &l); _SFCB_TRACE(1, ("--- Back from Provider")); - closeProviderContext(&binCtx); if (err == 0) { _SFCB_RETURN(genResponses(&binCtx, resp, l)); @@ -773,7 +771,6 @@ _SFCB_RETURN(ctxErrResponse(hdr, &binCtx,0)); } - static RespSegments enumClasses(CimXmlRequestContext * ctx, RequestHdr * hdr) { @@ -1038,9 +1035,9 @@ sreq->operation=OPS_ModifyInstance; sreq->count=req->properties+3; - for (i=0; i<req->properties; i++) + for (i=0; i<req->properties; i++){ sreq->properties[i]=setCharsMsgSegment(req->propertyList[i]); - + } xci = &req->namedInstance.instance; xco = &req->namedInstance.path; @@ -1050,6 +1047,7 @@ xco->bindings.keyBindings[i].value, &xco->bindings.keyBindings[i].ref, &val, &type); + CMAddKey(path, xco->bindings.keyBindings[i].name, valp, type); } @@ -1090,6 +1088,7 @@ _SFCB_RETURN(ctxErrResponse(hdr, &binCtx,0)); } + static RespSegments enumInstanceNames(CimXmlRequestContext * ctx, RequestHdr * hdr) { @@ -1101,8 +1100,8 @@ BinRequestContext binCtx; memset(&binCtx,0,sizeof(BinRequestContext)); - XtokEnumInstanceNames *req = (XtokEnumInstanceNames *) hdr->cimRequest; + XtokEnumInstanceNames *req = (XtokEnumInstanceNames *) hdr->cimRequest; path = NewCMPIObjectPath(req->op.nameSpace.data, req->op.className.data, NULL); sreq.objectPath = setObjectPathMsgSegment(path); sreq.principal = setCharsMsgSegment(ctx->principal); @@ -1149,6 +1148,7 @@ BinRequestContext binCtx; memset(&binCtx,0,sizeof(BinRequestContext)); + XtokEnumInstances *req = (XtokEnumInstances *) hdr->cimRequest; if (req->properties) sreqSize+=req->properties*sizeof(MsgSegment); @@ -1170,9 +1170,11 @@ binCtx.rHdr = hdr; binCtx.bHdrSize = sreqSize; binCtx.commHndl = ctx->commHndl; + binCtx.type=CMPI_instance; binCtx.xmlAs=binCtx.noResp=0; binCtx.chunkFncs=ctx->chunkFncs; + if (noChunking) hdr->chunkedMode=binCtx.chunkedMode=0; else { --- NEW FILE: avltree.c --- /* * avltree.c * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Sebastian Seyrich <se...@de...> * * Description: * AVL-Tree Datatype * * * */ #include <stdlib.h> #include "avltree.h" static void freeAvl(AvlTree **t); static void *insertAvl(AvlTree *this, void *item); static void *findAvl(AvlTree *this, void *item); static void *findMinAvl(AvlTree *this); static void *deleteAvl(AvlTree *this, void *item); static void *deleteMinAvl(AvlTree *this); AvlTree *newAvlTree(int (* compar)(const void *, const void *)) { AvlTree *this; this = (AvlTree*)calloc(1,sizeof(AvlTree)); this->root = NULL; this->compar = compar; this->stack = malloc(AVL_STACK_SIZE * sizeof(AvlNode *)); this->pathInfo = malloc(AVL_STACK_SIZE * sizeof(signed char)); this->n = 0; this->free = freeAvl; this->insert = insertAvl; this->find = findAvl; this->findMin = findMinAvl; this->delete = deleteAvl; this->deleteMin = deleteMinAvl; return this; } static void freeAvl(AvlTree **this) { //printf("1\n"); AvlTree * t = *this; // printf("2\n"); int tos; AvlNode *p, **stack; //printf("3\n"); if(t->root) { //printf("4\n"); stack = t->stack; stack[0] = t->root; tos = 1; //printf("5\n"); while(tos) { //printf("6\n"); p = stack[--tos]; if(p->left) { stack[tos++] = p->left; } if(p->right) { stack[tos++] = p->right; } free(p); } } //printf("7\n"); free(t->stack); //printf("8\n"); free(t->pathInfo); //printf("9\n"); free(t); //printf("10\n"); } static void *insertAvl(AvlTree *this, void *item) { int (* compar)(const void *, const void *); int cmpres; void *res; AvlNode *x, *p, *q, *r, **attachX; AvlNode **stack; int tos, stackN; signed char *pathInfo; compar = this->compar; stack = this->stack; pathInfo = this->pathInfo; tos = 0; if((p = this->root)) { for(;;) { stack[tos] = p; cmpres = compar(item, p->item); if(cmpres < 0) { pathInfo[tos] = -1; tos++; p = p->left; if(!p) { attachX = &stack[tos-1]->left; break; } } else if(cmpres > 0) { pathInfo[tos] = 1; tos++; p = p->right; if(!p) { attachX = &stack[tos-1]->right; break; } } else { return p->item; } } } else { attachX = &this->root; } res = NULL; x = malloc(sizeof(AvlNode)); x->left = x->right = NULL; x->balance = 0; x->item = item; *attachX = x; this->n++; stackN = tos; while(tos) { p = stack[--tos]; if(p->balance == 0) { p->balance += pathInfo[tos]; } else { p->balance += pathInfo[tos]; if(p->balance == 0) { break; } else { q = stack[tos + 1]; if(pathInfo[tos] == pathInfo[tos + 1]) { if(pathInfo[tos] == 1) { p->right = q->left; q->left = p; } else { p->left = q->right; q->right = p; } p->balance = q->balance = 0; if(tos != 0) { if(pathInfo[tos-1] == 1) { stack[tos-1]->right = q; } else { stack[tos-1]->left = q; } } else { this->root = q; } break; } else { if(tos + 2 != stackN) { r = stack[tos + 2]; } else { r = x; } if(pathInfo[tos] == 1) { q->left = r->right; p->right = r->left; r->right = q; r->left = p; if(r->balance == 1) { p->balance = -1; q->balance = 0; } else if(r->balance == -1) { p->balance = 0; q->balance = 1; } else { p->balance = q->balance = 0; } } else { q->right = r->left; p->left = r->right; r->left = q; r->right = p; if(r->balance == 1) { p->balance = 0; q->balance = -1; } else if(r->balance == -1) { p->balance = 1; q->balance = 0; } else { p->balance = q->balance = 0; } } r->balance = 0; if(tos != 0) { if(pathInfo[tos-1] == 1) { stack[tos-1]->right = r; } else { stack[tos-1]->left = r; } } else { this->root = r; } break; } } } } return res; } static void *findAvl(AvlTree *this, void *item) { int (* compar)(const void *, const void *); int cmpres; AvlNode *p, *nextP; if((nextP = this->root)) { compar = this->compar; do { p = nextP; cmpres = compar(item, p->item); if(cmpres < 0) { nextP = p->left; } else if(cmpres > 0) { nextP = p->right; } else { return p->item; } } while(nextP); } return NULL; } void *findMinAvl(AvlTree *this) { AvlNode *p, *nextP; if((nextP = this->root)) { do { p = nextP; nextP = p->left; } while(nextP); } else { return NULL; } return p->item; } static void *deleteAvl(AvlTree *this, void *item) { void *res; int (* compar)(const void *, const void *); int cmpres; AvlNode *p, *prevP; AvlNode *m, *prevM; AvlNode *q, *r; AvlNode **stack; int tos, stackP; signed char *pathInfo; if(!(p = this->root)) return NULL; compar = this->compar; stack = this->stack; pathInfo = this->pathInfo; tos = 0; for(;;) { cmpres = compar(item, p->item); if(cmpres < 0) { pathInfo[tos] = -1; stack[tos++] = p; p = p->left; } else if(cmpres > 0) { pathInfo[tos] = 1; stack[tos++] = p; p = p->right; } else { break; } if(!p) { return NULL; } } if(!p->left) { if(tos == 0) { this->root = p->right; } else { prevP = stack[tos-1]; if(p == prevP->left) { prevP->left = p->right; } else { prevP->right = p->right; } } } else if(!p->right) { if(tos == 0) { this->root = p->left; } else { prevP = stack[tos-1]; if(p == prevP->left) { prevP->left = p->left; } else { prevP->right = p->left; } } } else { pathInfo[tos] = 1; stack[tos] = p; stackP = tos++; m = p->right; do { pathInfo[tos] = -1; stack[tos++] = m; m = m->left; } while(m); m = stack[--tos]; if(stackP == 0) { this->root = m; } else { prevP = stack[stackP - 1]; if(p == prevP->left) { prevP->left = m; } else { prevP->right = m; } } prevM = stack[tos-1]; if(prevM != p) { prevM->left = m->right; m->right = p->right; } m->left = p->left; m->balance = p->balance; stack[stackP] = m; } res = p->item; free(p); this->n--; while(tos) { p = stack[--tos]; if(p->balance == 0) { p->balance -= pathInfo[tos]; break; } else { p->balance -= pathInfo[tos]; if(p->balance != 0) { if(pathInfo[tos] == 1) { q = p->left; } else { q = p->right; } if(pathInfo[tos] != q->balance) { if(pathInfo[tos] != 1) { p->right = q->left; q->left = p; } else { p->left = q->right; q->right = p; } if(tos != 0) { if(pathInfo[tos-1] == 1) { stack[tos-1]->right = q; } else { stack[tos-1]->left = q; } } else { this->root = q; } if(q->balance == 0) { p->balance = p->balance > 0 ? 1 : -1; q->balance = -p->balance; break; } else { p->balance = q->balance = 0; } } else { if(pathInfo[tos] != 1) { r = q->left; q->left = r->right; p->right = r->left; r->right = q; r->left = p; if(r->balance == 1) { p->balance = -1; q->balance = 0; } else if(r->balance == -1) { p->balance = 0; q->balance = 1; } else { p->balance = q->balance = 0; } } else { r = q->right; q->right = r->left; p->left = r->right; r->left = q; r->right = p; if(r->balance == 1) { p->balance = 0; q->balance = -1; } else if(r->balance == -1) { p->balance = 1; q->balance = 0; } else { p->balance = q->balance = 0; } } r->balance = 0; if(tos != 0) { if(pathInfo[tos-1] == 1) { stack[tos-1]->right = r; } else { stack[tos-1]->left = r; } } else { this->root = r; } } } } } return res; } static void *deleteMinAvl(AvlTree *this) { void *res; AvlNode *p; AvlNode *q, *r; AvlNode **stack; int tos; stack = this->stack; tos = 0; if((p = this->root)) { do { stack[tos++] = p; p = p->left; } while(p); p = stack[--tos]; } else { return NULL; } if(tos == 0) { this->root = p->right; } else { stack[tos-1]->left = p->right; } res = p->item; free(p); this->n--; while(tos) { p = stack[--tos]; if(p->balance == 0) { p->balance++;; break; } else { p->balance++; if(p->balance != 0) { q = p->right; if(q->balance != -1) { p->right = q->left; q->left = p; if(tos != 0) { stack[tos-1]->left = q; } else { this->root = q; } if(q->balance == 0) { p->balance = 1; q->balance = -1; break; } else { p->balance = q->balance = 0; } } else { r = q->left; q->left = r->right; p->right = r->left; r->right = q; r->left = p; if(r->balance == 1) { p->balance = -1; q->balance = 0; } else if(r->balance == -1) { p->balance = 0; q->balance = 1; } else { p->balance = q->balance = 0; } r->balance = 0; if(tos != 0) { stack[tos-1]->left = r; } else { this->root = r; } } } } } return res; } --- NEW FILE: avltree.h --- /* * avltree.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Sebastian Seyrich <se...@de...> * * Description: * AVL-Tree Datatype * * * */ #ifndef AVL_H #define AVL_H #define AVL_STACK_SIZE 1000 struct avlTree; typedef struct avlTree AvlTree; struct avlNode; typedef struct avlNode AvlNode; typedef struct avlNode { void *item; struct avlNode *left, *right; signed char balance; }; typedef struct avlTree { AvlNode *root; int n; int (* compar)(const void * a, const void *b); AvlNode **stack; void (*free)(AvlTree **this); void* (*insert)(AvlTree *this, void *item); void* (*find)(AvlTree *this, void *item); void* (*findMin)(AvlTree *this); void* (*delete)(AvlTree *this, void *item); void* (*deleteMin)(AvlTree *this); signed char *pathInfo; }; AvlTree *newAvlTree(int (* compar)(const void *, const void *)); #endif Index: sfcBroker.c =================================================================== RCS file: /cvsroot/sblim/sfcb/sfcBroker.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- sfcBroker.c 29 Apr 2005 11:35:31 -0000 1.11 +++ sfcBroker.c 3 Jun 2005 10:31:57 -0000 1.12 @@ -306,6 +306,32 @@ return 0; } + +extern int dbpDaemon(int argc, char *argv[], int sslMode, int sfcbPid); +int startDbpd(int argc, char *argv[], int sslMode) +{ + int pid,sfcPid=currentProc; + //sleep(2); + pid= fork(); + if (pid < 0) { + perror("dbpd fork"); + exit(2); + } + if (pid == 0) { + currentProc=getpid(); + dbpDaemon(argc, argv, sslMode, sfcPid); + closeSocket(&sfcbSockets,cRcv,"startHttpd"); + closeSocket(&resultSockets,cAll,"startHttpd"); + } + else { + addStartedAdapter(pid); + return 0; + } + return 0; +} + + + int main(int argc, char *argv[]) { int c, i; @@ -435,6 +461,15 @@ startHttpd(argc, argv,0); } + //Start dbProtocol-Daemon + if (startHttp) { + if (sslMode) + startDbpd(argc, argv,1); + if (!sslOMode) + startDbpd(argc, argv,0); + } + + setSignal(SIGSEGV, handleSigSegv,SA_ONESHOT); setSignal(SIGCHLD, handleSigChld,0); Index: sfcVersion.h =================================================================== RCS file: /cvsroot/sblim/sfcb/sfcVersion.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- sfcVersion.h 9 Mar 2005 12:25:14 -0000 1.1.1.1 +++ sfcVersion.h 3 Jun 2005 10:31:57 -0000 1.2 @@ -28,11 +28,13 @@ #define sfcBrokerVersion PACKAGE_VERSION #define sfcHttpDaemonVersion PACKAGE_VERSION +#define sfcdbpDaemonVersion "0.1.0" #else /* this should never be used - but who knows */ #define sfcBrokerVersion "0.8.1" #define sfcHttpDaemonVersion "0.8.1" +#define sfcdbpDaemonVersion "0.1.0" #endif --- NEW FILE: sqlParser.y --- /* **============================================================================== ** ** Includes ** **============================================================================== */ %{ /* * sqlParser.y * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. [...1669 lines suppressed...] %% static UtilList* cloneAL(){ UtilList * res = newList(); int i; ExpressionLight* exl; for(exl = (ExpressionLight*)assignmentList->ft->getFirst(assignmentList);exl;exl = (ExpressionLight*)assignmentList->ft->getNext(assignmentList)){ res->ft->append(res,newExpressionLight(exl->name,UNDEF,NULL)); } return res; } static char* semanticError(char* s1, char* s2, char* s3){ char *message = (char *) malloc(strlen(s1)+strlen(s2)+strlen(s3)+1); strcpy(message,s1); strcat(message,s2); strcat(message,s3); return message; } //int main() {printf("hm\n");return yyparse(); } Index: providerMgr.c =================================================================== RCS file: /cvsroot/sblim/sfcb/providerMgr.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- providerMgr.c 30 May 2005 01:32:24 -0000 1.10 +++ providerMgr.c 3 Jun 2005 10:31:57 -0000 1.11 @@ -1287,3 +1287,5 @@ _SFCB_RETURN(ul); } + + Index: configure.ac =================================================================== RCS file: /cvsroot/sblim/sfcb/configure.ac,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- configure.ac 27 Apr 2005 11:53:13 -0000 1.10 +++ configure.ac 3 Jun 2005 10:31:57 -0000 1.11 @@ -21,7 +21,7 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(Small Footprint CIM Broker, 0.8.8, sc...@de..., sblim-sfcb) +AC_INIT(Small Footprint CIM Broker, 0.8.9, sc...@de..., sblim-sfcb) AC_CONFIG_SRCDIR([providerDrv.c]) AM_INIT_AUTOMAKE --- NEW FILE: sqlStatement.h --- /* * sqlStatement.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Sebastian Seyrich <se...@de...> * * Description: * * * * */ #include "utilft.h" //#include "cimXmlParser.h" //Provider operationen //#include "cmpidt.h" //#include "objectImpl.h" //#include "cmpimacs.h" //#include "genericlist.h" #include "avltree.h" #define DEFAULTDB "root/cimv2" /* SqlStatement.type: */ #define SELECT 0 #define INSERT 1 #define UPDATE 2 #define DELETE 3 #define CREATE 4 #define DROP 5 #define CALL 6 #define SUB 10 #define FUL 11 #define INITFUL 12 #define SIGMA 13 //#define FINISHFS 14 #define INSTUPEL 14 #define PRJ 20 #define ALL 21 #define DIST 22 #define ASC 30 #define DSC 31 #define UNION 50 #define UNIONALL 51 #define EXCEPT 52 #define EXCEPTALL 53 #define INTERSECT 54 #define INTERSECTALL 55 #define PLUS 60 //#define SUB 61 #define MUL 62 #define DIV 63 //assignment String #define ASS 64 //assignment Number #define ASN 65 #define CONCAT 66 #define EQ 71 #define NOT 70 #define NE 72 #define GT 73 #define LT 74 #define GE 75 #define LE 76 #define AND 80 #define OR 81 #define ISNULL 82 #define NOTNULL 83 #define BETWEEN 84 #define NOTBETWEEN 85 #define INNER 90 #define LEFT 91 #define RIGHT 92 #define FULL 93 #define EMPTY 100 #define KEY 101 #define NKEY 102 #define UNDEF -1 #define OK 1 //falls die Anzahl der Spalten der verschiedenen Spalten ungleich ist #define CCOUNTERR 2000 //die erste Spalte, die nicht vereingbar ist. die mod 2000 999 Stellen codieren die Spaltennr #define CDEFERR 3000 struct sqlWarning; typedef struct sqlWarning SqlWarning; struct resultSet; typedef struct resultSet ResultSet; struct sqlStatement; typedef struct sqlStatement SqlStatement; struct fullSelect; typedef struct fullSelect FullSelect; struct subSelect; typedef struct subSelect SubSelect; struct projection; typedef struct projection Projection; struct column; typedef struct column Column; struct selection; typedef struct selection Selection; struct crossJoin; typedef struct crossJoin CrossJoin; struct row; typedef struct row Row; struct classDef; typedef struct classDef ClassDef; struct order; typedef struct order Order; struct sigma; typedef struct sigma Sigma; struct expressionLight; typedef struct expressionLight ExpressionLight; struct updIns; typedef struct updIns UpdIns; struct insert; typedef struct insert Insert; struct updIns { char * tname; UtilList * colList; UtilList * assignmentList; UtilList * where; void (*free)(); }; struct insert { char * tname; FullSelect* fs; UtilList * tupelList; void (*free)(); }; struct expressionLight { int op; int sqltype; char * name; char * value; void (*free)(); }; struct classDef { int fieldCount; char * className; UtilList * fieldNameList; //Columns stecken da drin int fNameLength; char * superclass; char * description; }; struct sqlWarning { char* sqlstate; char* reason; void (*setWarning)(); void (*free)(); }; struct resultSet { SqlWarning *sw; char* query; char* meta; char* tupel; void (*setWarning)(ResultSet *this, char* s, char *r); void (*addMeta)(ResultSet *this, Projection* prj); int (*addSet)(ResultSet *this, FullSelect* fs); void (*free)(); }; struct sqlStatement { int type;//select, insert, update... ResultSet* rs; void* stmt; char* db;//namespace //int currentType; UtilList* cnode; FullSelect * lasttos;//um Sigma in fs einfügen zu können. wenn der parser das sigma erstellt hat ist aber setB schon gefüllt und das aktuelle fs schon vom stack genommen. //void* clipboard; //int prevType; //void* prevnode; void (*free)(); //void (*setClipBoard)(SqlStatement* this, void * value); //void* (*getClipBoard)(SqlStatement* this); int (*addNode)(SqlStatement* this, int type, void * value); int (*calculate)(); }; struct fullSelect { void* setA; int typeA;//fullselect oder subselect int type; //UNION, EXCEPT, ... Projection *pi;//hier wird eine Referenz auf eines der Subselects //gespeichert zum schnellen Vergleich, ob die weiteren //Subselects konform dazu sind! void* setB; Selection *sigma; int typeB; void (*free)(); AvlTree* (*calculate)(); }; struct subSelect { Projection* pi; Selection* sigma; CrossJoin* cross; int isSet; AvlTree* set; char* setName; char* aliasName; void (*free)(); void (*addNode)(SubSelect* this,int type, void* value); void (*addWhereList)(SubSelect* this, UtilList *ul); AvlTree* (*calculate)(); }; struct projection { int mode;//ALL, DISTINKT //Könnte auch in Selection passen?? //int colCount; void (*free)(); UtilList* col; }; struct column { char* tableName; char* tableAlias; char* colName; char* colAlias; int colSQLType; int isKey; char *description; void (*free)(); }; struct selection { int fetchFirst; //oderBy und fetch first sind nicht wirklich eigenschaften //dieses objekts, allerdings passen sie hier dazu. UtilList *orderBy; UtilList * where; void (*free)(); }; struct crossJoin { SubSelect* setA; SubSelect* setB; int type; void (*free)(); AvlTree* (*calculate)(); }; struct order{ int column; int order; int colSQLType; void (*free)(); }; struct row { char** row; int doublette;//hack. da avl-baum doubletten nicht unterstützt int size; Selection * sigma; void (*free)(); }; struct sigma{ int link; //AND OR int op; //== != < ... Column* colA; char* value; //mit was der wert verglichen werden soll char* valueB;//falls joinbedingung, oder between (dann steht hier der zweite wert, daher auch double...) Column* colB; void (*negate)(Sigma* this); void (*free)(); }; ResultSet* newResultSet(char* query); SqlStatement* newSqlStatement(int type, ResultSet* rs); FullSelect* newFullSelect(); SubSelect* newSubSelect(); SubSelect* newSubSelectC(SubSelect* sbsA,SubSelect* sbsB, int type); Projection* newProjection(int mode, UtilList* ul); Column* newColumn(char* tableName,char* tableAlias, char* colName, char* colAlias, int colSQLType,int isKey); Selection* newSelection(UtilList* orderBy, int fetchFirst); CrossJoin* newCrossJoin(SubSelect* sbsA,SubSelect* sbsB, int type); Row* newRow(int size); Order *newOrder(int nr, int type, int order); Sigma* newSigmachar(Column* colA, int op,char* value, Column* colB,char* valueB); ExpressionLight* newExpressionLight(char* name, int op,char* value); UpdIns* newUpdIns(char* tname, UtilList* colList,UtilList* assignmentList,UtilList* where); Insert* newInsert(char* tname); ClassDef* newClassDef(int fieldCount, char * className, UtilList * fieldNameList, int fNameLength, char * superclass); //int item_cmp(const void *item1, const void *item2); //char* type2sqlString(int type); //char * int2String(int v) Index: httpAdapter.c =================================================================== RCS file: /cvsroot/sblim/sfcb/httpAdapter.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- httpAdapter.c 9 May 2005 16:24:18 -0000 1.8 +++ httpAdapter.c 3 Jun 2005 10:31:57 -0000 1.9 @@ -415,7 +415,6 @@ int i,len,ls[8]; char str[256]; RespSegments rs; - _SFCB_ENTER(TRACE_HTTPDAEMON, "writeChunkResponse"); switch (ctx->chunkedMode) { case 1: @@ -518,6 +517,7 @@ writeChunkResponse, }; + #undef PrintF static void getHdrs(CommHndl conn_fd, Buffer * b) --- NEW FILE: dbpAdapter.c --- /* * dbpAdapter.c * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Sebastian Seyrich <se...@de...> * * Description: * * * * */ #include <unistd.h> #include <stdlib.h> #include <stdarg.h> #include <stdio.h> #include <string.h> #include <limits.h> #include <errno.h> #include <fcntl.h> #include <signal.h> #include <ctype.h> #include <time.h> #include <sys/wait.h> #include <sys/socket.h> #include <netdb.h> #include "msgqueue.h" #include "utilft.h" #include "trace.h" #include "cimXmlRequest.h" //#include "cimXmlParser.h" #include "queryOperation.h" #include <pthread.h> #include <semaphore.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> #include "httpComm.h" #include "sfcVersion.h" #include "sqlStatement.h" #include "control.h" //unsigned long exFlags = 0; static char *name; int sfcbSSLMode = 0; static int doFork = 0; static int doBa; int noChunking = 0; static int dbpProcSem; static int dbpWorkSem; static int running=0; static int debug; extern char * configfile; static int stopAccepting=0; static int hBase; static int hMax; static int dbpProcId; #define PROTOCOL 1 #define SQL 2 #define META 3 #define SPOOLIN 4 #define SPOOLOUT 5 //Meta Parameter #define METADB 1 #define TABLES 2 #define STABLES 3 #define KEYS 4 #define COLS 5 //Protokoll Parameter #define LOGOUT 2 #define CONNECT 1 #define HEADER 2 #define CONTINUE 0 #define test 1 //#define printd(x) if(test) printf("%s",x) #define printd(...) if(test) printf(__VA_ARGS__) static const char *metaDB = "version=0.1;name=sfcb;maxcon=1000;mathfunc=keine,nochnich;sqlkeywords=selbe,wie,in,db2;sqlstate=nochnichtstandartisiert;stringfunc=comma,list;systemfunc=noch,nichts;datetimefunc=noch,nichts$$\n"; static key_t dbpProcSemKey; static key_t dbpWorkSemKey; static int dbpProcSem; static int dbpWorkSem; extern int setupControl(char *); extern int getControlNum(char *id, long *val); extern int getControlBool(char *id, int *val); extern int semGetValue(int semid, int semnum); void initDbpProcCtl(int p) { dbpProcSemKey=ftok(".",'D'); dbpWorkSemKey=ftok(".",'E'); char emsg[256]; union semun sun; int i; printf("--- Max dbp procs: %d\n",p); if ((dbpProcSem=semget(dbpProcSemKey,1,0666))!=-1) semctl(dbpProcSem,0,IPC_RMID,sun); if ((dbpProcSem=semget(dbpProcSemKey,1+p,IPC_CREAT | 0666))==-1) { sprintf(emsg,"Dbp Proc semaphore create %d",getpid()); perror(emsg); abort(); } sun.val=p; semctl(dbpProcSem,0,SETVAL,sun); sun.val=0; for (i=1; i<=p; i++) semctl(dbpProcSem,p,SETVAL,sun); if ((dbpWorkSem=semget(dbpWorkSemKey,1,0666))!=-1) semctl(dbpWorkSem,0,IPC_RMID,sun); if ((dbpWorkSem=semget(dbpWorkSemKey,1,IPC_CREAT | 0666))==-1) { sprintf(emsg,"Dpb ProcWork semaphore create %d",getpid()); perror(emsg); abort(); } sun.val=1; semctl(dbpWorkSem,0,SETVAL,sun); } char* processSQLQuery(char *query,CommHndl conn_fd){ int stat = 0; char *res = NULL; ResultSet *rs; //printf("1\n"); rs = parseSql(query,&stat); if(!stat){ printd("Parsen erfolgreich\n"); res = (char *) malloc(strlen(rs->meta)+strlen(rs->tupel)+strlen(rs->sw->reason)+strlen(rs->sw->sqlstate)+4+1+3+3+3+1); strcpy(res,"2 1\n"); strcat(res,rs->sw->sqlstate); strcat(res,";"); strcat(res,rs->sw->reason); strcat(res,"$$\n"); strcat(res,rs->meta); strcat(res,"$$\n"); strcat(res,rs->tupel); strcat(res,"$$\n"); } else{ printd("Parse Error %d!!\n",stat); printd("###%s \n###%s!!\n",rs->sw->reason,rs->sw->sqlstate); res = (char *) malloc(strlen(rs->sw->reason)+strlen(rs->sw->sqlstate)+4+1+3+1);printd("Parse Error 2!!\n"); strcpy(res,"2 0\n"); strcat(res,rs->sw->sqlstate); strcat(res,";"); strcat(res,rs->sw->reason); strcat(res,"$$\n"); //printd("Parse Error 2!!\n"); } //printf("return...\n"); return res; } //CommHndl conn_fd; /* * S E M A P H O R E */ static void handleDbpSession(int connFd) { CommHndl conn_fd; struct sembuf procReleaseUnDo = {0,1,SEM_UNDO}; int r,b2,c, by=0, h, sqlStat; char buffer[1024],bc[1]; char buffer2[500]; char *response=NULL; //Fehlermeldung reinschreiben und an Client zurückschicken. //Vermutlich später nicht mehr notwendig!! char *header=NULL;char *payload; int nbytes; ResultSet *rs; _SFCB_ENTER(TRACE_DBPDAEMON, "handledbpRequest"); _SFCB_TRACE(1, ("--- Forking sql handler")); printf("dbpProcSem %p dbpProcId: %d hMax: %d doFork: %d\n",dbpProcSem,dbpProcId,hMax,doFork); printf("dbpProcId: %d hMax: %d doFork: %d\n",dbpProcId,hMax,doFork); if (doFork) { semAcquire(dbpWorkSem,0); semAcquire(dbpProcSem,0); for (dbpProcId=0; dbpProcId<hMax; dbpProcId++) if (semGetValue(dbpProcSem,dbpProcId+1)==0) break; printf("dbpProcId: %d hMax: %d\n",dbpProcId,hMax); procReleaseUnDo.sem_num=dbpProcId+1; r = fork(); if (r==0) { currentProc=getpid(); processName="CIMSQL-Processor"; semRelease(dbpProcSem,0); semAcquireUnDo(dbpProcSem,0); semReleaseUnDo(dbpProcSem,dbpProcId+1); semRelease(dbpWorkSem,0); if (sfcbSSLMode) { #if defined USE_SSL conn_fd.socket=-2; conn_fd.bio=BIO_new(BIO_s_socket()); BIO_set_fd(conn_fd.bio,connFd,BIO_CLOSE); if (!(conn_fd.ssl = SSL_new(ctx))) intSSLerror("Error creating SSL context"); SSL_set_bio(conn_fd.ssl, conn_fd.bio, conn_fd.bio); if (SSL_accept(conn_fd.ssl) <= 0) intSSLerror("Error accepting SSL connection"); #endif } else { conn_fd.socket=connFd; #if defined USE_SSL conn_fd.bio=NULL; conn_fd.ssl=NULL; #endif } } else if (r>0) { running++; _SFCB_EXIT(); } } else r = 0; if (r < 0) { char *emsg=strerror(errno); mlogf(M_ERROR,M_SHOW,"--- fork handler: %s\n",emsg); exit(1); } if (r == 0) { if (doFork) { _SFCB_TRACE(1,("--- Forked sql handler %d", currentProc)) resultSockets=sPairs[hBase+dbpProcId]; } _SFCB_TRACE(1,("--- Started sql handler %d %d", currentProc, resultSockets.receive)); if (getenv("SFCB_PAUSE_HTTP")) for (;;) { fprintf(stderr,"-#- Pausing - pid: %d\n",currentProc); sleep(5); } conn_fd.socket=connFd; #if defined USE_SSL conn_fd.bio=NULL; conn_fd.ssl=NULL; #endif for(;;){ //c onn_fd.socket=connFd; // doHttpRequest(conn_fd); nbytes = read (connFd, buffer, HEADER); header = (char *) malloc(nbytes);//sowas wie \n Steuerzeichen strncpy(header,buffer,nbytes); header[nbytes]=0; h = atoi(header); printd("Ein Client h: %d header: %s nbytes: %d\n",h,header,nbytes); //Sonderfall, noch nicht eingeloggt if(by&h){ //login nbytes = read(connFd, buffer, 2); c = atoi(&buffer); if(c==CONNECT){ printd("Ein Client hat sich korrekt angemeldet\n"); response = "1 1 1\n";//"Sie sind angemeldet. Warte auf Anfragen:\n"; write(connFd, response , strlen(response)); by=0; h=CONTINUE;//dummy, um switch sofort zu verlassen } else{ printd("Ein Client hat sich NICHT korrekt angemeldet %d\n",c); response = "1 1 0\n";//"Sie sind nicht angemeldet. Auf wiedersehen.\n"; write(connFd, response , strlen(response)); break; } while((nbytes = read(connFd, bc, 1))>0)// if(bc[0]=='\n') break; } if(by){ printd("Ein Client hat sich NICHT korrekt angemeldet %d\n",h); response = "1 1 0\n";//"Sie sind nicht angemeldet. Auf wiedersehen.\n"; write(connFd, response , strlen(response)); break; } switch(h){ case CONTINUE: break; case PROTOCOL: { nbytes = read(connFd, buffer, 2); c = atoi(&buffer); //Pipe leersaugen while((nbytes = read(connFd, bc, 1))>0)// if(bc[0]=='\n') break; if(c==CONNECT){ response = "1 1 0\n"; //"Sie sind bereits angemeldet, Operation wird ignoriert:\n"; write(connFd, response , strlen(response)); } else if(c==LOGOUT){ printd("Der Client hat die Verbindung beendet\n"); response = "1 2 1\n";//"By\n"; write(connFd, response ,strlen(response)); by=1; } else{ b2 = sprintf("%d %d %d",1,c,0);//sprintf(buffer2, "Syntxfehler: Operation %d ist keine Protokolloperation\n",c); printd("%s",buffer2); write(connFd, buffer2 , b2); } break; } case SQL: while((nbytes = read(connFd, buffer, 1024))>0){ if(buffer[nbytes-1]=='\n') break; //falls Anweisung laenerg als 1024, muss buffer mit vorgaengerbuffer konkadiniert werden. vgl. adrian } // abschlieÃendes $ finden: //printd("SQL: %d\n",nbytes); nbytes--; while((nbytes>0) && (buffer[nbytes]!='$')) nbytes--; //printf("malloc %d bytes",nbytes); payload = (char *) malloc(nbytes+1+1); //ein \n voranstellen, yyerror()s wegen //*payload = '\n'; strcpy(payload,"\n"); strncat(payload,buffer,nbytes); response = processSQLQuery(payload,conn_fd); //--> Datenstruktur, in die das Statement reinkommt free(payload);payload=NULL; //ResultMetaData write(connFd, response , strlen(response)); free(response);response=NULL; break; case META: nbytes = read(connFd, buffer, 2); c = atoi(&buffer); if(c==METADB){ response = (char *) malloc(strlen(metaDB)+7); response = strcpy(response,"3 1 1\n"); response = strcat(response,metaDB); write(connFd, response , strlen(response)); free(response); break; } if(c==TABLES||c==STABLES||c==KEYS||c==COLS){ printf("UND los\n"); while((nbytes = read(connFd, buffer, 1024))>0){ if(buffer[nbytes-1]=='\n') break; //falls Anweisung laenerg als 1024, muss buffer mit vorgaengerbuffer konkadiniert werden. vgl. adrian } // abschlieÃendes $ finden: printd("SQL: %d\n",nbytes); nbytes--; while((nbytes>0) && (buffer[nbytes]!='$')) nbytes--; //printf("malloc %d bytes",nbytes); buffer[nbytes] = 0; if(nbytes==0) payload = NULL; else{ payload = (char *) malloc(nbytes+1); strcpy(payload,buffer); //printd(">%s< %d\n",payload,c); } if(c==TABLES) response = processMetaTables(payload,"root/cimv2"); else if(c==STABLES) response = processSuperTables(payload,"root/cimv2"); else if(c==KEYS) response = processKeyTable(payload,"root/cimv2"); else if(c==COLS){ char *arg2 = strstr(payload,"::"); char *arg1 = strtok(payload,"::"); //printf("lllllll\n"); //printf(">%s< >%s< >%s< >%s<\n",payload,arg2,arg1,arg2+2); response = processMetaColumns(arg1,arg2+2,"root/cimv2"); //printf("zurück\n"); } //printf(">>%s<<",response); free(payload);payload=NULL; write(connFd, response , strlen(response)); //free(response); //dieses free tut nicht, weil irgendwo anders was nicht stimmt!!! break; } break; case SPOOLIN: break; case SPOOLOUT: break; default: printd("Unbekannter Befehl: \"%s\"\n",header); b2 = sprintf(buffer2,"Fehler: unbekannter Befehl: %s \n", header); //strncpy(response,buffer2,b2); //response = "Fehler: Unbekannter Befehl\n"; write(connFd, buffer2 , b2); break; } free(header); if(by) break; } if (!doFork) return; _SFCB_TRACE(1, ("--- SQL handler exiting %d", currentProc)); printf("--- SQL handler exiting %d\n", currentProc); dumpTiming(currentProc); exit(0); } } /*kopiert!!*/ static void handleSigChld(int sig) { const int oerrno = errno; pid_t pid; int status; for (;;) { pid = wait4(0, &status, WNOHANG, NULL); if ((int) pid == 0) break; if ((int) pid < 0) { if (errno == EINTR || errno == EAGAIN) { // fprintf(stderr, "pid: %d continue \n", pid); continue; } if (errno != ECHILD) perror("child wait"); break; } else { running--; fprintf(stderr, "%s: SIGCHLD signal %d - %s(%d)\n", name, pid, __FILE__, __LINE__); } } errno = oerrno; } static void handleSigUsr1(int sig) { stopAccepting=1; fprintf(stderr, "%s: handleSigUsr1 signal %d - %s(%d)\n", name,sig, __FILE__, __LINE__); } /* * Von httpDaemon aus httpAdapter abgeschrieben. * */ int dbpDaemon(int argc, char *argv[], int sslMode, int sfcbPid) {//int argc, char *argv[], int sslMode) { struct sockaddr_in sin; int sz,i,sin_len,ru; char *cp; long procs, port; int listenFd, connFd; name = argv[0]; debug = 1; doFork = 1; _SFCB_ENTER(TRACE_DBPDAEMON, "dbpDaemon"); setupControl(configfile); sfcbSSLMode=sslMode; if (sslMode) processName="DBPS-Daemon"; else processName="DBP-Daemon"; if (sslMode) { if (getControlNum("dbpsPort", &port)) port = 5981; hBase=stBase; hMax=stMax; } else { if (getControlNum("dbpPort", &port)) port = 5980; hBase=htBase; hMax=htMax; } if (getControlNum("dbpProcs", &procs)) procs = 10; initDbpProcCtl(procs); // if (getControlBool("doBasicAuth", &doBa)) // doBa=0; // // i = 1; // while (i < argc && argv[i][0] == '-') { // if (strcmp(argv[i], "-D") == 0) // debug = 1; // else if (strcmp(argv[i], "-nD") == 0) // debug = 0; // else if (strcmp(argv[i], "-p") == 0 && i + 1 < argc) { // ++i; // port = (unsigned short) atoi(argv[i]); // } // else if (strcmp(argv[i], "-tm") == 0) { // if (isdigit(*argv[i + 1])) { // ++i; // } // } // else if (strcmp(argv[i], "-F") == 0) // doFork = 1; // else if (strcmp(argv[i], "-nF") == 0) // doFork = 0; // else if (strcmp(argv[i], "-H") == 0); // ++i; // } // // if (getControlBool("useChunking", &noChunking)) // noChunking=0; // noChunking=noChunking==0; cp = strrchr(name, '/'); if (cp != NULL) ++cp; else cp = name; name = cp; if (sslMode) mlogf(M_INFO,M_SHOW,"--- %s DBPS Daemon V" sfcdbpDaemonVersion " started - %d - port %ld\n", name, currentProc,port); else mlogf(M_INFO,M_SHOW,"--- %s DBP Daemon V" sfcdbpDaemonVersion " started - %d - port %ld\n", name, currentProc,port); if (doBa) mlogf(M_INFO,M_SHOW,"--- Using Basic Authentication\n"); listenFd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); sin_len = sizeof(sin); ru = 1; setsockopt(listenFd, SOL_SOCKET, SO_REUSEADDR, (char *) &ru, sizeof(ru)); bzero(&sin, sin_len); sin.sin_family = AF_INET; sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons(port); if (bind(listenFd, (struct sockaddr *) &sin, sin_len) || listen(listenFd, 0)) { mlogf(M_ERROR,M_SHOW,"--- Cannot listen on port %ld\n", port); kill(sfcbPid,3); } if (!debug) { int rc = fork(); if (rc == -1) { char *emsg=strerror(errno); mlogf(M_ERROR,M_SHOW,"--- fork daemon: %s",emsg); exit(1); } else if (rc) exit(0); } // memInit(); currentProc=getpid(); setSignal(SIGCHLD, handleSigChld,0); setSignal(SIGUSR1, handleSigUsr1,0); setSignal(SIGINT, SIG_IGN,0); setSignal(SIGTERM, SIG_IGN,0); setSignal(SIGHUP, SIG_IGN,0); // commInit(); #if defined USE_SSL if (sfcbSSLMode) { char *fnc,*fnk; ctx = SSL_CTX_new(SSLv23_method()); getControlChars("sslCertificateFilePath", &fnc); if (SSL_CTX_use_certificate_chain_file(ctx, fnc) != 1) intSSLerror("Error loading certificate from file"); getControlChars("sslKeyFilePath", &fnk); if (SSL_CTX_use_PrivateKey_file(ctx, fnk, SSL_FILETYPE_PEM) != 1) intSSLerror("Error loading private key from file"); } #endif for (;;) { char *emsg; listen(listenFd, 1); sz = sizeof(sin); if ((connFd = accept(listenFd, (__SOCKADDR_ARG) & sin, &sz))<0) { if (errno == EINTR || errno == EAGAIN) { if (stopAccepting) break; continue; } emsg=strerror(errno); mlogf(M_ERROR,M_SHOW,"--- accept error %s\n",emsg); _SFCB_ABORT(); } _SFCB_TRACE(1, ("--- Processing dbp request")); handleDbpSession(connFd); close(connFd); } printf("--- %s draining %d\n",processName,running); for (;;) { if (running==0) { mlogf(M_INFO,M_SHOW,"--- %s terminating %d\n",processName,getpid()); exit(0); } sleep(1); } /* struct sockaddr_in sin; int sz,i,sin_len,ru; char *cp;//?? long procs, port; int listenFd, connFd; name = "sfcBroker"; //debug = 1; //doFork = 1; _SFCB_ENTER(TRACE_DBPDAEMON, "dbpDaemon"); //setupControl(NULL); processName="DBP Daemon"; //Variable aus sfcBroker, dieser neue Prozess hat noch keinen zugewiesen bekommen //if (getControlNum("httpPort", &port)) port = 5980; //hBase=htBase; //hMax=htMax; //initndpProcCtl(procs); cp = strrchr(name, '/'); if (cp != NULL) ++cp; else cp = name; name = cp; printf("--- %s DBP Daemon V" sfcdbpDaemonVersion " started - %d - port %ld\n", name, getpid(),port); listenFd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); sin_len = sizeof(sin); ru = 1; setsockopt(listenFd, SOL_SOCKET, SO_REUSEADDR, (char *) &ru, sizeof(ru)); bzero(&sin, sin_len); sin.sin_family = AF_INET; sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons(port); if (bind(listenFd, (struct sockaddr *) &sin, sin_len) || listen(listenFd, 0)) {//Test, ob Port frei ist printf("cannot listen on port %ld", port); exit(3); } //if (!debug) { int rc = fork(); if (rc == -1) { perror("fork daemon"); exit(1); } else if (rc) exit(0); //} // memInit(); //printf("jetzt kann sich jemand verbinden\n"); // setSignal(SIGCHLD, handleSigChld,0); for (;;) { listen(listenFd, 1); sz = sizeof(sin); if ((connFd = accept(listenFd, (__SOCKADDR_ARG) & sin, &sz))<0) { if (errno == EINTR || errno == EAGAIN) continue; perror("accept error"); // _SFCB_ABORT(); } _SFCB_TRACE(1, ("--- Processing dbp request")); printd("es hat sich glaub ich jemand verbunden\n"); handleDbpSession(connFd); close(connFd); } */ } --- NEW FILE: sqlStatement.c --- #include "sqlStatement.h" #include "utilft.h" #include "cimXmlParser.h" //Provider operationen #include "cmpidt.h" #include "objectImpl.h" #include "cmpimacs.h" #include <stdio.h> #include <string.h> #include <malloc.h> #define SbS sbs = (SubSelect*)this->cnode; sbs #define FS fs = (FullSelect*)this->cnode; fs #define FREE(zgr){ \ [...3288 lines suppressed...] rs->addSet(rs,t);//mussvor addMeta ausgefuhert werden, da hier pi bei joins geandert wird rs->addMeta(rs,pi); rs->sw->reason = "Successful Completion"; rs->sw->sqlstate = "0000000"; char * res = (char *) malloc(strlen(rs->meta)+strlen(rs->tupel)+strlen(rs->sw->reason)+strlen(rs->sw->sqlstate)+4+1+3+3+3+1); strcpy(res,"3 4 1\n"); strcat(res,rs->sw->sqlstate); strcat(res,";"); strcat(res,rs->sw->reason); strcat(res,"$$\n"); strcat(res,rs->meta); strcat(res,"$$\n"); strcat(res,rs->tupel); strcat(res,"$$\n"); return res; } Index: trace.h =================================================================== RCS file: /cvsroot/sblim/sfcb/trace.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- trace.h 26 May 2005 14:58:55 -0000 1.4 +++ trace.h 3 Jun 2005 10:31:57 -0000 1.5 @@ -114,6 +114,7 @@ #define TRACE_MEMORYMGR 8192 #define TRACE_MSGQUEUE 16384 #define TRACE_XMLPARSING 32768 +#define TRACE_DBPDAEMON 65536 typedef void sigHandler(int); Index: control.c =================================================================== RCS file: /cvsroot/sblim/sfcb/control.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- control.c 26 Apr 2005 21:58:47 -0000 1.6 +++ control.c 3 Jun 2005 10:31:57 -0000 1.7 @@ -48,9 +48,12 @@ Control init[] = { {"httpPort", 1, "5988"}, + {"dbpPort", 1, "5980"}, {"enableHttp", 2, "true"}, {"httpProcs", 1, "8"}, + {"dbpProcs", 1, "8"}, {"httpsPort", 1, "5989"}, + {"httpsPort", 1, "5981"}, {"enableHttps", 2, "false"}, {"httpsProcs", 1, "8"}, {"provProcs", 1, "32"}, Index: Makefile.am =================================================================== RCS file: /cvsroot/sblim/sfcb/Makefile.am,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- Makefile.am 2 Jun 2005 17:23:52 -0000 1.22 +++ Makefile.am 3 Jun 2005 10:31:47 -0000 1.23 @@ -26,7 +26,7 @@ sfcbdocdir=$(datadir)/doc/sfcb-$(VERSION) initdir=$(sysconfdir)/init.d -BUILT_SOURCES=queryParser.c queryLexer.c +BUILT_SOURCES=queryParser.c queryLexer.c sqlParser.c sqlLexer.c AM_YFLAGS=-d @@ -86,10 +86,21 @@ queryStatement.c \ cimXmlGen.c \ mrwlock.c \ - mlog.c + mlog.c \ + dbpAdapter.c \ + sqlLexer.c \ + sqlParser.c \ + sqlStatement.c \ + avltree.c libsfcBrokerCore_la_CFLAGS = @SFCB_CMPI_OS@ @SFCB_CMPI_PLATFORM@ +sqlLexer.c: sqlLexer.l sqlParser.y + lex -t sqlLexer.l | sed -e "s/yy/sfcSql/g" > sqlLexer.c + +sqlParser.c: sqlLexer.l sqlParser.y + bison -p sfcSql -d -o sqlParser.c sqlParser.y + queryLexer.c: queryLexer.l queryParser.y lex -t queryLexer.l | sed -e "s/yy/sfcQuery/g" > queryLexer.c --- NEW FILE: sqlLexer.l --- %option never-interactive %{ /* * sqlLexer.l * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Sebastian Seyrich <se...@de...> * * Description: * * * * */ extern int sqlInput(char* buffer, int* numRead, int numRequested); extern int yyErr(const char*); extern char * yyStrcpy(char *txt, int len); extern void setSqlWarning(char* s, char *r); #undef YY_INPUT #define YY_INPUT(BUF, NREAD, NREQUESTED) sqlInput(BUF, &NREAD, NREQUESTED) #include "queryOperation.h" #include "sqlParser.h" #include "sqlStatement.h" #include <stdio.h> #include <string.h> #if 0 # define QL_TRACE(X) printf X #else # define QL_TRACE(X) #endif //extern SqlWarning* Sw; #define MAXBUF 500 char linebuf[MAXBUF]; int lineno=0; int tokenpos=0; %} POSITIVE_DECIMAL_DIGIT [1-9] DECIMAL_DIGIT [0-9] BLANK [ \t] IDENT_CHAR [A-Za-z_] %% "--".* /* comment */ \n.* { strcpy(linebuf, yytext+1);//save next line lineno++; tokenpos = 0; yyless(1);//alles auÃer dem \n zum erneuten Scannen zurückgeben } [Cc][Aa][Ll][Ll] { tokenpos+=yyleng; return TOK_CALL; } [Ss][Mm][Aa][Ll][Ll][Ii][Nn][Tt] { tokenpos+=yyleng; return TOK_SINTDT; } [Ii][Nn][Tt]([Ee][Gg][Ee][Rr])? { tokenpos+=yyleng; return TOK_INTDT; } [Bb][Ii][Gg][Ii][Nn][Tt] { tokenpos+=yyleng; return TOK_BINTDT; } [Rr][Ee][Aa][Ll] { tokenpos+=yyleng; return TOK_REALDT; } [Dd][Oo][Uu][Bb][Ll][Ee] { tokenpos+=yyleng; return TOK_DOUBLEDT; } (([Dd][Ee][Cc]([Ii][Mm][Aa][Ll])?)|([Nn][Uu][Mm]([Ee][Rr][Ii][Cc])?)) { tokenpos+=yyleng; return TOK_DECDT; } [Cc][Hh][Aa][Rr] { tokenpos+=yyleng; return TOK_CHARDT; } [Vv][Aa][Rr][Cc][Hh][Aa][Rr] { tokenpos+=yyleng; return TOK_VCHARDT; } [Dd][Aa][Tt][Ee] { tokenpos+=yyleng; return TOK_DATEDT; } [Tt][Ii][Mm][Ee] { tokenpos+=yyleng; return TOK_TIMEDT; } [Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp] { tokenpos+=yyleng; return TOK_TSTAMPDT; } [Ss][Ee][Ll][Ee][Cc][Tt] { QL_TRACE(("LEX: %s [TOK_SELECT]\n", yytext)); tokenpos+=yyleng; return TOK_SELECT; } [Ff][Rr][Oo][Mm] { QL_TRACE(("LEX: %s [TOK_FROM]\n", yytext)); tokenpos+=yyleng; return TOK_FROM; } [Ww][Hh][Ee][Rr][Ee] { QL_TRACE(("LEX: %s [TOK_WHERE]\n", yytext)); tokenpos+=yyleng; return TOK_WHERE; } [Tt][Rr][Uu][Ee] { QL_TRACE(("LEX: %s [TOK_TRUE]\n", yytext)); tokenpos+=yyleng; return TOK_TRUE; } [Ff][Aa][Ll][Ss][Ee] { QL_TRACE(("LEX: %s [TOK_FALSE]\n", yytext)); tokenpos+=yyleng; return TOK_FALSE; } [Nn][Uu][Ll][Ll] { QL_TRACE(("LEX: %s [TOK_NULL]\n", yytext)); tokenpos+=yyleng; return TOK_NULL; } [Cc][Oo][Nn][Cc][Aa][Tt] { QL_TRACE(("LEX: %s [TOK_CONCAT]\n", yytext)); tokenpos+=yyleng; return TOK_CONCAT; } "||" { QL_TRACE(("LEX: %s [TOK_CONCAT]\n", yytext)); tokenpos+=yyleng; return TOK_CONCAT; } [Nn][Oo][Tt] { QL_TRACE(("LEX: %s [TOK_NOT]\n", yytext)); tokenpos+=yyleng; return TOK_NOT; } [Aa][Nn][Dd] { QL_TRACE(("LEX: %s [TOK_AND]\n", yytext)); tokenpos+=yyleng; return TOK_AND; } [Oo][Rr] { QL_TRACE(("LEX: %s [TOK_OR]\n", yytext)); tokenpos+=yyleng; return TOK_OR; } [Ii][Ss] { QL_TRACE(("LEX: %s [TOK_IS]\n", yytext)); tokenpos+=yyleng; return TOK_IS; } [Aa][Ll][Ll] { QL_TRACE(("LEX: %s [TOK_ALL]\n", yytext)); tokenpos+=yyleng; return TOK_ALL; } [Aa][Ss] { QL_TRACE(("LEX: %s [TOK_AS]\n", yytext)); tokenpos+=yyleng; return TOK_AS; } [Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt] { QL_TRACE(("LEX: %s [TOK_DISTINCT]\n", yytext)); tokenpos+=yyleng; return TOK_DISTINCT; } [Jj][Oo][Ii][Nn] { QL_TRACE(("LEX: %s [TOK_JOIN]\n", yytext)); tokenpos+=yyleng; return TOK_JOIN; } [Oo][Nn] { QL_TRACE(("LEX: %s [TOK_ON]\n", yytext)); tokenpos+=yyleng; return TOK_ON; } [Ll][Ee][Ff][Tt]([ ][Oo][Uu][Tt][Ee][Rr])? { QL_TRACE(("LEX: %s [TOK_LEFT]\n", yytext)); tokenpos+=yyleng; return TOK_LEFT; } [Rr][Ii][Gg][Hh][Tt]([ ][Oo][Uu][Tt][Ee][Rr])? { QL_TRACE(("LEX: %s [TOK_RIGHT]\n", yytext)); tokenpos+=yyleng; return TOK_RIGHT; } [Ff][Uu][Ll][Ll]([ ][Oo][Uu][Tt][Ee][Rr])? { QL_TRACE(("LEX: %s [TOK_FULL]\n", yytext)); tokenpos+=yyleng; return TOK_FULL; } [\*(),.+-] { QL_TRACE(("LEX: %s [???]\n", yytext)); tokenpos+=yyleng; return yytext[0]; } "="|"==" { QL_TRACE(("LEX: %s [TOK_EQ]\n", yytext)); tokenpos+=yyleng; return TOK_EQ; } "!="|"<>" { QL_TRACE(("LEX: %s [TOK_NE]\n", yytext)); tokenpos+=yyleng; return TOK_NE; } "<=" { QL_TRACE(("LEX: %s [TOK_LE]\n", yytext)); tokenpos+=yyleng; return TOK_LE; } "<" { QL_TRACE(("LEX: %s [TOK_LT]\n", yytext)); tokenpos+=yyleng; return TOK_LT; } ">=" { QL_TRACE(("LEX: %s [TOK_GE]\n", yytext)); tokenpos+=yyleng; return TOK_GE; } ">" { QL_TRACE(("LEX: %s [TOK_GT]\n", yytext)); tokenpos+=yyleng; return TOK_GT; } [Dd][Rr][Oo][Pp] { QL_TRACE(("LEX: %s [TOK_DROP]\n", yytext)); tokenpos+=yyleng; return TOK_DROP; } [Tt][Aa][Bb][Ll][Ee] { QL_TRACE(("LEX: %s [TOK_TABLE]\n", yytext)); tokenpos+=yyleng; return TOK_TABLE; } [Aa][Ll][Tt][Ee][Rr] { QL_TRACE(("LEX: %s [TOK_ALTER]\n", yytext)); tokenpos+=yyleng; return TOK_ALTER; } [Cc][Rr][Ee][Aa][Tt][Ee] { QL_TRACE(("LEX: %s [TOK_CREATE]\n", yytext)); tokenpos+=yyleng; return TOK_CREATE; } [Kk][Ee][Yy] { QL_TRACE(("LEX: %s [TOK_KEY]\n", yytext)); tokenpos+=yyleng; return TOK_KEY; } [Ff][Oo][Rr][Ee][Ii][Gg][Nn] { QL_TRACE(("LEX: %s [TOK_FOREIGN]\n", yytext)); tokenpos+=yyleng; return TOK_FOREIGN; } [Uu][Nn][Ii][Qq][Uu][Ee] { QL_TRACE(("LEX: %s [TOK_UNIQUE]\n", yytext)); tokenpos+=yyleng; return TOK_UNIQUE; } [Pp][Rr][Ii][Mm][Ee][Rr][Yy] { QL_TRACE(("LEX: %s [TOK_PRIMARY]\n", yytext)); tokenpos+=yyleng; return TOK_PRIMARY; } [Cc][Oo][Nn][Ss][Tt][Rr][Aa][Ii][Nn][Tt] { QL_TRACE(("LEX: %s [TOK_CONSTRAINT]\n", yytext)); tokenpos+=yyleng; return TOK_CONSTRAINT; } [Rr][Ee][Ff][Ee][Rr][Ee][Nn][Cc][Ee][Ss] { QL_TRACE(("LEX: %s [TOK_REFERENCES]\n", yytext)); tokenpos+=yyleng; return TOK_REFERENCES; } [Cc][Hh][Ee][Cc][Kk] { QL_TRACE(("LEX: %s [TOK_CHECK]\n", yytext)); tokenpos+=yyleng; return TOK_CHECK; } [Pp][Rr][Ii][Mm][Aa][Rr][Yy] { QL_TRACE(("LEX: %s [TOK_PRIMARY]\n", yytext)); tokenpos+=yyleng; return TOK_PRIMARY; } [Ii][Nn][Ss][Ee][Rr][Tt] { QL_TRACE(("LEX: %s [TOK_INSERT]\n", yytext)); tokenpos+=yyleng; return TOK_INSERT; } [Ss][Ee][Tt] { QL_TRACE(("LEX: %s [TOK_SET]\n", yytext)); tokenpos+=yyleng;printf("set\n"); return TOK_SET; } [Uu][Pp][Dd][Aa][Tt][Ee] { QL_TRACE(("LEX: %s [TOK_UPDATE]\n", yytext)); tokenpos+=yyleng; return TOK_UPDATE; } [Dd][Ee][Ll][Ee][Tt][Ee] { QL_TRACE(("LEX: %s [TOK_DELETE]\n", yytext)); tokenpos+=yyleng; return TOK_DELETE; } [Ii][Nn][Tt][Oo] { QL_TRACE(("LEX: %s [TOK_INTO]\n", yytext)); tokenpos+=yyleng; return TOK_INTO; } [Vv][Aa][Ll][Uu][Ee][Ss] { QL_TRACE(("LEX: %s [TOK_VALUES]\n", yytext)); tokenpos+=yyleng; return TOK_VALUES; } [Dd][Ee][Ff][Aa][Uu][Ll][Tt] { QL_TRACE(("LEX: %s [TOK_DEFAULT]\n", yytext)); tokenpos+=yyleng; return TOK_DEFAULT; } [Ii][Nn] { QL_TRACE(("LEX: %s [TOK_IN]\n", yytext)); tokenpos+=yyleng; return TOK_IN; } [Ll][Ii][Kk][Ee] { QL_TRACE(("LEX: %s [TOK_LIKE]\n", yytext)); tokenpos+=yyleng; return TOK_LIKE; } [Ss][Oo][Mm][Ee] { QL_TRACE(("LEX: %s [TOK_SOME]\n", yytext)); tokenpos+=yyleng; return TOK_SOME; } [Aa][Nn][Yy] { QL_TRACE(("LEX: %s [TOK_ANY]\n", yytext)); tokenpos+=yyleng; return TOK_ANY; } [Ee][Xx][Ii][Ss][Tt][Ss] { QL_TRACE(("LEX: %s [TOK_EXISTS]\n", yytext)); tokenpos+=yyleng; return TOK_EXISTS; } [Bb][Ee][Tt][Ww][Ee][Ee][Nn] { QL_TRACE(("LEX: %s [TOK_BETWEEN]\n", yytext)); tokenpos+=yyleng; return TOK_BETWEEN; } [Gg][Rr][Oo][Uu][Pp] { QL_TRACE(("LEX: %s [TOK_GROUP]\n", yytext)); tokenpos+=yyleng; return TOK_GROUP; } [Ff][Ee][Tt][Cc][Hh] { QL_TRACE(("LEX: %s [TOK_FETCH]\n", yytext)); tokenpos+=yyleng; return TOK_FETCH; } [Oo][Nn][Ll][Yy] { QL_TRACE(("LEX: %s [TOK_ONLY]\n", yytext)); tokenpos+=yyleng; return TOK_ONLY; } [Aa][Ss][Cc] { QL_TRACE(("LEX: %s [TOK_ASC]\n", yytext)); tokenpos+=yyleng; return TOK_ASC; } [Dd][Ee][Ss][Cc] { QL_TRACE(("LEX: %s [TOK_DESC]\n", yytext)); tokenpos+=yyleng; return TOK_DESC; } [Bb][Yy] { QL_TRACE(("LEX: %s [TOK_BY]\n", yytext)); tokenpos+=yyleng; return TOK_BY; } [Rr][Oo][Ww][Ss]? { QL_TRACE(("LEX: %s [TOK_ROWS]\n", yytext)); tokenpos+=yyleng; return TOK_ROW; } [Oo][Rr][Dd][Ee][Rr] { QL_TRACE(("LEX: %s [TOK_ORDER]\n", yytext)); tokenpos+=yyleng; return TOK_ORDER; } [Ff][Ii][Rr][Ss][Tt] { QL_TRACE(("LEX: %s [TOK_FIRST]\n", yytext)); tokenpos+=yyleng; return TOK_FIRST; } [Hh][Aa][Vv][Ii][Nn][Gg] { QL_TRACE(("LEX: %s [TOK_HAVING]\n", yytext)); tokenpos+=yyleng; return TOK_HAVING; } [Uu][Nn][Ii][Oo][Nn] { QL_TRACE(("LEX: %s [TOK_UNION]\n", yytext)); tokenpos+=yyleng; return TOK_UNION; } [Uu][Nn][Ii][Oo][Nn][Aa][Ll][Al] { QL_TRACE(("LEX: %s [TOK_UNIONALL]\n", yytext)); tokenpos+=yyleng; return TOK_UNIONALL; } [Ee][Xx][Cc][Ee][Pp][Tt] { QL_TRACE(("LEX: %s [TOK_EXCEPT]\n", yytext)); tokenpos+=yyleng; return TOK_EXCEPT; } [Ee][Xx][Cc][Ee][Pp][Tt][Aa][Ll][Ll] { QL_TRACE(("LEX: %s [TOK_EXCEPTALL]\n", yytext)); tokenpos+=yyleng; return TOK_EXCEPTALL; } [Ii][Nn][Tt][Ee][Rr][Ss][Ee][Cc][Tt] { QL_TRACE(("LEX: %s [TOK_INTERSECT]\n", yytext)); tokenpos+=yyleng; return TOK_INTERSECT; } [Ii][Nn][Tt][Ee][Rr][Ss][Ee][Cc][Tt][Aa][Ll][Ll] { QL_TRACE(("LEX: %s [TOK_INTERSECTALL]\n", yytext)); tokenpos+=yyleng; return TOK_INTERSECTALL; } [Ww][Ii][Tt][Hh] { QL_TRACE(("LEX: %s [TOK_WITH]\n", yytext)); tokenpos+=yyleng; return TOK_WITH; } {BLANK}+ { tokenpos+=yyleng; /* Ignore blanks */ } [-+]?{POSITIVE_DECIMAL_DIGIT}{DECIMAL_DIGIT}* { QL_TRACE(("LEX: %s [???1]\n", yytext)); yylval.intValue = strtol(yytext, (char**)0, 10); tokenpos+=yyleng; retu... [truncated message content] |
From: Viktor M. <mih...@us...> - 2005-06-03 10:32:11
|
Update of /cvsroot/sblim/sfcb/jdbc/com/ibm/wbem/jdbc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13949/jdbc/com/ibm/wbem/jdbc Added Files: CIMCallableStatement.java CIMConnection.java CIMDatabaseMetaData.java CIMDriver.java CIMPreparedStatement.java CIMResultSet.java CIMResultSetMetaData.java CIMStatement.java Log Message: Bug fixed 1214077: Added SQL Support (for JDBC). --- NEW FILE: CIMConnection.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Savepoint; import java.sql.Statement; import java.util.Map; import java.util.Properties; /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CIMConnection implements Connection{ private BufferedReader in; private PrintWriter out; private Socket s; private String catalog; private boolean readOnly; private DatabaseMetaData dbMeta; private SQLWarning sqlWarnings; public CIMConnection(Socket s) throws IOException{ this.s = s; in = new BufferedReader(new InputStreamReader(s.getInputStream())); out = new PrintWriter(s.getOutputStream()); out.println("1 1 ");out.flush(); if(!in.readLine().equals("1 1 1")) s=null; } /* (non-Javadoc) * @see java.sql.Connection#getHoldability() */ public int getHoldability() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: getHoldability()"); //return 0; } /* (non-Javadoc) * @see java.sql.Connection#getTransactionIsolation() */ public int getTransactionIsolation() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: getTransactionIsolation()"); //return 0; } /* (non-Javadoc) * @see java.sql.Connection#clearWarnings() */ public void clearWarnings() throws SQLException { // TODO Auto-generated method stub sqlWarnings = null; } /* (non-Javadoc) * @see java.sql.Connection#close() */ public void close() throws SQLException { System.out.println("close()"); if(s==null) return; out.println("1 2\n");out.flush(); System.out.println("1 2 gesendet"); try { in.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } out.close(); try { s.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } /* (non-Javadoc) * @see java.sql.Connection#commit() */ public void commit() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: commit()"); } /* (non-Javadoc) * @see java.sql.Connection#rollback() */ public void rollback() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: rollback()"); } /* (non-Javadoc) * @see java.sql.Connection#getAutoCommit() */ public boolean getAutoCommit() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: getAutoCommit()"); //return false; } /* (non-Javadoc) * @see java.sql.Connection#isClosed() */ public boolean isClosed() throws SQLException { return s==null||s.isClosed(); } /* (non-Javadoc) * @see java.sql.Connection#isReadOnly() */ public boolean isReadOnly() throws SQLException { // TODO Auto-generated method stub return readOnly; } /* (non-Javadoc) * @see java.sql.Connection#setHoldability(int) */ public void setHoldability(int arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setHoldability()"); } /* (non-Javadoc) * @see java.sql.Connection#setTransactionIsolation(int) */ public void setTransactionIsolation(int arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setTransactionIsolation()"); } /* (non-Javadoc) * @see java.sql.Connection#setAutoCommit(boolean) */ public void setAutoCommit(boolean arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setAutoCommit()"); } /* (non-Javadoc) * @see java.sql.Connection#setReadOnly(boolean) */ public void setReadOnly(boolean arg0) throws SQLException { //sollte an die DB weitergegeben werden. Dmit auch in Selects keine Funktionen mit Seiteneffekten aufgerufen werden können readOnly = arg0; } /* (non-Javadoc) * @see java.sql.Connection#getCatalog() */ public String getCatalog() throws SQLException { return catalog; } /* (non-Javadoc) * @see java.sql.Connection#setCatalog(java.lang.String) */ public void setCatalog(String arg0) throws SQLException { catalog = arg0; } /* (non-Javadoc) * @see java.sql.Connection#getMetaData() */ public DatabaseMetaData getMetaData() throws SQLException { //diese Daten müssen einmalig erhoben werden. Allerdings //nicht im Konstruktor, da die Daten nicht bei jeder Connection //vom Client angefordert werden if(dbMeta==null){ out.println("3 1 ");out.flush(); String inString=null; try { if(in.readLine().equals("3 1 1")){ do{ inString += in.readLine(); }while(!inString.endsWith("$$")); Properties prop = new Properties(); inString = inString.substring(0,inString.length()-2); String[] s = inString.split(";"); for(int i=0; i<s.length;i++){ String[] t = s[i].split("="); prop.setProperty(t[0],t[1]); } dbMeta = new CIMDatabaseMetaData(prop,this.s,this,in,out); } else System.out.println("Fehler "); //Parameterliste empfangen //DatabaseMetaData erzeugen mit Liste als Argument. } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); throw new SQLException("IOException reading Socket"); } } return dbMeta; } /* (non-Javadoc) * @see java.sql.Connection#getWarnings() */ public SQLWarning getWarnings() throws SQLException { return sqlWarnings; } /* (non-Javadoc) * @see java.sql.Connection#setSavepoint() */ public Savepoint setSavepoint() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setSavepoint()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint) */ public void releaseSavepoint(Savepoint arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: releaseSavepoint()"); } /* (non-Javadoc) * @see java.sql.Connection#rollback(java.sql.Savepoint) */ public void rollback(Savepoint arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: rollback()"); } /* (non-Javadoc) * @see java.sql.Connection#createStatement() */ public Statement createStatement() throws SQLException { return new CIMStatement(s,this); } /* (non-Javadoc) * @see java.sql.Connection#createStatement(int, int) */ public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { throw new SQLException("Not Implemented: createStatement(int resultSetType, int resultSetConcurrency)"); } /* (non-Javadoc) * @see java.sql.Connection#createStatement(int, int, int) */ public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { throw new SQLException("Not Implemented: createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)"); } /* (non-Javadoc) * @see java.sql.Connection#getTypeMap() */ public Map getTypeMap() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: getTypeMap()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#setTypeMap(java.util.Map) */ public void setTypeMap(Map arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setTypeMap()"); } /* (non-Javadoc) * @see java.sql.Connection#nativeSQL(java.lang.String) */ public String nativeSQL(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: nativeSQL()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareCall(java.lang.String) */ public CallableStatement prepareCall(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareCall()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareCall(java.lang.String, int, int) */ public CallableStatement prepareCall(String arg0, int arg1, int arg2) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareCall()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int) */ public CallableStatement prepareCall(String arg0, int arg1, int arg2, int arg3) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareCall()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String) */ public PreparedStatement prepareStatement(String sql) throws SQLException { // TODO Auto-generated method stub return new CIMPreparedStatement(s,this,sql); } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String, int) */ public PreparedStatement prepareStatement(String arg0, int arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareStatement()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String, int, int) */ public PreparedStatement prepareStatement(String arg0, int arg1, int arg2) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareStatement()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int) */ public PreparedStatement prepareStatement(String arg0, int arg1, int arg2, int arg3) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareStatement()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String, int[]) */ public PreparedStatement prepareStatement(String arg0, int[] arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareStatement()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#setSavepoint(java.lang.String) */ public Savepoint setSavepoint(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setSavepoint()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[]) */ public PreparedStatement prepareStatement(String arg0, String[] arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareStatement()"); //return null; } } --- NEW FILE: CIMResultSetMetaData.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Types; /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CIMResultSetMetaData implements ResultSetMetaData { private String[][] col; private ResultSetMetaData rsmd; /** * @param prop */ public CIMResultSetMetaData(String prop) { String[] st = prop.split("::"); col = new String[st.length][]; for (int i = 0; i < col.length; i++) { col[i] = st[i].split(";"); } //für getColumnDisplaySize() } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnCount() */ public int getColumnCount() throws SQLException { return col.length; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int) */ public int getColumnDisplaySize(int column) throws SQLException { //Es wird nach der Anzahl der ZEICHEN gefragt! int indx = col[column][2].indexOf("(")>0? col[column][2].indexOf("("):col[column][2].length(); String s = col[column][2].toUpperCase().substring(0,indx); if(s.equals("BIGINT")) return -1;//Nachschlage --> CIMOM else if(s.equals("TIMESTAMP")) return -1;//Nachschlage --> CIMOM else if(s.equals("DATE")) return -1;//Nachschlage --> CIMOM else if(s.equals("VARCHAR")){ return Integer.parseInt(col[column][2].substring(col[column][2].indexOf("(")+1,col[column][2].length()-1)); } else if(s.equals("CHAR")) return -1;//Nachschlage --> CIMOM else if(s.equals("DECIMAL") || s.equals("NUMERIC") || s.equals("NUM") || s.equals("DEC")){ //das +1 muss sein, wegen des "," in der Darstellung return Integer.parseInt(col[column][2].substring(col[column][2].indexOf("(")+1,col[column][2].indexOf(",")))+1; } else if(s.equals("DOUBLE")) return -1;//Nachschlage --> CIMOM else if(s.equals("REAL")) return -1;//Nachschlage --> CIMOM else if(s.equals("INTEGER")) return -1;//Nachschlage --> CIMOM else if(s.equals("INT")) return -1;//Nachschlage --> CIMOM else if(s.equals("SMALLINT")) return -1;//Nachschlage --> CIMOM else return 0; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnType(int) */ public int getColumnType(int column) throws SQLException { int indx = col[column][2].indexOf("(")>0? col[column][2].indexOf("("):col[column][2].length(); String s = col[column][2].toUpperCase().substring(0,indx); if(s.equals("BIGINT")) return Types.BIGINT; if(s.equals("TIMESTAMP")) return Types.TIMESTAMP; if(s.equals("DATE")) return Types.DATE; if(s.equals("VARCHAR")) return Types.VARCHAR; if(s.equals("CHAR")) return Types.CHAR; if(s.equals("DECIMAL")) return Types.DECIMAL; if(s.equals("NUMERIC")) return Types.DECIMAL; if(s.equals("NUM")) return Types.DECIMAL; if(s.equals("DEC")) return Types.DECIMAL; if(s.equals("DOUBLE")) return Types.DOUBLE; if(s.equals("REAL")) return Types.REAL; if(s.equals("INTEGER")) return Types.INTEGER; if(s.equals("INT")) return Types.INTEGER; if(s.equals("SMALLINT")) return Types.SMALLINT; if(s.equals("BOOLEAN")) return Types.BOOLEAN; if(s.equals("REF")) return Types.REF; if(s.equals("OTHER")) return Types.OTHER; //System.out.println(s); throw new SQLException(); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getPrecision(int) */ public int getPrecision(int column) throws SQLException { if(getColumnType(column)==Types.DECIMAL) return Integer.parseInt(col[column][2].substring(col[column][2].indexOf("(")+1,col[column][2].indexOf(","))); return 0; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getScale(int) */ public int getScale(int column) throws SQLException { if(getColumnType(column)==Types.DECIMAL) return Integer.parseInt(col[column][2].substring(col[column][2].indexOf(",")+1,col[column][2].indexOf(")"))); return 0; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isNullable(int) */ public int isNullable(int column) throws SQLException { // TODO Auto-generated method stub return Integer.parseInt(col[column][4]); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isAutoIncrement(int) */ public boolean isAutoIncrement(int arg0) throws SQLException { return false; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isCaseSensitive(int) */ public boolean isCaseSensitive(int column) throws SQLException { return col[column][5].equalsIgnoreCase("true"); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isCurrency(int) */ public boolean isCurrency(int arg0) throws SQLException { // TODO Auto-generated method stub return false; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isDefinitelyWritable(int) */ public boolean isDefinitelyWritable(int column) throws SQLException { return col[column][3].equalsIgnoreCase("true"); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isReadOnly(int) */ public boolean isReadOnly(int column) throws SQLException { return !isDefinitelyWritable(column); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isSearchable(int) */ public boolean isSearchable(int arg0) throws SQLException { return true; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isSigned(int) */ public boolean isSigned(int arg0) throws SQLException { return true; //MIT CIMOM-DT ABGLEICHEN } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isWritable(int) */ public boolean isWritable(int column) throws SQLException { return isDefinitelyWritable(column); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getCatalogName(int) */ public String getCatalogName(int arg0) throws SQLException { throw new SQLException("Catalog not supported"); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnClassName(int) */ public String getColumnClassName(int column) throws SQLException { // Synchron zu CIMResultSetMetaData.getColumnClassName() halten //System.out.println(column); switch(getColumnType(column)){ case Types.BIGINT: return "java.math.BigInteger"; case Types.TIMESTAMP: return "java.sql.Timestamp"; case Types.DATE: return "java.lang.Long"; case Types.VARCHAR: return "java.lang.String"; case Types.CHAR: return "java.lang.String"; case Types.DECIMAL: return "java.math.BigDecimal"; case Types.DOUBLE: return "java.lang.Double"; case Types.REAL: return "java.lang.Float"; case Types.INTEGER: return "java.lang.Integer"; case Types.SMALLINT: return "java.lang.Integer"; case Types.NULL: return "null"; case Types.BOOLEAN: return "java.lang.Boolean"; case Types.REF: return "java.lang.String"; case Types.OTHER: return "java.lang.String"; default: throw new SQLException(); } } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnLabel(int) */ public String getColumnLabel(int column) throws SQLException { return col[column][1]; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnName(int) */ public String getColumnName(int column) throws SQLException { return col[column][1]; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnTypeName(int) */ public String getColumnTypeName(int column) throws SQLException { return col[column][2]; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getSchemaName(int) */ public String getSchemaName(int column) throws SQLException { throw new SQLException("Schema not supported"); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getTableName(int) */ public String getTableName(int column) throws SQLException { return col[column][0]; } } --- NEW FILE: CIMDriver.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.InetAddress; import java.net.Socket; import java.net.UnknownHostException; import java.sql.Connection; import java.sql.Driver; import java.sql.DriverPropertyInfo; import java.sql.SQLException; import java.util.Properties; /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CIMDriver implements Driver { public static final int VERSION = 0; public static final String NAME = "CIM-JDBC for sfcb"; public static final String VERSIONSTRING = "V 0.1"; /** * Driver will be registered on class loading */ static { try { java.sql.DriverManager.registerDriver(new CIMDriver()); } catch (SQLException e) { throw new RuntimeException("CIM-Driver: Can't register driver!"); } } public CIMDriver() throws SQLException{ System.out.println("Driver-Konstruktor"); } /* (non-Javadoc) * @see java.sql.Driver#getMajorVersion() */ public int getMajorVersion() { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.Driver#getMinorVersion() */ public int getMinorVersion() { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.Driver#jdbcCompliant() */ public boolean jdbcCompliant() { // TODO Auto-generated method stub return false; } /* * @see java.sql.Driver#acceptsURL(java.lang.String) * arg0: <ip-adresse>[:port] */ public boolean acceptsURL(String arg0) throws SQLException { boolean acc = false; try { Socket s = getConSocket(arg0); BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter out = new PrintWriter(s.getOutputStream()); out.println("1 1 ");out.flush(); acc = in.readLine().equals("1 1 1"); out.println("1 2\n");out.flush(); in.close();out.close();s.close(); } catch (UnknownHostException e) { throw new SQLException("UnkownHost: "+arg0); } catch (IOException e) { throw new SQLException(); } catch (NumberFormatException e){ throw new SQLException("Cannot parse String to int\n"+e.toString()); } return acc; } private Socket getConSocket(String url) throws UnknownHostException, IOException, NumberFormatException{ int c, port; String addr; if((c=url.indexOf(":"))>0){ addr = url.substring(0,c); port = Integer.parseInt(url.substring(c+1,url.length())); } else{ port = 5980; addr = url; } InetAddress serveraddr = InetAddress.getByName(addr); return new Socket(serveraddr, port); } /* (non-Javadoc) * @see java.sql.Driver#connect(java.lang.String, java.util.Properties) */ public Connection connect(String arg0, Properties arg1) throws SQLException { Socket s = null; try { s = getConSocket(arg0); return new CIMConnection(s); } catch (UnknownHostException e) { throw new SQLException(); } catch (IOException e) { throw new SQLException(); } catch (NumberFormatException e){ throw new SQLException(); } } /* (non-Javadoc) * @see java.sql.Driver#getPropertyInfo(java.lang.String, java.util.Properties) */ public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1) throws SQLException { // TODO Auto-generated method stub return null; } public static void main(String[] args){ try { System.out.println((new CIMDriver().acceptsURL("127.0.0.1:5980"))); Connection con = new CIMDriver().connect("127.0.0.1:5980",null); con.getMetaData(); con.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } String a = "varchar(4987)"; System.out.println(a.substring(a.indexOf("(")+1,a.length()-1)); System.out.println(a.toUpperCase().substring(0,a.indexOf("("))); a = "dec(13,2)"; System.out.println(""+(Integer.parseInt(a.substring(a.indexOf("(")+1,a.indexOf(",")))+1)); System.out.println(""+(Integer.parseInt(a.substring(a.indexOf(",")+1,a.indexOf(")"))))); } } --- NEW FILE: CIMDatabaseMetaData.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLWarning; import java.util.Properties; [...1343 lines suppressed...] } /* (non-Javadoc) * @see java.sql.DatabaseMetaData#getTables(java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) */ public ResultSet getTables(String catalog, String schemapattern, String tableNamePattern, String[] types) throws SQLException { return execute(tableNamePattern,"3 2"); } /* (non-Javadoc) * @see java.sql.DatabaseMetaData#getCrossReference(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public ResultSet getCrossReference(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5) throws SQLException { // TODO Auto-generated method stub return null; } } --- NEW FILE: CIMResultSet.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Reader; import java.math.BigDecimal; import java.math.BigInteger; import java.net.Socket; import java.net.URL; import java.sql.Array; [...1234 lines suppressed...] */ public Date getDate(String arg0, Calendar arg1) throws SQLException { throw new SQLException("Not Implemented: ResultSet()"); } /* (non-Javadoc) * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar) */ public Time getTime(String arg0, Calendar arg1) throws SQLException { throw new SQLException("Not Implemented: ResultSet()"); } /* (non-Javadoc) * @see java.sql.ResultSet#getTimestamp(java.lang.String, java.util.Calendar) */ public Timestamp getTimestamp(String arg0, Calendar arg1) throws SQLException { throw new SQLException("Not Implemented: ResultSet()"); } } --- NEW FILE: CIMStatement.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CIMStatement implements Statement { private Socket s; private BufferedReader in; private PrintWriter out; private CIMConnection con; private ResultSet rs; private SQLWarning sw; private int fetchDir; private int maxFieldSize = 0; private int maxRows = 0; private int fetchSize = 0; /** * @param s * @param connectio * @throws SQLException */ public CIMStatement(Socket s, CIMConnection con) throws SQLException { this.s = s; this.con = con; try { in = new BufferedReader(new InputStreamReader(s.getInputStream())); out = new PrintWriter(s.getOutputStream()); } catch (IOException e) { throw new SQLException(); } fetchDir = ResultSet.FETCH_FORWARD; } /** * @param s2 * @param connection */ /* (non-Javadoc) * @see java.sql.Statement#getFetchDirection() */ public int getFetchDirection() throws SQLException { return fetchDir; } /* (non-Javadoc) * @see java.sql.Statement#getFetchSize() */ public int getFetchSize() throws SQLException { return fetchSize;//no limit } /* (non-Javadoc) * @see java.sql.Statement#getMaxFieldSize() */ public int getMaxFieldSize() throws SQLException { return maxFieldSize;//no limit } /* (non-Javadoc) * @see java.sql.Statement#getMaxRows() */ public int getMaxRows() throws SQLException { return maxRows;//no limit } /* (non-Javadoc) * @see java.sql.Statement#getQueryTimeout() */ public int getQueryTimeout() throws SQLException { // TODO Auto-generated method stub return 0;//no limit } /* (non-Javadoc) * @see java.sql.Statement#getResultSetConcurrency() */ public int getResultSetConcurrency() throws SQLException { return ResultSet.CONCUR_READ_ONLY; } /* (non-Javadoc) * @see java.sql.Statement#getResultSetHoldability() */ public int getResultSetHoldability() throws SQLException { throw new SQLException("Not Implemented: Statement()");//commit not spported } /* (non-Javadoc) * @see java.sql.Statement#getResultSetType() */ public int getResultSetType() throws SQLException { return ResultSet.TYPE_SCROLL_INSENSITIVE; } /* (non-Javadoc) * @see java.sql.Statement#getUpdateCount() */ public int getUpdateCount() throws SQLException { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.Statement#cancel() */ public void cancel() throws SQLException { //beide muessten das unterstuetzen. jdbc und cimom!! throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.Statement#clearBatch() */ public void clearBatch() throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.Statement#clearWarnings() */ public void clearWarnings() throws SQLException { // nothing to do... } /* (non-Javadoc) * @see java.sql.Statement#close() */ public void close() throws SQLException { //Pipe darf nicht closed werden, sonst ist der ganze Socket tot! rs = null; sw = null; } /* (non-Javadoc) * @see java.sql.Statement#getMoreResults() */ public boolean getMoreResults() throws SQLException { return false; } /* (non-Javadoc) * @see java.sql.Statement#executeBatch() */ public int[] executeBatch() throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#setFetchDirection(int) */ public void setFetchDirection(int dir) throws SQLException { fetchDir = dir; } /* (non-Javadoc) * @see java.sql.Statement#setFetchSize(int) */ public void setFetchSize(int arg0) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#setMaxFieldSize(int) */ public void setMaxFieldSize(int size) throws SQLException { maxFieldSize = size; } /* (non-Javadoc) * @see java.sql.Statement#setMaxRows(int) */ public void setMaxRows(int maxRows) throws SQLException { this.maxRows = maxRows; } /* (non-Javadoc) * @see java.sql.Statement#setQueryTimeout(int) */ public void setQueryTimeout(int arg0) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#getMoreResults(int) */ public boolean getMoreResults(int arg0) throws SQLException { return false; } /* (non-Javadoc) * @see java.sql.Statement#setEscapeProcessing(boolean) */ public void setEscapeProcessing(boolean arg0) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#executeUpdate(java.lang.String) */ public int executeUpdate(String arg0) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#addBatch(java.lang.String) */ public void addBatch(String arg0) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#setCursorName(java.lang.String) */ public void setCursorName(String arg0) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#execute(java.lang.String) */ public boolean execute(String sql) throws SQLException { try { rs = executeQuery(sql); return true; } catch (Exception e) { return false; } } /* (non-Javadoc) * @see java.sql.Statement#executeUpdate(java.lang.String, int) */ public int executeUpdate(String arg0, int arg1) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#execute(java.lang.String, int) */ public boolean execute(String arg0, int arg1) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#executeUpdate(java.lang.String, int[]) */ public int executeUpdate(String arg0, int[] arg1) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#execute(java.lang.String, int[]) */ public boolean execute(String arg0, int[] arg1) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#getConnection() */ public Connection getConnection() throws SQLException { return con; } /* (non-Javadoc) * @see java.sql.Statement#getGeneratedKeys() */ public ResultSet getGeneratedKeys() throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#getResultSet() */ public ResultSet getResultSet() throws SQLException { // TODO Auto-generated method stub return rs; } /* (non-Javadoc) * @see java.sql.Statement#getWarnings() */ public SQLWarning getWarnings() throws SQLException { return sw; } /* (non-Javadoc) * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[]) */ public int executeUpdate(String arg0, String[] arg1) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#execute(java.lang.String, java.lang.String[]) */ public boolean execute(String arg0, String[] arg1) throws SQLException { throw new SQLException("Not Implemented: Statement()"); } /* (non-Javadoc) * @see java.sql.Statement#executeQuery(java.lang.String) */ public ResultSet executeQuery(String sql) throws SQLException { sw = null;rs = null; //Anfrage abschicken out.println("2 "+sql+"$");out.flush(); String inString=""; try { //Antwort abwarten und analysieren //Fehler String protocollSt=in.readLine(); boolean first = true; do{ if(!first) inString += "\n"+in.readLine(); else{ inString += in.readLine(); first = false; } }while(!inString.endsWith("$$")); System.out.println(protocollSt+"<<<\n"+inString); inString = inString.substring(0,inString.length()-2); String w[] = inString.split(";"); sw = new SQLWarning(w[1],w[0]); if(!protocollSt.equals("2 1")){ System.out.println("2 0: "+protocollSt); throw sw; } else{ //System.out.println("2 1 "+inString); //Warning einlesen } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); throw new SQLException("IOException reading Socket"); } rs = new CIMResultSet(s,this,in,out); return rs; } protected BufferedReader getIn() { return in; } protected PrintWriter getOut() { return out; } } --- NEW FILE: CIMPreparedStatement.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.Socket; import java.net.URL; import java.sql.Array; import java.sql.Blob; import java.sql.Clob; import java.sql.Date; import java.sql.ParameterMetaData; import java.sql.PreparedStatement; import java.sql.Ref; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Time; import java.sql.Timestamp; import java.sql.Types; import java.util.Calendar; /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CIMPreparedStatement extends CIMStatement implements PreparedStatement{ private String sql; protected String[] values; /** * @param connection * @param s * @param arg0 */ public CIMPreparedStatement(Socket s, CIMConnection connection, String sql) throws SQLException{ super(s,connection); this.sql = sql; char c[] = sql.toCharArray(); int count = 0; for (int i = 0; i < c.length; i++) { if(c[i]=='?') count++; } values = new String[count]; } /* (non-Javadoc) * @see java.sql.PreparedStatement#executeUpdate() */ public int executeUpdate() throws SQLException { return super.executeUpdate(formatSQL()); } public String toString(){ try { return formatSQL(); } catch (Exception e) { return e.toString(); } } /** * @return */ private String formatSQL() throws SQLException { String res = sql; System.out.println(sql); for (int i = 0; i < values.length; i++) { if(values[i]==null) throw new SQLException(i+". value is not set"); System.out.println(values[i]); res = res.replaceFirst("\\?",values[i]); } return res; } /* (non-Javadoc) * @see java.sql.PreparedStatement#addBatch() */ public void addBatch() throws SQLException { throw new SQLException("Not Implemented: CallableStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#clearParameters() */ public void clearParameters() throws SQLException { for (int i = 0; i < values.length; i++) { values[i]=null; } } /* (non-Javadoc) * @see java.sql.PreparedStatement#execute() */ public boolean execute() throws SQLException { return super.execute(formatSQL()); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setByte(int, byte) */ public void setByte(int parameterIndex, byte arg1) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setDouble(int, double) */ public void setDouble(int parameterIndex, double val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val+""; } /* (non-Javadoc) * @see java.sql.PreparedStatement#setFloat(int, float) */ public void setFloat(int parameterIndex, float val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val+""; } /* (non-Javadoc) * @see java.sql.PreparedStatement#setInt(int, int) */ public void setInt(int parameterIndex, int val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val+""; } /* (non-Javadoc) * @see java.sql.PreparedStatement#setNull(int, int) */ public void setNull(int parameterIndex, int val) throws SQLException { if(Types.NULL!=val) throw new SQLException(val+" doesn't identify a null value"); values[parameterIndex-1] = "NULL"; } /* (non-Javadoc) * @see java.sql.PreparedStatement#setLong(int, long) */ public void setLong(int parameterIndex, long val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val+""; } /* (non-Javadoc) * @see java.sql.PreparedStatement#setShort(int, short) */ public void setShort(int parameterIndex, short val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val+""; } /* (non-Javadoc) * @see java.sql.PreparedStatement#setBoolean(int, boolean) */ public void setBoolean(int parameterIndex, boolean val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val ? "true":"false"; } /* (non-Javadoc) * @see java.sql.PreparedStatement#setBytes(int, byte[]) */ public void setBytes(int parameterIndex, byte[] val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = new String(val); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setAsciiStream(int, java.io.InputStream, int) */ public void setAsciiStream(int parameterIndex, InputStream arg1, int arg2) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setBinaryStream(int, java.io.InputStream, int) */ public void setBinaryStream(int parameterIndex, InputStream arg1, int arg2) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setUnicodeStream(int, java.io.InputStream, int) */ public void setUnicodeStream(int parameterIndex, InputStream arg1, int arg2) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setCharacterStream(int, java.io.Reader, int) */ public void setCharacterStream(int parameterIndex, Reader arg1, int arg2) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setObject(int, java.lang.Object) */ public void setObject(int parameterIndex, Object val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val.toString(); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setObject(int, java.lang.Object, int) */ public void setObject(int parameterIndex, Object arg1, int arg2) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setObject(int, java.lang.Object, int, int) */ public void setObject(int parameterIndex, Object arg1, int arg2, int arg3) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setNull(int, int, java.lang.String) */ public void setNull(int parameterIndex, int val, String ignored) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); setNull(parameterIndex,val); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setString(int, java.lang.String) */ public void setString(int parameterIndex, String val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val; } /* (non-Javadoc) * @see java.sql.PreparedStatement#setBigDecimal(int, java.math.BigDecimal) */ public void setBigDecimal(int parameterIndex, BigDecimal val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val.toString(); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setURL(int, java.net.URL) */ public void setURL(int parameterIndex, URL val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val.toString(); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setArray(int, java.sql.Array) */ public void setArray(int parameterIndex, Array val) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setBlob(int, java.sql.Blob) */ public void setBlob(int parameterIndex, Blob arg1) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setClob(int, java.sql.Clob) */ public void setClob(int parameterIndex, Clob arg1) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setDate(int, java.sql.Date) */ public void setDate(int parameterIndex, Date val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val.toString(); } /* (non-Javadoc) * @see java.sql.PreparedStatement#getParameterMetaData() */ public ParameterMetaData getParameterMetaData() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setRef(int, java.sql.Ref) */ public void setRef(int parameterIndex, Ref arg1) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#executeQuery() */ public ResultSet executeQuery() throws SQLException { return super.executeQuery(formatSQL()); } /* (non-Javadoc) * @see java.sql.PreparedStatement#getMetaData() */ public ResultSetMetaData getMetaData() throws SQLException { return getResultSet().getMetaData(); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setTime(int, java.sql.Time) */ public void setTime(int parameterIndex, Time val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val.toString(); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp) */ public void setTimestamp(int parameterIndex, Timestamp val) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); values[parameterIndex-1] = val.toString(); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setDate(int, java.sql.Date, java.util.Calendar) */ public void setDate(int parameterIndex, Date val, Calendar cal) throws SQLException { if(parameterIndex<1|parameterIndex>values.length) throw new SQLException("Set value "+parameterIndex+1+": out of range"); cal.setTime(val); values[parameterIndex-1] = cal.toString(); // TODO Auto-generated method stub } /* (non-Javadoc) * @see java.sql.PreparedStatement#setTime(int, java.sql.Time, java.util.Calendar) */ public void setTime(int parameterIndex, Time val, Calendar cal) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp, java.util.Calendar) */ public void setTimestamp(int parameterIndex, Timestamp val, Calendar cal) throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } } --- NEW FILE: CIMCallableStatement.java --- package com.ibm.wbem.jdbc; import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.Socket; import java.net.URL; import java.sql.Array; import java.sql.Blob; import java.sql.CallableStatement; import java.sql.Clob; import java.sql.Date; import java.sql.Ref; import java.sql.SQLException; import java.sql.Time; import java.sql.Timestamp; import java.util.Calendar; import java.util.Map; /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CIMCallableStatement extends CIMPreparedStatement implements CallableStatement { /** * @param s * @param connection * @param sql * @throws SQLException */ public CIMCallableStatement(Socket s, CIMConnection connection, String sql) throws SQLException { super(s, connection, sql); // TODO Auto-generated constructor stub } /** * @param s * @param connection * @param sql * @throws SQLException */ /* (non-Javadoc) * @see java.sql.CallableStatement#wasNull() */ public boolean wasNull() throws SQLException { // TODO Auto-generated method stub return false; } /* (non-Javadoc) * @see java.sql.CallableStatement#getByte(int) */ public byte getByte(int arg0) throws SQLException { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.CallableStatement#getDouble(int) */ public double getDouble(int arg0) throws SQLException { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.CallableStatement#getFloat(int) */ public float getFloat(int arg0) throws SQLException { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.CallableStatement#getInt(int) */ public int getInt(int arg0) throws SQLException { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.CallableStatement#getLong(int) */ public long getLong(int arg0) throws SQLException { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.CallableStatement#getShort(int) */ public short getShort(int arg0) throws SQLException { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.CallableStatement#getBoolean(int) */ public boolean getBoolean(int arg0) throws SQLException { // TODO Auto-generated method stub return false; } /* (non-Javadoc) * @see java.sql.CallableStatement#getBytes(int) */ public byte[] getBytes(int arg0) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#registerOutParameter(int, int) */ public void registerOutParameter(int arg0, int arg1) throws SQLException { // TODO Auto-generated method stub } /* (non-Javadoc) * @see java.sql.CallableStatement#registerOutParameter(int, int, int) */ public void registerOutParameter(int arg0, int arg1, int arg2) throws SQLException { // TODO Auto-generated method stub } /* (non-Javadoc) * @see java.sql.CallableStatement#getObject(int) */ public Object getObject(int arg0) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#getString(int) */ public String getString(int arg0) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#registerOutParameter(int, int, java.lang.String) */ public void registerOutParameter(int arg0, int arg1, String arg2) throws SQLException { // TODO Auto-generated method stub } /* (non-Javadoc) * @see java.sql.CallableStatement#getByte(java.lang.String) */ public byte getByte(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#getDouble(java.lang.String) */ public double getDouble(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#getFloat(java.lang.String) */ public float getFloat(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#getInt(java.lang.String) */ public int getInt(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#getLong(java.lang.String) */ public long getLong(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#getShort(java.lang.String) */ public short getShort(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#getBoolean(java.lang.String) */ public boolean getBoolean(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#getBytes(java.lang.String) */ public byte[] getBytes(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setByte(java.lang.String, byte) */ public void setByte(String arg0, byte arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setDouble(java.lang.String, double) */ public void setDouble(String arg0, double arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setFloat(java.lang.String, float) */ public void setFloat(String arg0, float arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#registerOutParameter(java.lang.String, int) */ public void registerOutParameter(String arg0, int arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setInt(java.lang.String, int) */ public void setInt(String arg0, int arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setNull(java.lang.String, int) */ public void setNull(String arg0, int arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#registerOutParameter(java.lang.String, int, int) */ public void registerOutParameter(String arg0, int arg1, int arg2) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setLong(java.lang.String, long) */ public void setLong(String arg0, long arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setShort(java.lang.String, short) */ public void setShort(String arg0, short arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setBoolean(java.lang.String, boolean) */ public void setBoolean(String arg0, boolean arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setBytes(java.lang.String, byte[]) */ public void setBytes(String arg0, byte[] arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#getBigDecimal(int) */ public BigDecimal getBigDecimal(int arg0) throws SQLException { return new BigDecimal(111); } /* (non-Javadoc) * @see java.sql.CallableStatement#getBigDecimal(int, int) */ public BigDecimal getBigDecimal(int arg0, int arg1) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#getURL(int) */ public URL getURL(int arg0) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#getArray(int) */ public Array getArray(int arg0) throws SQLException { throw new SQLException("Not Implemented: CallableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#getBlob(int) */ public Blob getBlob(int arg0) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#getClob(int) */ public Clob getClob(int arg0) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#getDate(int) */ public Date getDate(int arg0) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#getRef(int) */ public Ref getRef(int arg0) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#getTime(int) */ public Time getTime(int arg0) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#getTimestamp(int) */ public Timestamp getTimestamp(int arg0) throws SQLException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see java.sql.CallableStatement#setAsciiStream(java.lang.String, java.io.InputStream, int) */ public void setAsciiStream(String arg0, InputStream arg1, int arg2) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setBinaryStream(java.lang.String, java.io.InputStream, int) */ public void setBinaryStream(String arg0, InputStream arg1, int arg2) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setCharacterStream(java.lang.String, java.io.Reader, int) */ public void setCharacterStream(String arg0, Reader arg1, int arg2) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#getObject(java.lang.String) */ public Object getObject(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setObject(java.lang.String, java.lang.Object) */ public void setObject(String arg0, Object arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: callableStatement()"); } /* (non-Javadoc) * @see java.sql.CallableStatement#setObject(java.lang.String, java.lang.Object, int) */ public void setObject(String arg0, Object arg1, int arg2) throws SQLException { // TODO Auto-generated method stub throw new SQLExc... [truncated message content] |
From: Viktor M. <mih...@us...> - 2005-06-03 10:32:11
|
Update of /cvsroot/sblim/sfcb/jdbc/htmlviewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13949/jdbc/htmlviewer Added Files: HFrame.java Log Message: Bug fixed 1214077: Added SQL Support (for JDBC). --- NEW FILE: HFrame.java --- /* * Created on 05.04.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package htmlviewer; import java.awt.BorderLayout; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLWarning; import java.sql.Statement; import java.util.Enumeration; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.plaf.basic.BasicComboBoxEditor; import javax.swing.JEditorPane; import javax.swing.JScrollPane; /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class HFrame extends JFrame { final static String header = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" + "<html><head>\n" + "<title>CimSql-query</title>\n" + //"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"" + "</head>\n" + "<body alink=\"#ee0000\" bgcolor=\"#ffffff\" link=\"#0000ee\" text=\"#000000\" vlink=\"#551a8b\"><blockquote>"; final static String startpage = "<html> <body> <br> <br>Please type a command in the command line above</span><br></body></html>"; final static String ft1 = "<font face=\"sans-serif\" size=\"-2\">"; final static String ft2 = "<font face=\"sans-serif\" color=\"#ffffff\">"; final static String ftc = "</font>"; static { try{ Class.forName("com.ibm.wbem.jdbc.CIMDriver"); System.out.println("Treiber gefunden"); } catch(Exception e){ System.out.println("Hm..."); e.printStackTrace(); } } private JEditorPane browser; private JComboBox comandLineBox; private BasicComboBoxEditor cbEditor; private Connection con; private Statement stmt; public HFrame(){ super("CIM-SQL Client"); this.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ //connection lösen try{ stmt.close();//System.out.println("B"); con.close();//System.out.println("C"); } catch (Exception ex) { // TODO: handle exception } //history rausschreiben PrintWriter f; try { f = new PrintWriter(new BufferedWriter(new FileWriter("/home/seyrich/cimsql.hst"))); for(int i=0; i<comandLineBox.getItemCount();i++) f.println((String)comandLineBox.getItemAt(i)); f.close(); } catch (Exception ex) { // TODO: handle exception } System.exit(0); } }); Container contentPane = this.getContentPane(); contentPane.setLayout(new BorderLayout()); readHistory(); initConnection(); comandLineBox.setEditable(true); // comandLineBox.setSelectedIndex(0); cbEditor = new BasicComboBoxEditor(); cbEditor.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { executeQuery(cbEditor.getItem().toString()); } }); comandLineBox.setEditor(cbEditor); contentPane.add(comandLineBox,"North"); cbEditor.selectAll(); browser = new JEditorPane("text/html",startpage); browser.setEditable(false); contentPane.add(new JScrollPane(browser),"Center"); this.setSize(500,500); this.setVisible(true); } /** * */ private void executeQuery(String query) { boolean insert = true; for(int i=0; insert&&i<comandLineBox.getItemCount();i++) insert = !query.equals(comandLineBox.getItemAt(i).toString()); if(insert) comandLineBox.addItem(query); cbEditor.selectAll(); StringBuffer sb = new StringBuffer(header); ResultSet rs; try { rs = stmt.executeQuery(query); SQLWarning sw = stmt.getWarnings(); sb.append("<table bgcolor=\"#180579\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\">"+ "<tbody>\n" + "<tr >\n" + "<td valign=\"top\"><b>"+ft2+"query:"+ftc+"</b></td> " + "<td valign=\"top\"><pre><font color=\"#ffffff\">"+query+"</font><pre>\n" + " </td>\n" + " </tr>\n" + "<tr>\n" + "<td valign=\"top\"><b>"+ft2+"SQLState:"+ftc+"</b></td> " + "<td valign=\"top\">"+ft2+sw.getSQLState()+ftc+"<br>\n" + " </td>\n" + " </tr>\n" + "<tr>\n" + "<td valign=\"top\"><b>"+ft2+"SQLWarningText:"+ftc+"</b></td>\n" + " <td valign=\"top\">"+ft2+sw.getMessage()+ftc+"<br>\n" + "</td>\n" + " </tr>\n" + "</tbody>\n" + "</table>\n" + "<br>"); if(sw.getSQLState().equals("00000")){ ResultSetMetaData rsms = rs.getMetaData(); int col = rsms.getColumnCount(); sb.append("<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" width=\"100%\"><tbody>\n" + "<tr bgcolor=\"#180579\"><td valign=\"top\"><b>"+ft1+ft2+"Name"+ftc+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\"><b>"+ft1+ft2+rsms.getColumnName(i)+ftc+ftc+"</b></td>"); sb.append("</tr><tr bgcolor=\"#ACCDFF\"><td valign=\"top\"><b>"+ft1+"Lable"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.getColumnLabel(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#96B3DE\"><td valign=\"top\"><b>"+ft1+"Tablename"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.getTableName(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#ACCDFF\"><td valign=\"top\"><b>"+ft1+"Typename"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.getColumnTypeName(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#96B3DE\"><td valign=\"top\"><b>"+ft1+"Type"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.getColumnType(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#ACCDFF\"><td valign=\"top\"><b>"+ft1+"TypeClassName"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.getColumnClassName(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#96B3DE\"><td valign=\"top\"><b>"+ft1+"Scale"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.getScale(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#ACCDFF\"><td valign=\"top\"><b>"+ft1+"Precision"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.getPrecision(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#96B3DE\"><td valign=\"top\"><b>"+ft1+"Nullable"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.isNullable(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#ACCDFF\"><td valign=\"top\"><b>"+ft1+"Readonly"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.isReadOnly(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#96B3DE\"><td valign=\"top\"><b>"+ft1+"Signed"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.isSigned(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#ACCDFF\"><td valign=\"top\"><b>"+ft1+"Writeable"+ftc+"</b></td>"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.isWritable(i)+ftc+"</td>"); sb.append("</tr><tr bgcolor=\"#ACCDFF\"><td valign=\"top\"><b>"+ft1+"Displaysize"+ftc+"</b></td>\n"); for (int i = 0; i < col; i++) sb.append("<td valign=\"top\">"+ft1+rsms.getColumnDisplaySize(i)+ftc+"</td>\n"); int j=1; String[] color={"bgcolor = \"#A5C5F5\"","bgcolor = \"#96B3DE\""}; while (rs.next()) { sb.append("</tr><tr><td "+color[j%2]+" valign=\"top\">"+j+"</td>\n"); for (int i = 1; i <= col; i++) { sb.append("<td "+color[j%2]+" valign=\"top\">"+ft1+rs.getString(i)+ftc+"</td>\n"); } j++; } sb.append("</tr></tbody></table>"); int jj=0; System.out.println("Es tut"); rs.close();//System.out.println("A"); } } catch(SQLWarning w){ try{ SQLWarning sw = stmt.getWarnings(); sb.append("<table bgcolor=\"#ffffff\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\">"+ "<tbody>\n" + "<tr >\n" + "<td valign=\"top\"><b>SQLState:</b></td> " + "<td valign=\"top\">"+sw.getSQLState()+"<br>\n" + " </td>\n" + " </tr>\n" + "<tr>\n" + "<td valign=\"top\"><b>SQLWarningText:</b></td>\n" + " <td valign=\"top\"><pre>"+ sw.getMessage()+"</pre><br>\n" + "</td>\n" + " </tr>\n" + "</tbody>\n" + "</table>\n" + "<br>"); }catch(Exception e){} } catch (Exception e) { sb.append("Exception:<br>"); StackTraceElement[] ste = e.getStackTrace(); for(int i=0;i<ste.length;i++) sb.append(ste[i].toString()+"<br>"); } sb.append("</blockquote></body></html>"); PrintWriter f; try { f = new PrintWriter(new BufferedWriter(new FileWriter("/home/seyrich/output.html"))); f.println(sb); f.close(); } catch (Exception ex) { // TODO: handle exception } //System.out.println("Es tut"); browser.setText(sb.toString()); } /** * */ private void initConnection() { try{ Enumeration e = DriverManager.getDrivers(); System.out.println("Installierte Driver:"); while(e.hasMoreElements()){ System.out.println("\t"+(e.nextElement()).toString()); } con = DriverManager.getConnection("127.0.0.1:5980"); stmt = con.createStatement(); } catch (Exception e) { System.out.println("Fehler"); e.printStackTrace(); } } private void readHistory(){ BufferedReader f; String line; if(comandLineBox == null) comandLineBox = new JComboBox(); try{ f = new BufferedReader(new FileReader("/home/seyrich/cimsql.hst")); while((line = f.readLine()) != null) comandLineBox.addItem(line); f.close(); } catch (IOException e) { // TODO: handle exception } } public static void main(String[] args) { new HFrame(); } } |
From: Viktor M. <mih...@us...> - 2005-06-03 10:32:10
|
Update of /cvsroot/sblim/sfcb/jdbc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13949/jdbc Added Files: TestClass.java Log Message: Bug fixed 1214077: Added SQL Support (for JDBC). --- NEW FILE: TestClass.java --- import java.sql.*; import java.util.Enumeration; /* * Created on 18.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class TestClass { static { try{ Class.forName("com.ibm.wbem.jdbc.CIMDriver"); System.out.println("Treiber gefunden"); } catch(Exception e){ System.out.println("Hm..."); e.printStackTrace(); } } // Linux_ComputerSystem %% dyn-9-152-143-58.boeblingen.de.ibm.com %% Linux_OperatingSystem %% dyn-9-152-143-58.boeblingen.de.ibm.com %% Linux_UnixProcess %% 5850 %%Linux (Unix) Process %% This class represents instances of currently running programms. %% NULL %% 5830 %% pts/3 %% su %% /bin %% 24 %% 0 %% 500 %% 5830 %% 0 %% 6 %% 0 %% 0 %% 20050404065827.000000+120 %% su %% su %% 2 %% NULL %% 2 %% // Linux_ComputerSystem", "dyn-9-152-143-58.boeblingen.de.ibm.com", Linux_OperatingSystem" "dyn-9-152-143-58.boeblingen.de.ibm.com" "Linux_UnixProcess" ="5850" // "Linux_ComputerSystem","dyn-9-152-143-58.boeblingen.de.ibm.com", "Linux_OperatingSystem", ,dyn-9-152-143-58.boeblingen.de.ibm.com", "Linux_UnixProcess", "5850","Linux (Unix) Process",="This class represents instances of currently running programms.", "NULL",="5830", "pts/3", "su", "/bin", 24, 0, 500, 5830, 0, 6, =0, =0, 20050404065827.000000+120, "su", "su", =2, "NULL", 2, =2 public static void main(String[] args) { ResultSet rs; Connection con = null; Statement stmt = null; try { Enumeration e = DriverManager.getDrivers(); System.out.println("Installierte Driver:"); while(e.hasMoreElements()){ System.out.println("\t"+(e.nextElement()).toString()); } con = DriverManager.getConnection("127.0.0.1:5980"); //PreparedStatement pstmt = con.prepareStatement("Select Caption, UserModeTime from Linux_UnixProcess where UserModeTime not between ? And ?"); //pstmt.setInt(1,13); //pstmt.setInt(2,4564); //rs = pstmt.executeQuery(); stmt = con.createStatement(); DatabaseMetaData dbmd = con.getMetaData(); ResultSetMetaData rsms; int col,jj; //rs = dbmd.getTables(null,null,"CIM",null); //rs = dbmd.getSuperTables(null,null,"CIM"); // rs = dbmd.getPrimaryKeys(null,null,"Linux_CSBaseBoard"); // rs = dbmd.getPrimaryKeys(null,null,"Linux_CSBaseBoard"); rs = dbmd.getColumns(null,null,"Linux","Capt"); rsms = rs.getMetaData(); col = rsms.getColumnCount(); for (int i = 0; i < col; i++) { System.out.println("classname: "+rsms.getColumnClassName(i)); System.out.println("displaysize: "+rsms.getColumnDisplaySize(i)); System.out.println("columnlable: "+rsms.getColumnLabel(i)); System.out.println("columnnane: "+rsms.getColumnName(i) +" "+i); System.out.println("type: "+rsms.getColumnType(i)); System.out.println("typename: "+rsms.getColumnTypeName(i)); System.out.println("precision: "+rsms.getPrecision(i)); System.out.println("scale: "+rsms.getScale(i)); System.out.println("TableName: "+rsms.getTableName(i)); System.out.println("nullable: "+rsms.isNullable(i)); System.out.println("readOnly: "+rsms.isReadOnly(i)); System.out.println("Signed: "+rsms.isSigned(i)); System.out.println("Writable: "+rsms.isWritable(i)); }jj=0; System.out.println(col); while (rs.next()) { for (int i = 0; i < col; i++) { System.out.print(rs.getString(i+1)+" %% "); } System.out.println(""); } System.out.println("Es tut 1"); // rs.close();//System.out.println("A"); //rs = stmt.executeQuery("Select \n Caption, UserModeTime, a.WorkingSetSize, MaxRealStack, CIM_LogicalElement.ElementName, a.ElementName \n from Linux_UnixProcess as a, CIM_LogicalElement as b"); // rs = stmt.executeQuery("Select Caption, UserModeTime, a.WorkingSetSize, MaxRealStack, CIM_LogicalElement.ElementName, a.ElementName from Linux_UnixProcess as a join CIM_LogicalElement as b on j=k"); // rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess"); // rs = stmt.executeQuery("Select distinct Caption from Linux_UnixProcess"); // rs = stmt.executeQuery("Select ElementName from CIM_LogicalElement"); // rs = stmt.executeQuery("Select distinct * from Linux_UnixProcess fetch first 5 rows only"); //rs = stmt.executeQuery("Select * from Linux_UnixProcess union select Caption, UserModeTime from Linux_UnixProcess"); //rs = stmt.executeQuery("Select * from Linux_UnixProcess union select Caption, UserModeTime from Linux_UnixProcess"); //rs = stmt.executeQuery("(Select Caption, UserModeTime from Linux_UnixProcess union select Caption, UserModeTime from Linux_UnixProcess) union select Caption, UserModeTime from Linux_UnixProcess"); // rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess fetch first 5 rows only unionall select Caption, UserModeTime from Linux_UnixProcess fetch first 5 rows only"); //rs = stmt.executeQuery("(Select Caption, UserModeTime from Linux_UnixProcess union select Caption, UserModeTime from Linux_UnixProcess) union (Select Caption, UserModeTime from Linux_UnixProcess union select Caption, UserModeTime from Linux_UnixProcess)"); // rs = stmt.executeQuery("(Select Caption, UserModeTime from Linux_UnixProcess order by 2 union select Caption, UserModeTime from Linux_UnixProcess) union (Select Caption, UserModeTime from Linux_UnixProcess union select Caption, UserModeTime from Linux_UnixProcess) order by UserModeTime desc fetch first 5 rows only"); //rs = stmt.executeQuery("(Select Caption, UserModeTime from Linux_UnixProcess order by UserModeTime desc fetch first 3 rows only union select Caption, UserModeTime from Linux_UnixProcess order by UserModeTime asc fetch first 5 rows only)order by UserModeTime desc fetch first 5 rows only"); // rs = stmt.executeQuery("(Select Caption, UserModeTime from Linux_UnixProcess order by UserModeTime desc fetch first 3 rows only union select Caption, UserModeTime from Linux_UnixProcess order by UserModeTime asc fetch first 5 rows only)order by UserModeTime desc"); // rs = stmt.executeQuery("(Select Caption, UserModeTime from Linux_UnixProcess)"); //rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess fetch first 9 rows only exceptall select Caption, UserModeTime from Linux_UnixProcess fetch first 5 rows only"); //rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess fetch first 5 rows only intersect select Caption, UserModeTime from Linux_UnixProcess fetch first 5 rows only"); //rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess fetch first 5 rows only intersect select Caption, UserModeTime from Linux_UnixProcess order by Caption fetch first 5 rows only"); //rs = stmt.executeQuery("Select all * from Linux_UnixProcess fetch first 5 rows only union select all * from Linux_UnixProcess order by Caption,UserModeTime fetch first 5 rows only"); //rs = stmt.executeQuery("Select ParentProcessID,UserModeTime from Linux_UnixProcess fetch first 5 rows only union select ParentProcessID,UserModeTime from Linux_UnixProcess order by ParentProcessID,UserModeTime fetch first 5 rows only order by ParentProcessID"); //System.out.println("Select Caption, UserModeTime from Linux_UnixProcess where UserModeTime!='asdads' AND Caption>\'hallo\'"); //rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess where UserModeTime==5 AND Caption>\"hallo\" or UserModeTime between 5 and 6"); // rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess where UserModeTime>100 OR UserModeTime=40 order by UserModeTime");// AND Caption>\"hallo\" or UserModeTime between 5 and 6"); //rs = stmt.executeQuery("Select Caption, UserModeTime as a from Linux_UnixProcess where a>100 OR UserModeTime=40 order by UserModeTime");// AND Caption>\"hallo\" or UserModeTime between 5 and 6"); //rs = stmt.executeQuery("Select Caption, t1.UserModeTime from Linux_UnixProcess as t1 where t1.UserModeTime>100 OR UserModeTime=40 order by UserModeTime");// AND Caption>\"hallo\" or UserModeTime between 5 and 6"); // rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess where UserModeTime not between 40 And 100 order by UserModeTime");// AND Caption>\"hallo\" or UserModeTime between 5 and 6"); //rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess where UserModeTime not between 40 And 100 order by UserModeTime");// AND Caption>\"hallo\" or UserModeTime between 5 and 6"); //rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess where UserModeTime not between 40 And 100 order by UserModeTime");// AND Caption>\"hallo\" or UserModeTime between 5 and 6"); // tut nicht rs = stmt.executeQuery("Select Caption, t1.UserModeTime t2.UserModeTime from Linux_UnixProcess as t1,Linux_UnixProcess as t2 where t1.UserModeTime=t2.UserModeTime and t1.UserModeTime=40 order by UserModeTime");// AND Caption>\"hallo\" or UserModeTime between 5 and 6"); //rs = stmt.executeQuery("Select * from Linux_UnixProcess ,Linux_UnixProcess where t1.UserModeTime=t2.UserModeTime and t1.UserModeTime=40 order by UserModeTime");// AND Caption>\"hallo\" or UserModeTime between 5 and 6"); //rs = stmt.executeQuery("Select * from Linux_UnixProcess fetch first 5 rows only"); //rs = stmt.executeQuery("Select Caption, UserModeTime from Linux_UnixProcess,CIM_LogicalElement where CIM_LogicalElement.Caption=Linux_UnixProcess.Caption ");// AND Caption>\"hallo\" or UserModeTime between 5 and 6"); // rs = stmt.executeQuery("Drop Table test6"); // rs = stmt.executeQuery("Select * from tall"); //rs = stmt.executeQuery("update Linux_UnixProcess set UserModeTime=UserModeTime +-5, Caption=\"99\" where UserModeTime not between 40 And 100 AND Caption>\"hallo\""); // rs = stmt.executeQuery("update test_a set charlie=18"); // rs = stmt.executeQuery("update test6 set s1=18"); // rs = stmt.executeQuery("insert into test_a (hugo,charlie) values (11,1),(12,1),(13,1)"); // rs = stmt.executeQuery("insert into test6 (s2,s1) values (11,1),(12,1),(13,1)"); //rs = stmt.executeQuery("insert into Linux_UnixProcess (UserModeTime,Caption) select UserModeTime,Caption from Linux_UnixProcess"); //rs = stmt.executeQuery("insert into Linux_UnixProcess (UserModeTime,Caption) select * from Linux_UnixProcess"); //rs = stmt.executeQuery("insert into Linux_UnixProcess (UserModeTime,Caption) select Caption,UserModeTime from Linux_UnixProcess"); //rs = stmt.executeQuery("insert into Linux_UnixProcess (UserModeTime,Caption) select UserModeTime,Caption from Linux_UnixProcess"); //rs = stmt.executeQuery("insert into Linux_UnixProcess (UserModeTime,Caption) select distinct UserModeTime,Caption from Linux_UnixProcess"); //rs = stmt.executeQuery("delete from tall"); //rs = stmt.executeQuery("call Linux_UnixProcess.hall9o0(a1,a2,a3)"); // rs = stmt.executeQuery("create table test15 (spaa2 varchar(1) , spbb varchar(1) KEY)"); // rs = stmt.executeQuery("create table test17 (spaa2 varchar(12) , spbb varchar(12) KEY)"); //rs = stmt.executeQuery("create table test6 (s1 int , s2 real KEY)"); // rs = stmt.executeQuery("select * from test13"); // rs = stmt.executeQuery("insert into test_a (charlie, hugo) values (20,30)"); // rs = stmt.executeQuery("insert into test16 (spbb,spaa2) values (112,245), (113,245), (114,245)"); // rs = stmt.executeQuery("insert into test17 (spbb,spaa2) values (\"a\",\"b\"), (\"c\",\"d\"), (\"e\",\"f\")"); // rs = stmt.executeQuery("insert into test (spbb,spaa2) values (3,2), (4,2.321), (2,7.65)"); // rs = stmt.executeQuery("delete from test_a where hugo=3"); // rs = stmt.executeQuery("delete from test6 where s2=11"); // rs = stmt.executeQuery("delete from test6 "); // rs = stmt.executeQuery("select * from test6"); // rs = stmt.executeQuery("delete from test20 "); // rs = stmt.executeQuery("delete from test18 where spbb=2"); // rs = stmt.executeQuery("create table tabhh like CIM_LogicalElement)"); rs = stmt.executeQuery("call test6.sdf ()"); SQLWarning sw = stmt.getWarnings(); System.out.println("SQLState: "+sw.getSQLState()+"\nSQLWarningText: "+sw.getMessage()); if(sw.getSQLState().equals("00000")){ rsms = rs.getMetaData(); col = rsms.getColumnCount(); for (int i = 0; i < col; i++) { System.out.println("classname: "+rsms.getColumnClassName(i)); System.out.println("displaysize: "+rsms.getColumnDisplaySize(i)); System.out.println("columnlable: "+rsms.getColumnLabel(i)); System.out.println("columnnane: "+rsms.getColumnName(i) +" "+i); System.out.println("type: "+rsms.getColumnType(i)); System.out.println("typename: "+rsms.getColumnTypeName(i)); System.out.println("precision: "+rsms.getPrecision(i)); System.out.println("scale: "+rsms.getScale(i)); System.out.println("TableName: "+rsms.getTableName(i)); System.out.println("nullable: "+rsms.isNullable(i)); System.out.println("readOnly: "+rsms.isReadOnly(i)); System.out.println("Signed: "+rsms.isSigned(i)); System.out.println("Writable: "+rsms.isWritable(i)); } jj=0; System.out.println(col); while (rs.next()) { for (int i = 0; i < col; i++) { System.out.print(rs.getString(i+1)+" %% "); } System.out.println(""); } System.out.println("Es tut 3"); rs.close();//System.out.println("A"); } stmt.close();//System.out.println("B"); con.close();//System.out.println("C"); } catch (Exception e) { System.out.println("Fehler"); e.printStackTrace(); try { stmt.close();//System.out.println("B"); con.close();//System.out.println("C"); } catch (Exception sss) { // TODO: handle exception } // TODO: handle exception } /*String s ="TestTable::Column01;varchar(123456789);true;1;false::Column02;DOUBLE;false;0;false::Column03;DECIMAL(3,2);true;1;false"; String[] ss = s.split("::"); for (int i = 0; i < ss.length; i++) { System.out.println(ss[i]); String[] sss = ss[i].split(";"); for (int j = 0; j < sss.length; j++) { System.out.println(sss[j]); } }*/ } } |
From: Viktor M. <mih...@us...> - 2005-06-03 10:27:15
|
Update of /cvsroot/sblim/sfcb/jdbc/com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12133/com Log Message: Directory /cvsroot/sblim/sfcb/jdbc/com added to the repository |
From: Viktor M. <mih...@us...> - 2005-06-03 10:27:13
|
Update of /cvsroot/sblim/sfcb/jdbc/htmlviewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12133/htmlviewer Log Message: Directory /cvsroot/sblim/sfcb/jdbc/htmlviewer added to the repository |
From: Viktor M. <mih...@us...> - 2005-06-03 10:27:13
|
Update of /cvsroot/sblim/sfcb/jdbc/com/ibm/wbem/jdbc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12133/com/ibm/wbem/jdbc Log Message: Directory /cvsroot/sblim/sfcb/jdbc/com/ibm/wbem/jdbc added to the repository |
From: Viktor M. <mih...@us...> - 2005-06-03 10:27:13
|
Update of /cvsroot/sblim/sfcb/jdbc/com/ibm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12133/com/ibm Log Message: Directory /cvsroot/sblim/sfcb/jdbc/com/ibm added to the repository |
From: Viktor M. <mih...@us...> - 2005-06-03 10:27:13
|
Update of /cvsroot/sblim/sfcb/jdbc/com/ibm/wbem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12133/com/ibm/wbem Log Message: Directory /cvsroot/sblim/sfcb/jdbc/com/ibm/wbem added to the repository |
From: Viktor M. <mih...@us...> - 2005-06-03 10:25:39
|
Update of /cvsroot/sblim/sfcb/jdbc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10946/jdbc Log Message: Directory /cvsroot/sblim/sfcb/jdbc added to the repository |
From: Gareth S B. <bes...@us...> - 2005-06-03 05:25:25
|
Update of /cvsroot/sblim/cmpi-tests/cmpi-lifecycleindicationtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18647 Modified Files: Makefile.am Log Message: install xml test files and add runtest rule Index: Makefile.am =================================================================== RCS file: /cvsroot/sblim/cmpi-tests/cmpi-lifecycleindicationtest/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.am 26 May 2005 21:01:31 -0000 1.1.1.1 +++ Makefile.am 3 Jun 2005 05:25:12 -0000 1.2 @@ -79,7 +79,56 @@ sh provider-register.sh -d -t @CIMSERVER@ -r $(REGS) -m $(MOFS) # Add the schema files to the distribution file list -pkgdata_DATA=$(MOFS) $(REGISTRATIONS) +pkgdata_DATA=$(MOFS) $(REGS) pkgdata_SCRIPTS=provider-register.sh EXTRA_DIST+=schema $(pkgdata_DATA) $(pkgdata_SCRIPTS) +# ----------------------------------------------------------------------------- +# Automake instructions for tests +# ----------------------------------------------------------------------------- + +# LIST ALL THE TEST XML CLIENT REQUEST FILES HERE +TESTXML=test/Test001.DeleteFilter01.xml \ + test/Test002.DeleteHandler01.xml \ + test/Test003.DeleteSubscription01.xml \ + test/Test004.CreateSubscription01.xml \ + test/Test005.CreateFilter01.xml \ + test/Test006.CreateSubscription01.xml \ + test/Test007.CreateHandler01.xml \ + test/Test008.CreateSubscription01.xml \ + test/Test009.CreateInstance.xml \ + test/Test010.DeleteInstance.xml \ + test/Test011.ModifyInstance.xml \ + test/Test012.DeleteFilter01.xml \ + test/Test013.DeleteHandler01.xml \ + test/Test014.DeleteSubscription01.xml \ + test/Test015.DeleteFilter01.xml \ + test/Test016.DeleteHandler01.xml + +# LIST ALL THE TEST EXPECTED RESPONSE OK FILES HERE +TESTOK=test/Test001.DeleteFilter01.OK \ + test/Test002.DeleteHandler01.OK \ + test/Test003.DeleteSubscription01.OK \ + test/Test004.CreateSubscription01.OK \ + test/Test005.CreateFilter01.OK \ + test/Test006.CreateSubscription01.OK \ + test/Test007.CreateHandler01.OK \ + test/Test008.CreateSubscription01.OK \ + test/Test009.CreateInstance.OK \ + test/Test010.DeleteInstance.OK \ + test/Test011.ModifyInstance.OK \ + test/Test012.DeleteFilter01.OK \ + test/Test013.DeleteHandler01.OK \ + test/Test014.DeleteSubscription01.OK \ + test/Test015.DeleteFilter01.OK \ + test/Test016.DeleteHandler01.OK + +# Install the XML tests under the package's data directory +testxmldir=$(datadir)/$(PACKAGE)/xmltest +testxml_DATA=$(TESTXML) $(TESTOK) +testxml_SCRIPTS= + +# Run all the package XML tests in order +runtest: + xmltest $(datadir)/$(PACKAGE)/xmltest + |
From: Gareth S B. <bes...@us...> - 2005-06-03 04:07:07
|
Update of /cvsroot/sblim/cmpi-tests/cmpi-processindicationtest/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13685 Added Files: Test012.DeleteFilter01.OK Test013.DeleteHandler01.OK Log Message: added missing test OK files --- NEW FILE: Test012.DeleteFilter01.OK --- <?xml version="1.0" encoding="utf-8" ?> <CIM CIMVERSION="2.0" DTDVERSION="1.1"> <MESSAGE ID="130001" PROTOCOLVERSION="1.0"> <SIMPLERSP> <IMETHODRESPONSE NAME="DeleteInstance"> <IRETURNVALUE> </IRETURNVALUE> </IMETHODRESPONSE> </SIMPLERSP> </MESSAGE> </CIM> --- NEW FILE: Test013.DeleteHandler01.OK --- <?xml version="1.0" encoding="utf-8" ?> <CIM CIMVERSION="2.0" DTDVERSION="1.1"> <MESSAGE ID="140001" PROTOCOLVERSION="1.0"> <SIMPLERSP> <IMETHODRESPONSE NAME="DeleteInstance"> <IRETURNVALUE> </IRETURNVALUE> </IMETHODRESPONSE> </SIMPLERSP> </MESSAGE> </CIM> |
From: Gareth S B. <bes...@us...> - 2005-06-02 20:23:06
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30437 Modified Files: xmltest Log Message: Index: xmltest =================================================================== RCS file: /cvsroot/sblim/sfcb/xmltest,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- xmltest 2 Jun 2005 17:23:53 -0000 1.1 +++ xmltest 2 Jun 2005 20:22:54 -0000 1.2 @@ -82,7 +82,7 @@ if [[ -d $1 ]]; then _DIR=$1 else - _DIR=$PWD + _DIR=./ fi # Look for all *.xml test files and run them in sorted order (hence tests should be numbered) |
From: Gareth S B. <bes...@us...> - 2005-06-02 19:54:54
|
Update of /cvsroot/sblim/cmpi-tests/cmpi-reef/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16208/src Modified Files: TST_Reef.c Log Message: fixes for http://sourceforge.net/tracker/index.php?func=detail&aid=1213754&group_id=128809&atid=712784 Index: TST_Reef.c =================================================================== RCS file: /cvsroot/sblim/cmpi-tests/cmpi-reef/src/TST_Reef.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- TST_Reef.c 10 May 2005 00:01:34 -0000 1.1.1.1 +++ TST_Reef.c 2 Jun 2005 19:54:45 -0000 1.2 @@ -1,4 +1,3 @@ - /* * TST_Reef.c * @@ -32,51 +31,45 @@ #include "TST_Reef.h" typedef unsigned char UCHAR; -typedef int INT32; - +typedef int INT32; - typedef struct SmRasMrLogicalVolumeStruct - { - UCHAR storFacilImageMTMS[18]; - INT32 volumeType; - UCHAR logicalVolumeNum[3]; - UCHAR logicalSubsystem[2]; - INT32 lssGroup; - UCHAR addressGroup[2]; - INT32 aliasVolumeGroup; - UCHAR origBaseLogVolNum[3]; - UCHAR userName[17]; - INT32 segPool; - INT32 dataType; - INT32 dynamicSegAlloc; - INT32 dataSharingAllowed; - INT32 overridDefPriority; - INT32 defPriorityOverVal; - INT32 ckdPriorityOffset; - INT32 requestedCapacity; - INT32 capacity; - INT32 deviceMTM; - UCHAR ckdVolumeSerialNum[7]; - INT32 accessState; - INT32 dataState; - INT32 configurationState; - INT32 creationDate; - UCHAR codeLevel[17]; - } SmRasMrLogicalVolume; +typedef struct SmRasMrLogicalVolumeStruct { + UCHAR storFacilImageMTMS[18]; + INT32 volumeType; + UCHAR logicalVolumeNum[3]; + UCHAR logicalSubsystem[2]; + INT32 lssGroup; + UCHAR addressGroup[2]; + INT32 aliasVolumeGroup; + UCHAR origBaseLogVolNum[3]; + UCHAR userName[17]; + INT32 segPool; + INT32 dataType; + INT32 dynamicSegAlloc; + INT32 dataSharingAllowed; + INT32 overridDefPriority; + INT32 defPriorityOverVal; + INT32 ckdPriorityOffset; + INT32 requestedCapacity; + INT32 capacity; + INT32 deviceMTM; + UCHAR ckdVolumeSerialNum[7]; + INT32 accessState; + INT32 dataState; + INT32 configurationState; + INT32 creationDate; + UCHAR codeLevel[17]; +} SmRasMrLogicalVolume; static CMPIBroker * _broker; -static char * _ClassName = "Reef_LogicalVolume"; +static char * _ClassName = "Reef_LogicalVolume"; +static SmRasMrLogicalVolume next_lv; #define REEF_MAX_STRING_SIZE 256 -//#define REEF_NUM_INSTANCES 16000 +//#define REEF_NUM_INSTANCES 16000 #define REEF_NUM_INSTANCES 4000 // ========================================================================== - -SmRasMrLogicalVolume next_lv; - -// ========================================================================== - // Property names. These values are returned by the provider as // the property names. // ========================================================================== @@ -106,179 +99,214 @@ #define PROPERTY_LOGICAL_VOLUME_CREATION_DATE "creationDate" #define PROPERTY_LOGICAL_VOLUME_CODE_LEVEL "codeLevel" +// ========================================================================== -void -make_dummy_LogicalVolume(void) +void make_dummy_LogicalVolume( void ) { - /* Fill the object */ - - memset( (char *)&next_lv, 0, sizeof(SmRasMrLogicalVolume)); - - strcpy((char *)next_lv.storFacilImageMTMS, "storFacilImageM"); - next_lv.volumeType = 5; - - next_lv.capacity = 89+7; - next_lv.deviceMTM = 98 * 7; - next_lv.dataState = 5665%1000; - next_lv.configurationState = 4 + 16000; - next_lv.overridDefPriority = 999; - strcpy((char *)next_lv.codeLevel, "aaabbbccc"); - next_lv.segPool = 999%1000; - next_lv.lssGroup = 16000 - 7; - next_lv.aliasVolumeGroup = 45 * 3; - next_lv.dataType = 56%10; - strcpy((char *)next_lv.ckdVolumeSerialNum, "abcdef"); - strcpy((char *)next_lv.userName, "Avi Weit"); - + /* Fill the object */ + memset( (char *)&next_lv, 0, sizeof(SmRasMrLogicalVolume)); + + strcpy((char *)next_lv.storFacilImageMTMS, "storFacilImageM"); + next_lv.volumeType = 5; + next_lv.capacity = 89+7; + next_lv.deviceMTM = 98 * 7; + next_lv.dataState = 5665%1000; + next_lv.configurationState = 4 + 16000; + next_lv.overridDefPriority = 999; + strcpy((char *)next_lv.codeLevel, "aaabbbccc"); + next_lv.segPool = 999%1000; + next_lv.lssGroup = 16000 - 7; + next_lv.aliasVolumeGroup = 45 * 3; + next_lv.dataType = 56%10; + strcpy((char *)next_lv.ckdVolumeSerialNum, "abcdef"); + strcpy((char *)next_lv.userName, "Avi Weit"); } -CMPIStatus Reef_ProviderCleanup( CMPIInstanceMI * mi, - CMPIContext * ctx) { +// ========================================================================== - CMReturn(CMPI_RC_OK); +CMPIStatus Reef_ProviderCleanup( + CMPIInstanceMI * mi, + CMPIContext * ctx) +{ + CMReturn(CMPI_RC_OK); } +// ========================================================================== -CMPIStatus Reef_ProviderEnumInstanceNames( CMPIInstanceMI * mi, - CMPIContext * ctx, - CMPIResult * rslt, - CMPIObjectPath * ref) { - - CMPIStatus rc = {CMPI_RC_OK, NULL}; - - CMSetStatusWithChars( _broker, &rc, - CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); +CMPIStatus Reef_ProviderEnumInstanceNames( + CMPIInstanceMI * mi, + CMPIContext * ctx, + CMPIResult * rslt, + CMPIObjectPath * ref) +{ + CMPIInstance* ci = NULL; + CMPIObjectPath* op = NULL; + CMPIStatus rc = {CMPI_RC_OK, NULL}; + int i = 0; + CMPISint32 key = 0; - return rc; + /* temporary */ + make_dummy_LogicalVolume(); + + do { + ci = _makeInst_Reef_LogicalVolume( _broker, ctx, ref, &rc ); + + if( ci == NULL || rc.rc != CMPI_RC_OK ) { + //printf("Reef_ProviderEnumInstances: Error occured"); + CMSetStatusWithChars( _broker, &rc, + CMPI_RC_ERR_FAILED, "Transformation from internal structure to CIM Instance failed." ); + goto exit; + } + + key++; + CMSetProperty(ci,"key",&key,CMPI_sint32); + + op = CMGetObjectPath(ci, NULL); + CMSetNameSpace(op,CMGetCharPtr(CMGetNameSpace(ref,NULL))); + rc = CMReturnObjectPath( rslt, op ); + if( rc.rc != CMPI_RC_OK ) printf("Error in CMReturnInstance!!\n"); + + //printf("Returned instance num: %d\n"); + i++; + if ( i == REEF_NUM_INSTANCES ) break; + } while(1); + CMReturnDone( rslt ); + +exit: + return rc; } -CMPIStatus Reef_ProviderEnumInstances( CMPIInstanceMI * mi, - CMPIContext * ctx, - CMPIResult * rslt, - CMPIObjectPath * ref, - char ** properties) { - CMPIInstance* ci = NULL; - CMPIStatus rc = {CMPI_RC_OK, NULL}; - int i= 0; - CMPISint32 key=0; +// ========================================================================== + +CMPIStatus Reef_ProviderEnumInstances( + CMPIInstanceMI * mi, + CMPIContext * ctx, + CMPIResult * rslt, + CMPIObjectPath * ref, + char ** properties) +{ + CMPIInstance* ci = NULL; + CMPIStatus rc = {CMPI_RC_OK, NULL}; + int i = 0; + CMPISint32 key = 0; - /* temporary */ - make_dummy_LogicalVolume(); + /* temporary */ + make_dummy_LogicalVolume(); - do - { - ci = _makeInst_Reef_LogicalVolume( _broker, ctx, ref, &rc ); - + do { + ci = _makeInst_Reef_LogicalVolume( _broker, ctx, ref, &rc ); - if( ci == NULL || rc.rc != CMPI_RC_OK ) { - + if( ci == NULL || rc.rc != CMPI_RC_OK ) { //printf("Reef_ProviderEnumInstances: Error occured"); CMSetStatusWithChars( _broker, &rc, CMPI_RC_ERR_FAILED, "Transformation from internal structure to CIM Instance failed." ); goto exit; - } + } - key++; - CMSetProperty(ci,"key",&key,CMPI_sint32); + key++; + CMSetProperty(ci,"key",&key,CMPI_sint32); - rc = CMReturnInstance( rslt, ci ); - if( rc.rc != CMPI_RC_OK ) - printf("Error in CMReturnInstance!!\n"); + rc = CMReturnInstance( rslt, ci ); + if( rc.rc != CMPI_RC_OK ) printf("Error in CMReturnInstance!!\n"); - //printf("Returned instance num: %d\n"); - i++; - if ( i == REEF_NUM_INSTANCES ) - break; - - }while(1); - CMReturnDone( rslt ); + //printf("Returned instance num: %d\n"); + i++; + if ( i == REEF_NUM_INSTANCES ) break; + } while(1); + CMReturnDone( rslt ); - exit: - return rc; +exit: + return rc; } -CMPIStatus Reef_ProviderGetInstance( CMPIInstanceMI * mi, - CMPIContext * ctx, - CMPIResult * rslt, - CMPIObjectPath * cop, - char ** properties) { - - CMPIStatus rc = {CMPI_RC_OK, NULL}; +// ========================================================================== + +CMPIStatus Reef_ProviderGetInstance( + CMPIInstanceMI * mi, + CMPIContext * ctx, + CMPIResult * rslt, + CMPIObjectPath * cop, + char ** properties) +{ + CMPIStatus rc = {CMPI_RC_OK, NULL}; - CMSetStatusWithChars( _broker, &rc, - CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); - return rc; -} + CMSetStatusWithChars( _broker, &rc, CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); + return rc; +} +// ========================================================================== -CMPIStatus Reef_ProviderCreateInstance( CMPIInstanceMI * mi, - CMPIContext * ctx, - CMPIResult * rslt, - CMPIObjectPath * cop, - CMPIInstance * ci) { - CMPIStatus rc = {CMPI_RC_OK, NULL}; - - CMSetStatusWithChars( _broker, &rc, - CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); +CMPIStatus Reef_ProviderCreateInstance( + CMPIInstanceMI * mi, + CMPIContext * ctx, + CMPIResult * rslt, + CMPIObjectPath * cop, + CMPIInstance * ci) +{ + CMPIStatus rc = {CMPI_RC_OK, NULL}; + CMSetStatusWithChars( _broker, &rc, CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); - return rc; + return rc; } -CMPIStatus Reef_ProviderSetInstance( CMPIInstanceMI * mi, - CMPIContext * ctx, - CMPIResult * rslt, - CMPIObjectPath * cop, - CMPIInstance * ci, - char **properties) { +// ========================================================================== - CMPIStatus rc = {CMPI_RC_OK, NULL}; +CMPIStatus Reef_ProviderSetInstance( + CMPIInstanceMI * mi, + CMPIContext * ctx, + CMPIResult * rslt, + CMPIObjectPath * cop, + CMPIInstance * ci, + char **properties) +{ + CMPIStatus rc = {CMPI_RC_OK, NULL}; - CMSetStatusWithChars( _broker, &rc, - CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); + CMSetStatusWithChars( _broker, &rc, CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); - return rc; + return rc; } +// ========================================================================== -CMPIStatus Reef_ProviderDeleteInstance( CMPIInstanceMI * mi, - CMPIContext * ctx, - CMPIResult * rslt, - CMPIObjectPath * cop) { +CMPIStatus Reef_ProviderDeleteInstance( + CMPIInstanceMI * mi, + CMPIContext * ctx, + CMPIResult * rslt, + CMPIObjectPath * cop) +{ + CMPIStatus rc = {CMPI_RC_OK, NULL}; - CMPIStatus rc = {CMPI_RC_OK, NULL}; - - - - CMSetStatusWithChars( _broker, &rc, - CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); + CMSetStatusWithChars( _broker, &rc, CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); - return rc; + return rc; } +// ========================================================================== -CMPIStatus Reef_ProviderExecQuery( CMPIInstanceMI * mi, - CMPIContext * ctx, - CMPIResult * rslt, - CMPIObjectPath * ref, - char * lang, - char * query) { - - CMPIStatus rc = {CMPI_RC_OK, NULL}; +CMPIStatus Reef_ProviderExecQuery( + CMPIInstanceMI * mi, + CMPIContext * ctx, + CMPIResult * rslt, + CMPIObjectPath * ref, + char * lang, + char * query) +{ + CMPIStatus rc = {CMPI_RC_OK, NULL}; - CMSetStatusWithChars( _broker, &rc, - CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); + CMSetStatusWithChars( _broker, &rc, CMPI_RC_ERR_NOT_SUPPORTED, "CIM_ERR_NOT_SUPPORTED" ); - return rc; + return rc; } +// ========================================================================== + CMPIInstance *_makeInst_Reef_LogicalVolume( CMPIBroker *_broker, CMPIContext *ctx, CMPIObjectPath *ref, CMPIStatus *rc) { - CMPIObjectPath *op = NULL; CMPIInstance *ci = NULL; char s[REEF_MAX_STRING_SIZE]; @@ -381,6 +409,8 @@ return ci; } +// ========================================================================== + /* * The following functions are for retrieving information * from LogicalVolume class @@ -511,7 +541,7 @@ strcpy(s, (char *)next_lv.codeLevel); } - +// ========================================================================== /* Our provider is currently Instance Provider only */ |
From: Gareth S B. <bes...@us...> - 2005-06-02 19:54:54
|
Update of /cvsroot/sblim/cmpi-tests/cmpi-reef In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16208 Modified Files: Makefile.am Log Message: fixes for http://sourceforge.net/tracker/index.php?func=detail&aid=1213754&group_id=128809&atid=712784 Index: Makefile.am =================================================================== RCS file: /cvsroot/sblim/cmpi-tests/cmpi-reef/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.am 10 May 2005 00:01:34 -0000 1.1.1.1 +++ Makefile.am 2 Jun 2005 19:54:45 -0000 1.2 @@ -98,8 +98,8 @@ # LIST ALL THE PROVIDER TEST SCRIPTS AND DATA FILES HERE testsuite_SCRIPTS=test/test-@PACKAGE@.sh -testsuitesystem_DATA= -testsuitesystem_SCRIPTS= +testsuitesystem_DATA=test/system/linux/Reef_LogicalVolume.system +testsuitesystem_SCRIPTS=test/system/linux/Reef_LogicalVolume.pl testsuitecim_DATA=test/cim/Reef_LogicalVolume.cim # Run the package test script |
From: Gareth S B. <bes...@us...> - 2005-06-02 19:54:54
|
Update of /cvsroot/sblim/cmpi-tests/cmpi-reef/test/cim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16208/test/cim Modified Files: Reef_LogicalVolume.cim Log Message: fixes for http://sourceforge.net/tracker/index.php?func=detail&aid=1213754&group_id=128809&atid=712784 Index: Reef_LogicalVolume.cim =================================================================== RCS file: /cvsroot/sblim/cmpi-tests/cmpi-reef/test/cim/Reef_LogicalVolume.cim,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Reef_LogicalVolume.cim 10 May 2005 00:01:34 -0000 1.1.1.1 +++ Reef_LogicalVolume.cim 2 Jun 2005 19:54:45 -0000 1.2 @@ -4,7 +4,6 @@ -------------------------------------------------------------------------------- Instance enumInstanceNames -Expected Exception : NOT_SUPPORTED -------------------------------------------------------------------------------- Instance enumInstances @@ -22,6 +21,10 @@ Expected Exception : NOT_SUPPORTED -------------------------------------------------------------------------------- +Instance delete +Expected Exception : NOT_SUPPORTED + +-------------------------------------------------------------------------------- Instance execQuery Expected Exception : NOT_SUPPORTED |
From: Gareth S B. <bes...@us...> - 2005-06-02 19:54:54
|
Update of /cvsroot/sblim/cmpi-tests/cmpi-reef/test/system/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16208/test/system/linux Added Files: Reef_LogicalVolume.pl Reef_LogicalVolume.system Log Message: fixes for http://sourceforge.net/tracker/index.php?func=detail&aid=1213754&group_id=128809&atid=712784 --- NEW FILE: Reef_LogicalVolume.pl --- #!/usr/bin/perl # Script to generate actual system process data. # This data is used by SBLIM testsuite scripts to check the consistency # of the process data obtained via CIM from the CMPI provider. use strict; use warnings; my $className="Reef_LogicalVolume.instance"; my $INST_FILE; my $IN=$ARGV[0]; if(defined $IN) { if($IN =~ /-rm/) { unlink("$className"); exit 0; } } if( !open($INST_FILE,'>', "$className")) { print "can not open $className\n"; exit 0; } for (my $i=1; $i<=4000; $i++) { print $INST_FILE "$i\n"; print $INST_FILE "\n"; } --- NEW FILE: Reef_LogicalVolume.system --- ******************************************************************************** class : Reef_LogicalVolume -------------------------------------------------------------------------------- Reef_LogicalVolume : -eq 4000 -------------------------------------------------------------------------------- storageFacilityImageMTMS : -eq storFacilImageM volumeType : -eq 5 lssGroup : -eq 15993 aliasVolumeGroup : -eq 135 userName : -eq Avi Weit segPool : -eq 999 dataType : -eq 6 dynamicSegAlloc : -eq 0 dataSharingAllowed : -eq 0 overridDefPriority : -eq 999 defPriorityOverVal : -eq 0 ckdPriorityOffset : -eq 0 requestedCapacity : -eq 0 capacity : -eq 96 deviceMTM : -eq 686 ckdVolumeSerialNum : -eq abcdef accessState : -eq 0 dataState : -eq 665 configurationState : -eq 16004 creationDate : -eq 0 codeLevel : -eq aaabbbccc key : -set -------------------------------------------------------------------------------- Instance Level : Reef_LogicalVolume.pl Property Order : key |
From: Gareth S B. <bes...@us...> - 2005-06-02 19:52:39
|
Update of /cvsroot/sblim/cmpi-tests/cmpi-reef/test/system/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15106/linux Log Message: Directory /cvsroot/sblim/cmpi-tests/cmpi-reef/test/system/linux added to the repository |
From: Gareth S B. <bes...@us...> - 2005-06-02 19:52:03
|
Update of /cvsroot/sblim/cmpi-tests/cmpi-reef/test/system In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14716/system Log Message: Directory /cvsroot/sblim/cmpi-tests/cmpi-reef/test/system added to the repository |
From: Gareth S B. <bes...@us...> - 2005-06-02 18:02:01
|
Update of /cvsroot/sblim/wbemcli In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17180 Modified Files: Makefile.am Log Message: fix for http://sourceforge.net/tracker/index.php?func=detail&aid=1200308&group_id=128809&atid=712784 Index: Makefile.am =================================================================== RCS file: /cvsroot/sblim/wbemcli/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.am 2 Jun 2005 17:31:31 -0000 1.4 +++ Makefile.am 2 Jun 2005 18:01:49 -0000 1.5 @@ -34,6 +34,7 @@ install-exec-hook: cd $(DESTDIR)$(bindir) && \ + $(RM) wbemgi$(EXEEXT) && \ $(RM) wbemci$(EXEEXT) && \ $(RM) wbemdi$(EXEEXT) && \ $(RM) wbemecn$(EXEEXT) && \ @@ -52,6 +53,7 @@ $(RM) wbemsp$(EXEEXT) && \ $(RM) wbemcm$(EXEEXT) && \ $(RM) wbemcmx$(EXEEXT) && \ + $(LN_S) wbemcli$(EXEEXT) wbemgi$(EXEEXT) && \ $(LN_S) wbemcli$(EXEEXT) wbemci$(EXEEXT) && \ $(LN_S) wbemcli$(EXEEXT) wbemdi$(EXEEXT) && \ $(LN_S) wbemcli$(EXEEXT) wbemecn$(EXEEXT) && \ @@ -72,6 +74,7 @@ $(LN_S) wbemcli$(EXEEXT) wbemcmx$(EXEEXT) uninstall-hook: cd $(DESTDIR)$(bindir) && \ + $(RM) wbemgi$(EXEEXT) && \ $(RM) wbemci$(EXEEXT) && \ $(RM) wbemdi$(EXEEXT) && \ $(RM) wbemecn$(EXEEXT) && \ |
From: Gareth S B. <bes...@us...> - 2005-06-02 17:31:52
|
Update of /cvsroot/sblim/wbemcli In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30687 Modified Files: Makefile.am Log Message: added NOP makefile entries for postinstall and runtest, so conform a bit cleaner to typical SBLIM autoconf package install procedure. Index: Makefile.am =================================================================== RCS file: /cvsroot/sblim/wbemcli/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile.am 5 Apr 2005 12:11:04 -0000 1.3 +++ Makefile.am 2 Jun 2005 17:31:31 -0000 1.4 @@ -93,3 +93,7 @@ dist-hook: $(RM) -r `find $(distdir) -name CVS` + +postinstall: + +runtest: |
From: Gareth S B. <bes...@us...> - 2005-06-02 17:24:05
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27703 Modified Files: Makefile.am wbemcat Added Files: xmltest Removed Files: xmltest.sh Log Message: renamed xmltest.sh to xmltest for convenience --- xmltest.sh DELETED --- Index: wbemcat =================================================================== RCS file: /cvsroot/sblim/sfcb/wbemcat,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- wbemcat 10 May 2005 18:00:37 -0000 1.3 +++ wbemcat 2 Jun 2005 17:23:53 -0000 1.4 @@ -1,5 +1,4 @@ #!/usr/bin/perl -# $Id: # ============================================================================ # wbemcat # @@ -14,7 +13,6 @@ # # Author: Adrian Schuur, <sc...@de...> # Contributors: Dr. Gareth S. Bestor, <bes...@us...> -# Last Updated: April 25, 2005 # Description: # Utility to send CIM-XML request file to a CIMOM and display # the response/results. Default CIMOM is localhost:5988. Index: Makefile.am =================================================================== RCS file: /cvsroot/sblim/sfcb/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Makefile.am 27 May 2005 22:49:54 -0000 1.21 +++ Makefile.am 2 Jun 2005 17:23:52 -0000 1.22 @@ -155,7 +155,7 @@ nodist_bin_SCRIPTS=sfcbrepos sfcbstage sfcbunstage -dist_bin_SCRIPTS=wbemcat xmltest.sh +dist_bin_SCRIPTS=wbemcat xmltest init_SCRIPTS=sfcb --- NEW FILE: xmltest --- #!/bin/sh # ============================================================================ # xmltest # # (C) Copyright IBM Corp. 2005 # # THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE # ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE # CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. # # You can obtain a current copy of the Common Public License from # http://oss.software.ibm.com/developerworks/opensource/license-cpl.html # # Author: Dr. Gareth S. Bestor, <bes...@us...> # Contributors: Adrian Schuur, <sc...@de...> # Description: # Simple test program to send CIM-XML test request files to a CIMOM and # compare the returned results to an expected response file. # If test file is specified then run only that test. If test directory is # specified then run all tests in the directory in sorted order. If no test # file or directory specified then run all tests in the current directory. # ============================================================================ _RC=0 # Check for wbemcat utility if ! which wbemcat > /dev/null; then echo "Cannot find wbemcat. Please check your PATH" exit 1 fi # ------------------------------------------------------------------------------ function _runxmltest { typeset _TESTXML=$1 _TEST=${_TESTXML%.xml} _TESTDIR=$( dirname $_TEST) _TESTOK=$_TEST.OK _TESTRESULT=$_TEST.result echo -n "Running test $_TESTXML ... " # Make sure we will be able to write the result file if [[ ! -w $_TESTDIR ]]; then echo "FAILED"; echo -e "\tCannot write to $_TESTDIR" continue fi # Remove any old test result file rm -f $_TESTRESULT # Send the test CIM-XML to the CIMOM and save the response, stripping off the http header wbemcat $_TESTXML | awk "{i++; if (i>7) print}" > $_TESTRESULT if [[ $? -ne 0 ]]; then echo "FAILED"; echo -e "\twbemcat failed to send CIM-XML request" _RC=1 continue fi # If we dont yet have the expected result file, then save this response as the (new) expected result if [[ ! -f $_TESTOK ]]; then echo "OK"; echo -e "\tSaving response as $_TESTOK" mv $_TESTRESULT $_TESTOK # Compare the response XML against the expected XML for differences elif ! diff --brief $_TESTOK $_TESTRESULT > /dev/null; then echo "FAILED"; echo -e "\tCheck $_TESTRESULT for errors" _RC=1; continue # We got the expected response XML else echo "Passed" rm -f $_TESTRESULT fi } # ------------------------------------------------------------------------------ if [[ -f $1 ]]; then _runxmltest $1 else if [[ -d $1 ]]; then _DIR=$1 else _DIR=$PWD fi # Look for all *.xml test files and run them in sorted order (hence tests should be numbered) find $_DIR -name "*.xml" | sort | while read _TESTXML; do _runxmltest $_TESTXML # Wait for the dust to settle before trying the next test... sleep 1 done fi exit $_RC |