If your use cases are such that at most of the places you need to lookup objects of one particular type (e.g., give me a class by this name, give me all the variables with this property, ...), you may be better off storing objects of each type in a separate table. This will help in better performance because less number of records needs to be filtered during a query for a particular type of object. This will also provide better data normalization if the information for each type is quite different than that for the other ones. If you are developing your application in C# or some other managed language, you may use an OR-Mapping product to totally avoid dealing with tedious low-level infrastructire code in ADO.NET or OleDb for data integration. For example, with NJDX OR-Mapper, you may do the following: 1- Define your domain model classes (say AClass, AStruct, AUnion, AVariable, AnEnum, etc.) with properties for name, offset, etc.). For example, class AClass { string name; int offset; ... }
If some classes are very similar, you may define them in a class-hierarchy. 2- Define OR-Mapping declaratively like: CLASS AClass TABLE CLASSES PRIMARY_KEY name ; CLASS AUnion TABLE UNIONS PRIMARY_KEY name ;
3- Create the database schema using NJDXSchema tool. This will create tables CLASSES, UNIONS, etc, with proper columns and primary keys. 4- Write your application using NJDX APIs. For example, the following code will insert a new object c1 of type AClass in the database: njdx.insert(c1, 0, null);
The following code will fetch an AUnion object having name="someUnion" // oid below can be built dynamically using program variables Object oid = ObjectId.createObjectId("AUnion;name=someUnion"); AUnion myUnion = njdx.getObjectById(oid, true, 0, null);
The following code will fetch all AClass objects into the myClasses variable. ArrayList myClasses = njdx.query("AClass", null, -1, 0, null);
If you have defined some of your classes in a hierarchy, you can fetch all the qualifying objects of all the classes in that hierarchy with one query call. Essentially, your code will be more object-oriented and easier to evolve. And you will avoid all the complexities of SQL. Damodar Periwal Software Tree, Inc. Simplify Data Integration http://www.softwaretree.com -- modified at 18:55 Tuesday 24th January,