include/Info.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by www.databasecache.com                           *
00003  *   Contact: praba_tuty@databasecache.com                                 *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015   ***************************************************************************/
00016 #ifndef INFO_H
00017 #define INFO_H
00018 #include<ErrorType.h>
00019 #include<DataType.h>
00020 #include<Field.h>
00021 
00022 
00023 class FieldNameNode;
00024 
00031 class FieldNameList
00032 {
00033     FieldNameNode *head;
00034     FieldNameNode *iter;
00035     public:
00036     FieldNameList() { head = iter = NULL; }
00037     ~FieldNameList() { } //TODO::Remove all elements from the list
00038     char *nextFieldName();
00039     void resetIter(){ iter = head; }
00040     int size();
00041 
00046     DbRetVal append(const char *name);
00047 
00052     DbRetVal remove(const char *name);
00053     DbRetVal removeAll();
00054 };
00055 
00056 class FieldList;
00057 class FieldIterator;
00058 
00059 
00069 class TableDef
00070 {
00071     private:
00072     FieldList fldList;
00073     int fldCount;
00074 
00075     public:
00076     TableDef() { fldCount = 0; }
00077     ~TableDef();
00078     void reset();
00089     int addField(const char *name,  DataType type = typeUnknown, size_t
00090                  length = 0, const void *defaultValue = 0,
00091                  bool notNull = false);
00092 
00097     int dropField(const char *name);
00098 
00102     int getFieldCount();
00103 
00107     size_t getTupleSize();
00108 
00109     //Internal method used to iterate and get information stored
00110     //in this table definition.
00111     FieldIterator getFieldIterator(){ return fldList.getIterator(); }
00112 
00113 };
00114 
00115 class FieldInfo
00116 {
00117     public:
00118     char fldName[IDENTIFIER_LENGTH];
00119     DataType type;
00120     size_t length;
00121     int offset;
00122     char defaultValueBuf[DEFAULT_VALUE_BUF_LENGTH];
00123     bool isNull;
00124     bool isPrimary;
00125     bool isDefault;
00126 };
00127 
00128 
00129 
00132 enum IndexType
00133 {
00134     hashIndex = 0, 
00135     treeIndex      
00136 };
00137 
00145 class IndexInitInfo
00146 {
00147     public:
00148     char tableName[IDENTIFIER_LENGTH]; 
00149     FieldNameList list;               
00150     IndexType indType;                
00151     bool isUnique;                    
00152     bool isPrimary;                   
00153     IndexInitInfo() {  indType = hashIndex;  isUnique = false; isPrimary= false;}
00154     ~IndexInitInfo() {list.removeAll();}
00155 };
00156 
00164 class HashIndexInitInfo : public IndexInitInfo
00165 {
00166     public:
00167     int bucketSize; 
00168     HashIndexInitInfo() { bucketSize = 1009; }
00169 };
00170 #endif

Generated on Mon Jun 9 22:37:14 2008 for csql by  doxygen 1.4.7