Solved

What is the best way to start with Object Database and Visual C++ 2010

Posted on 2011-03-22
7
304 Views
Last Modified: 2012-05-11
Hi,
I want to start working with Visual C++ 2010 and Object databases.
Currently I want to save VC++ Containers like MAP and VECTOR.

1) I want to know which Object Database is recommended and where can I find simple examples for connecting to Visual C++ 2010.

2) Assuming I use for now MYSQL (until I learn to use the object Database),
In order to save MAP I can think of using the keys in each table as the keys values of the MAP and to use column for the Data.
How can I save a vector in a table?
Thanks.
0
Comment
Question by:star90
  • 4
  • 3
7 Comments
 
LVL 32

Accepted Solution

by:
sarabande earned 500 total points
ID: 35197196
normally only a vector of a structure should be stored to a table where each member of structure would be a column in the table. if you have multiple vectors of single data elements - say string or int - all running the same index you also could have a table where you would store all these vector data using the index as primary key.

for Object Databases i only know FastObjects (Poet) which has a class wizard included that could generate code out of the objects of the database.

Sara
0
 

Author Comment

by:star90
ID: 35200301
Thanks for the answer,
Here is a more detailed example;
1) Regarding MAP objects:
Lets say I have 1000 points of time.

time(1) = 1313  
Map (of time 1313)           .
key    value              
"try1"   5
"try2"   9
"try3"   11
-------------------------------
time (2)= 1566
Map (of time 1566)           .

key    value              
"try1"  1 5
"try2"   19
"try3"  111
"try4"   15
"try5"   19
"try6"  111

--------------------------------

I can keep each Data Map in  a separate table using the keys of the Map as primaries keys of the tables.
This way Ill have 1000 tables (table1313    table 1566 etc )
 is it logic to build it this way?


2) Regarding Vectors:
Lets say I have 2 points of time
time(1)=14443
Vector(1)= 1,4,6,7,3,6,3

time(2)=14500
Vector(2)=1,4,6,3,7,3,76,3,5,23,56,2,5,3,6,32,56,2,6,23,6,2,5,2,4,2

I don´t know in advance how many components are in the vectors so it means that if I keep the Data in one table (using the time as primary keys ) I will have to add new columns to the table and to spend empty columns on vector(1)
because vector(2) is bigger (assuming I mark the end of vector 1 in column 7 with -9999 for example)

The other option is to have a separate table for each point of time.
Any recommendations?
0
 

Author Comment

by:star90
ID: 35200314
Thanks for the  info about the FastObjects (Poet)
I will read about it.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 32

Expert Comment

by:sarabande
ID: 35200982
if the only difference is the number of try values in a RDBMS you would have two tables t1, t2, where t1 has time and key as columns and t2 which has pkey_t1, try for columns. t2 has no primary key but an index on first column.

in a ODBMS you only have one object with time and key as 'normal' columns (members) and try as an array column.

Sara
0
 

Author Comment

by:star90
ID: 35201385
1) Why t2 should not have primary key?
2) I am new to ODBMS, please explain what is "normal" and array column?
0
 
LVL 32

Expert Comment

by:sarabande
ID: 35206583
t2 is only a link table which has first column a reference to primary key of t1 and second column the item which needs multiple entries. the pk of t1 will occur multiple in t2 (for each occurrence of try) and therefore cannot be primary key of t2 which must be unique key. you also cannot use the pair of both columns as pk cause even that could get duplicate key (see try2 and try5 of 2nd sample). so the only way to have a pk for t2 is to add an artificial key, for example a sequence number. but this has no advantage and slows down insertion.

in an ODBMS you can have single attributes same as in RDBMS. but ODBMS also allows to have other objects as attributes (for example you have 2 objects Customer and Address, then the Customer can have an attribute Address which itself has some attributes) and allows to have the same attribute more than once (normally called 'set' or 'array' attribute). in a relational database that is forbidden because of first normal form (1nf).

you can think of an ODBMS object as a structure in C/C++ which can have member arrays and member structures.

Sara
0
 

Author Comment

by:star90
ID: 35207120
Thanks for the explanation.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes some very basic things about SQL Server filegroups.
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now