First version
[csql.git] / src / storage / CatalogTables.cxx
blob8bd4242d1d15b282a8ee6bd341346ded789da73a
1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 ***************************************************************************/
16 #include<CatalogTables.h>
17 #include<Database.h>
18 #include<Allocator.h>
19 #include<Field.h>
20 #include<Debug.h>
21 char ChunkName[MAX_CHUNKS][CHUNK_NAME_LEN]={"UserChunkTableId","LockTableHashBucketId","LockTableMutexId","LockTableId","TransHasTableId","UndoLogTableId","","","","","DatabaseTableId","UserTableId","TableTableId","FieldTableId","AccessTableId","IndexTableId","IndexFieldTableId",""};
24 DbRetVal CatalogTableTABLE::insert(const char *name, int id, size_t size,
25 int numFlds, void* chunk, void *&tptr)
27 Chunk *tChunk = systemDatabase_->getSystemDatabaseChunk(TableTableId);
28 DbRetVal rv = OK;
29 tptr = tChunk->allocate(systemDatabase_, &rv);
30 if (NULL == tptr)
32 printError(rv,
33 "Could not allocate memory for for TABLE catalog table");
34 return rv;
36 CTABLE *tableInfo = (CTABLE*)tptr;
37 strcpy(tableInfo->tblName_, name);
38 tableInfo->tblID_ = id;
39 tableInfo->length_ = size;
40 tableInfo->numFlds_ = numFlds;
41 tableInfo->numIndexes_ = 0;
42 tableInfo->chunkPtr_ = chunk;
43 printDebug(DM_SystemDatabase,"One Row inserted into TABLE %x %s",tptr, name);
44 return OK;
47 DbRetVal CatalogTableTABLE::remove(const char *name, void *&chunk, void *&tptr)
49 Chunk *tChunk = systemDatabase_->getSystemDatabaseChunk(TableTableId);
50 ChunkIterator iter = tChunk->getIterator();
52 void *data = NULL;
53 while ((data = iter.nextElement())!= NULL)
55 if (0 == strcmp(((CTABLE*)data)->tblName_, name))
57 //remove this element and store the tblPtr
58 //there will be only one row for this table(Primary key)
59 tptr = (void*) data;
60 chunk = (Chunk*) ((CTABLE*)data)->chunkPtr_;
61 break;
64 if (NULL != tptr)
66 tChunk->free(systemDatabase_, tptr);
67 printDebug(DM_SystemDatabase,"One Row deleted from TABLE %x %s",tptr, name);
69 else
71 printError(ErrNotExists,"Table %s not exists in TABLE catalog table", name);
72 return ErrNotExists;
74 return OK;
77 DbRetVal CatalogTableTABLE::getChunkAndTblPtr(const char *name,
78 void *&chunk, void *&tptr)
80 Chunk *chk = systemDatabase_->getSystemDatabaseChunk(TableTableId);
81 ChunkIterator iter = chk->getIterator();;
82 while (NULL != (tptr = iter.nextElement()))
84 if (strcmp(((CTABLE*)tptr)->tblName_, name) == 0)
86 //there will be only one row for this table(Primary key)
87 chunk = (Chunk*) ((CTABLE*)tptr)->chunkPtr_;
88 return OK;
91 //table not found in TABLE
92 return ErrNotFound;
95 List CatalogTableTABLE::getTableList()
97 List tableList;
98 Chunk *chk = systemDatabase_->getSystemDatabaseChunk(TableTableId);
99 ChunkIterator iter = chk->getIterator();
100 void *tptr;
101 while (NULL != (tptr = iter.nextElement()))
103 Identifier *elem = new Identifier();
104 strcpy(elem->name, ((CTABLE*)tptr)->tblName_);
105 tableList.append(elem);
107 return tableList;
110 DbRetVal CatalogTableFIELD::insert(FieldIterator &iter, int tblID, void *tptr)
112 Chunk *fChunk = systemDatabase_->getSystemDatabaseChunk(FieldTableId);
113 DbRetVal rv = OK;
114 while (iter.hasElement())
116 void *fptr = fChunk->allocate(systemDatabase_, &rv);
117 if (NULL == fptr)
119 printError(rv,
120 "Could not allocate for FIELD catalog table");
121 return rv;
123 CFIELD *fldInfo = (CFIELD*)fptr;
124 FieldDef *fDef = iter.nextElement();
125 strcpy(fldInfo->fldName_, fDef->fldName_);
126 fldInfo->tblID_ = tblID;
127 fldInfo->tblPtr_ = tptr;
128 fldInfo->type_ = fDef->type_;
129 fldInfo->length_ = fDef->length_;
130 fldInfo->offset_ = fDef->offset_;
131 os::memcpy(fldInfo->defaultValueBuf_, fDef->defaultValueBuf_,
132 DEFAULT_VALUE_BUF_LENGTH);
133 fldInfo->isNull_ = fDef->isNull_;
134 fldInfo->isPrimary_ = fDef->isPrimary_;
135 fldInfo->isUnique_ = fDef->isUnique_;
136 fldInfo->isDefault_ = fDef->isDefault_;
137 fldInfo->isAutoIncrement_= fDef->isAutoIncrement_;
138 fldInfo->autoVal_ = 0;
139 fldInfo->width_ = 0; //TODO
140 fldInfo->scale_ = 0; //TODO
141 printDebug(DM_SystemDatabase,"One Row inserted into FIELD %x %s",fldInfo, fDef->fldName_);
144 return OK;
147 DbRetVal CatalogTableFIELD::remove(void *tptr)
149 Chunk *fChunk = systemDatabase_->getSystemDatabaseChunk(FieldTableId);
150 ChunkIterator fIter = fChunk->getIterator();
151 void *data = NULL;
152 while ((data = fIter.nextElement())!= NULL)
154 if (((CFIELD*)data)->tblPtr_ == tptr)
156 //remove this element
157 fChunk->free(systemDatabase_, data);
158 printDebug(DM_SystemDatabase,"One Row deleted from FIELD %x",data);
161 return OK;
164 void *CatalogTableFIELD::getFieldInfo(void* tptr, FieldList &list)
166 Chunk *fChunk = systemDatabase_->getSystemDatabaseChunk(FieldTableId);
167 ChunkIterator fIter = fChunk->getIterator();;
168 void *data = NULL;
169 void *ptrToAutoVal;
170 while (NULL != (data = fIter.nextElement()))
172 if (((CFIELD*)data)->tblPtr_ == tptr)
174 //add the information to the field list
175 CFIELD *fTuple = (CFIELD*)data;
176 FieldDef fldDef;
177 strcpy(fldDef.fldName_, fTuple->fldName_);
178 fldDef.fldName_[IDENTIFIER_LENGTH] = '\0';
179 fldDef.type_ = fTuple->type_;
180 fldDef.length_ = os::align(fTuple->length_);
181 fldDef.offset_ = fTuple->offset_;
182 fldDef.isDefault_ = fTuple->isDefault_;
183 os::memcpy(fldDef.defaultValueBuf_, fTuple->defaultValueBuf_,
184 DEFAULT_VALUE_BUF_LENGTH);
185 fldDef.isNull_ = fTuple->isNull_;
186 fldDef.isUnique_ = fTuple->isUnique_;
187 fldDef.isPrimary_ = fTuple->isPrimary_;
188 fldDef.isAutoIncrement_= fTuple->isAutoIncrement_;
189 if(fTuple->isAutoIncrement_){
190 ptrToAutoVal = &fTuple->autoVal_;
192 list.append(fldDef);
195 return ptrToAutoVal;
198 DbRetVal CatalogTableFIELD::getFieldPtrs(FieldNameList &fldList,void *tptr, char **&fptr)
200 Chunk *fChunk = systemDatabase_->getSystemDatabaseChunk(FieldTableId);
201 int i=0;
202 char *fName = NULL;
203 bool found = false;
204 fldList.resetIter();
205 void *data = NULL;
206 DbRetVal rv =OK;
207 while (NULL != (fName = fldList.nextFieldName()))
209 ChunkIterator fIter = fChunk->getIterator();
210 found = false;
211 while (NULL != (data = fIter.nextElement()))
213 if (((CFIELD*)data)->tblPtr_ == tptr)
215 if(0 == strcmp((char*)((CFIELD*)data)->fldName_, fName))
217 found = true;
218 //if (! ((FIELD*)data)->isNull_) rv = ErrBadCall;
219 fptr[i++] = (char*) data;
220 break;
224 if (!found)
226 printError(ErrNotFound,
227 "No entries found in FIELD catalog table for the table specified");
228 return ErrNotFound;
231 return rv;
234 DbRetVal CatalogTableINDEX::insert(const char *name, void *tptr, int numFlds, bool isUnique,
235 void* chunk, int bucketSize, void *hChunk, void *&tupleptr)
237 Chunk *tChunk = systemDatabase_->getSystemDatabaseChunk(IndexTableId);
238 ChunkIterator iter = tChunk->getIterator();
240 //Checking for index having same name, proceed further only
241 //if no such indexes are
242 void *data = NULL;
243 while ((data = iter.nextElement())!= NULL)
245 if (0 == strcmp(((CINDEX*)data)->indName_, name))
247 printError(ErrAlready, "Index with name \'%s\' already exists "
248 "on the table \'%s\'.", name, ((CTABLE *)tptr)->tblName_);
249 return ErrAlready;
254 DbRetVal rv =OK;
255 tupleptr = tChunk->allocate(systemDatabase_, &rv);
256 if (NULL == tupleptr)
258 printError(rv,
259 "Could not allocate for INDEX catalog table");
260 return rv;
262 CINDEX *indexInfo = (CINDEX*)tupleptr;
263 strcpy(indexInfo->indName_, name);
264 indexInfo->tblID_ = -1; //Not used currently
265 indexInfo->tblPtr_ = tptr;
266 indexInfo->numFlds_ = numFlds;
267 if (NULL == hChunk)
268 indexInfo->indexType_ = treeIndex;
269 else
270 indexInfo->indexType_ = hashIndex;
271 indexInfo->chunkPtr_ = chunk;
272 indexInfo->hashNodeChunk_ = hChunk;
273 indexInfo->noOfBuckets_ = bucketSize;
274 indexInfo->isUnique_ = isUnique;
275 indexInfo->fstIndFld_=NULL;
276 printDebug(DM_SystemDatabase,"One Row inserted into INDEX %x %s",tupleptr, name);
277 return OK;
280 DbRetVal CatalogTableINDEX::remove(const char *name, void *&chunk, void *&hchunk, void *&iptr)
282 Chunk *fChunk = systemDatabase_->getSystemDatabaseChunk(IndexTableId);
283 ChunkIterator iter = fChunk->getIterator();
285 void *data = NULL;
286 while ((data = iter.nextElement())!= NULL)
288 if (0 == strcmp(((CINDEX*)data)->indName_, name))
290 //remove this element and store the tuple ptr
291 //there will be only one row for this table(Primary key)
292 chunk = (Chunk*) ((CINDEX*)data)->chunkPtr_;
293 hchunk = (Chunk*) ((CINDEX*)data)->hashNodeChunk_;
294 iptr = (void*) data;
295 break;
298 if (NULL != iptr)
300 fChunk->free(systemDatabase_, iptr);
301 printDebug(DM_SystemDatabase,"One Row deleted from INDEX %x %s",iptr, name);
303 else
305 printError(ErrNotExists,"Index %s not exists in INDEX catalog table", name);
306 return ErrNotExists;
308 return OK;
310 DbRetVal CatalogTableINDEX::get(const char *name, void *&chunk, void *&hchunk, void *&iptr)
312 Chunk *fChunk = systemDatabase_->getSystemDatabaseChunk(IndexTableId);
313 ChunkIterator iter = fChunk->getIterator();
315 void *data = NULL;
316 while ((data = iter.nextElement())!= NULL)
318 if (0 == strcmp(((CINDEX*)data)->indName_, name))
320 //remove this element and store the tuple ptr
321 //there will be only one row for this table(Primary key)
322 chunk = (Chunk*) ((CINDEX*)data)->chunkPtr_;
323 hchunk = (Chunk*) ((CINDEX*)data)->hashNodeChunk_;
324 iptr = (void*) data;
325 break;
328 if (NULL == iptr)
330 printError(ErrNotExists,"Index %s not exists in INDEX catalog table", name);
331 return ErrNotExists;
333 return OK;
336 int CatalogTableINDEX::getNumIndexes(void *tptr)
338 Chunk *fChunk = systemDatabase_->getSystemDatabaseChunk(IndexTableId);
339 ChunkIterator iter = fChunk->getIterator();
340 void *iptr = NULL;
341 int numIndex =0;
342 while (NULL != (iptr = iter.nextElement()))
344 if (((CINDEX*)iptr)->tblPtr_ == tptr) numIndex++;
346 return numIndex;
349 char* CatalogTableINDEX::getIndexName(void *tptr, int position)
351 if (position == 0) return NULL;
352 Chunk *fChunk = systemDatabase_->getSystemDatabaseChunk(IndexTableId);
353 ChunkIterator iter = fChunk->getIterator();
354 void *iptr = NULL;
355 int numIndex =0;
356 int curPos =0;
357 while (NULL != (iptr = iter.nextElement()))
359 if (((CINDEX*)iptr)->tblPtr_ == tptr) curPos++;
360 if ( curPos == position ) return ((CINDEX*)iptr)->indName_;
362 return NULL;
366 void CatalogTableINDEX::getIndexPtrs(void *tptr, char **&array)
368 void *iptr = NULL;
369 Chunk *fChunk = systemDatabase_->getSystemDatabaseChunk(IndexTableId);
370 ChunkIterator iter = fChunk->getIterator();
371 int i=0;
372 while (NULL != (iptr = iter.nextElement()))
374 if (((CINDEX*)iptr)->tblPtr_ == tptr)
376 array[i++] = (char*) iptr;
379 return;
382 ChunkIterator CatalogTableINDEX::getIterator(void *iptr)
384 CINDEX *index = (CINDEX*)iptr;
385 return ((Chunk*)index->chunkPtr_)->getIterator();
389 int CatalogTableINDEX::getNoOfBuckets(void *iptr)
391 CINDEX *index = (CINDEX*)iptr;
392 return index->noOfBuckets_;
395 int CatalogTableINDEX::getUnique(void *iptr)
397 CINDEX *index = (CINDEX*)iptr;
398 return index->isUnique_;
400 char* CatalogTableINDEX::getName(void *iptr)
402 CINDEX *index = (CINDEX*)iptr;
403 return index->indName_;
406 DbRetVal CatalogTableINDEXFIELD::insert(FieldNameList &fldList, void *indexPtr,
407 void *tblPtr, char **&fptr)
410 Chunk *tChunk;
411 tChunk = systemDatabase_->getSystemDatabaseChunk(IndexTableId);
412 ChunkIterator iter = tChunk->getIterator();
413 CINDEXFIELD *fInd=NULL;
414 char *fName =NULL;
415 void *data = NULL;
416 bool isFldInd=false;
417 while ((data = iter.nextElement())!= NULL)
419 if ((((CINDEX*)data)->tblPtr_==tblPtr)
420 && (((CINDEX*)indexPtr)->numFlds_ == ((CINDEX*)data)->numFlds_)
421 && (((CINDEX*)indexPtr)->indexType_==((CINDEX*)data)->indexType_)
422 && (data != indexPtr) )
424 fldList.resetIter();
425 while (NULL != (fName = fldList.nextFieldName()))
427 isFldInd=false;
428 fInd=(CINDEXFIELD*)((CINDEX*)data)->fstIndFld_ ;
429 while (fInd)
431 if (0 == strcmp(((CFIELD *) fInd->fieldPtr)->fldName_, fName))
433 isFldInd=true;
434 break;
436 fInd=fInd->next;
438 if(!isFldInd) break;
440 if(isFldInd)
442 printError(ErrAlready, "Index on this field already exists on table \'%s\' by name \'%s\'", ((CTABLE *)tblPtr)->tblName_, ((CINDEX *)data)->indName_);
443 return ErrAlready;
449 tChunk = systemDatabase_->getSystemDatabaseChunk(IndexFieldTableId);
450 fldList.resetIter();
451 int i =0;
452 while (NULL != (fName = fldList.nextFieldName()))
454 DbRetVal rv = OK;
455 fInd=(CINDEXFIELD*)((CINDEX*)indexPtr)->fstIndFld_;
456 while(fInd)
458 if (0 == strcmp(((CFIELD *) fInd->fieldPtr)->fldName_, fName))
460 printError(ErrAlready,"Composite Index Can't be created with same Name");
461 fInd=(CINDEXFIELD*)((CINDEX*)indexPtr)->fstIndFld_;
462 CINDEXFIELD *fldI;
463 while(fInd)
465 fldI=fInd;
466 fInd=fInd->next;
467 tChunk->free(systemDatabase_,fldI);
469 return ErrAlready;
471 fInd=fInd->next;
473 void *fieldptr = tChunk->allocate(systemDatabase_, &rv);
474 if (NULL == fieldptr)
476 printError(rv, "Could not allocate for USER catalog table");
477 return rv;
479 CINDEXFIELD *fldInfo = (CINDEXFIELD*)fieldptr;
480 fldInfo->tablePtr = tblPtr;
481 fldInfo->fieldPtr = (CFIELD*)fptr[i++];
482 fldInfo->indexPtr = indexPtr;
483 fldInfo->next=(CINDEXFIELD*)((CINDEX*)indexPtr)->fstIndFld_;
484 ((CINDEX *)indexPtr)->fstIndFld_=fldInfo;
485 printDebug(DM_SystemDatabase,"One Row inserted into INDEXFIELD %x", fldInfo);
487 return OK;
490 DbRetVal CatalogTableINDEXFIELD::remove(void *iptr)
492 Chunk *fChunk;
493 fChunk = systemDatabase_->getSystemDatabaseChunk(IndexFieldTableId);
494 ChunkIterator fIter = fChunk->getIterator();
495 void *data = NULL;
496 while ((data = fIter.nextElement())!= NULL)
498 if (((CINDEXFIELD*)data)->indexPtr == iptr)
500 //remove this element
501 fChunk->free(systemDatabase_, data);
502 printDebug(DM_SystemDatabase,"One Row deleted from INDEXFIELD %x", data);
505 return OK;
508 DbRetVal CatalogTableINDEXFIELD::getFieldNameAndType(void *index,
509 char *&name, DataType &type)
511 Chunk *ifChunk;
512 ifChunk = systemDatabase_->getSystemDatabaseChunk(IndexFieldTableId);
513 ChunkIterator ifIter = ifChunk->getIterator();
514 void *data = NULL;
515 while ((data = ifIter.nextElement())!= NULL)
517 if (((CINDEXFIELD*)data)->indexPtr == index)
519 //store the field name
520 name = ((CFIELD*)(((CINDEXFIELD*)data)->fieldPtr))->fldName_;
521 type = ((CFIELD*)(((CINDEXFIELD*)data)->fieldPtr))->type_;
522 return OK;
525 printError(ErrNotExists,"Index %x not exists in catalog table", index);
526 return ErrNotExists;
529 DbRetVal CatalogTableINDEXFIELD::getFieldInfo(void *index, FieldList &list)
531 Chunk *ifChunk;
532 ifChunk = systemDatabase_->getSystemDatabaseChunk(IndexFieldTableId);
533 ChunkIterator ifIter = ifChunk->getIterator();
534 void *data = NULL;
535 int rowCount =0;
536 while ((data = ifIter.nextElement())!= NULL)
538 if (((CINDEXFIELD*)data)->indexPtr == index)
540 //add the information to the field list
541 CFIELD *fTuple = (CFIELD*)(((CINDEXFIELD*)data)->fieldPtr);
542 FieldDef fldDef;
543 strcpy(fldDef.fldName_, fTuple->fldName_);
544 fldDef.fldName_[IDENTIFIER_LENGTH] = '\0';
545 fldDef.type_ = fTuple->type_;
546 fldDef.length_ = fTuple->length_;
547 fldDef.offset_ = fTuple->offset_;
548 fldDef.isDefault_ = fTuple->isDefault_;
549 os::memcpy(fldDef.defaultValueBuf_, fTuple->defaultValueBuf_,
550 DEFAULT_VALUE_BUF_LENGTH);
551 fldDef.isNull_ = fTuple->isNull_;
552 fldDef.isUnique_ = fTuple->isUnique_;
553 fldDef.isPrimary_ = fTuple->isPrimary_;
554 list.append(fldDef);
556 rowCount++;
558 if (!rowCount) {
559 printError(ErrNotExists,"Index %x not exists in catalog table", index);
560 return ErrNotExists;
562 return OK;
565 void CatalogTableINDEXFIELD::printAllIndex()
567 Chunk *chunk=systemDatabase_->getSystemDatabaseChunk(IndexFieldTableId);
568 ChunkIterator ifIter = chunk->getIterator();
569 void *data = NULL;
570 char indexName[IDENTIFIER_LENGTH] = {'\0'};
571 while ((data = ifIter.nextElement())!= NULL)
573 if(strcmp(indexName,((CINDEX*)(((CINDEXFIELD*)data)->indexPtr))->indName_)!=0)
575 printf(" <Index Name> %s </Index Name> \n",((CINDEX*)(((CINDEXFIELD*)data)->indexPtr))->indName_);
576 if(0==((CINDEX*)(((CINDEXFIELD*)data)->indexPtr))->indexType_)
577 printf(" <Index Type> Hash Index </Index Type> \n");
578 else
579 printf(" <Index Type> Tree Index </Index Type> \n");
580 printf(" <Table Name> %s </Table Name> \n",((CTABLE*)(((CINDEXFIELD*)data)->tablePtr))->tblName_);
581 printf(" <Field Name> %s </Field Name> \n",((CFIELD*)(((CINDEXFIELD*)data)->fieldPtr))->fldName_);
583 else
585 printf(" <Field Name> %s </Field Name> \n",((CFIELD*)(((CINDEXFIELD*)data)->fieldPtr))->fldName_);
587 strcpy(indexName,((CINDEX*)(((CINDEXFIELD*)data)->indexPtr))->indName_);
591 DbRetVal CatalogTableUSER::insert(const char *name, const char *pass)
593 Chunk *tChunk = systemDatabase_->getSystemDatabaseChunk(UserTableId);
594 DbRetVal rv = OK;
595 CUSER *usrInfo = (CUSER*)tChunk->allocate(systemDatabase_, &rv);
596 if (NULL == usrInfo)
598 printError(rv,
599 "Could not allocate for USER catalog table");
600 return rv;
602 strcpy(usrInfo->userName_, name);
603 strcpy(usrInfo->password_, os::encrypt(pass, "A0"));
604 return OK;
608 DbRetVal CatalogTableUSER::authenticate(const char *name, const char *pass,
609 bool &isAuthenticated, bool &isDba)
611 Chunk *tChunk = systemDatabase_->getSystemDatabaseChunk(UserTableId);
612 ChunkIterator iter = tChunk->getIterator();
613 void *data = NULL;
614 while (NULL != (data = iter.nextElement()))
616 if (strcmp(((CUSER*)data)->userName_, name) == 0)
618 //verify the password
619 char * enpass = os::encrypt(pass,"A0");
620 if (0 == strcmp(enpass, ((CUSER*)data)->password_))
622 isAuthenticated = true;
623 if (0 == strcmp(((CUSER*)data)->userName_, DBAUSER))
624 isDba = true; else isDba = false;
625 return OK;
629 isAuthenticated = false;
630 return OK;
633 DbRetVal CatalogTableUSER::remove(const char *name)
635 Chunk *tChunk = systemDatabase_->getSystemDatabaseChunk(UserTableId);
636 ChunkIterator iter = tChunk->getIterator();
637 void *data = NULL;
638 while ((data = iter.nextElement())!= NULL)
640 if (strcmp(((CUSER*)data)->userName_, name) == 0)
642 //remove this element
643 tChunk->free(systemDatabase_, data);
644 return OK;
647 printError(ErrNotExists,"User %s not exists in catalog table", name);
648 return ErrNotExists;
651 DbRetVal CatalogTableUSER::changePass(const char *name, const char *pass)
653 Chunk *tChunk = systemDatabase_->getSystemDatabaseChunk(UserTableId);
654 ChunkIterator iter = tChunk->getIterator();
655 void *data = NULL;
656 while (NULL != (data = iter.nextElement()))
658 if (strcmp(((CUSER*)data)->userName_, name) == 0)
660 //change the password
661 strcpy(((CUSER*)data)->password_, os::encrypt(pass, "A0"));
662 return OK;
665 printError(ErrNotExists,"User %s not exists in catalog table", name);
666 return ErrNotExists;