【发布时间】:2013-03-14 04:04:09
【问题描述】:
我想尝试对关系数据库进行一些查询操作。例如
relation cars
brandname type year
acura suv 2012
bmw sedan 2013
和/或
relation transport
transport vehicle capacity ticketprice
bus 40 30
airplane 300 500
taxi 3 125
in this database has up to 100 relations.
each relation could has 10 attributes.
each relation could has 10000 row data.
在这个数据库中有一个单一的文本文件。这个文件, 2 汽车 交通
第一行在这个文件中有什么关系?和其他行的关系名称。
每个关系有 2 个不同的文件。第一个文本文件,
3
brandname String 20
type String 10
year Int 4
第一行是这个关系表中有多少个属性 其他行属性和类型(字符串/整数)和属性大小(字节)
第二个文件是二进制文件,每行数据都有一个信息。 “讴歌 suv 2012”,但它的二进制文件。
所以,
我就是这么想的,
首先我必须创建结构,例如,
struct relation{
char attribute[10];
char row[10000];
}
struct row {
char type[2]; //string or integer
char title[???]; //i think i have to read from binary file how many title in this file ??
long size; //how many bytes size of each attribute
}
但我不确定我的想法是否正确。
【问题讨论】:
-
您在一篇文章中提出了太多问题。请阅读FAQ 和How to Ask,了解如何写出好问题。
-
@JimGarrison 我的问题实际上是我无法解读他的实际问题是什么。 ccc,您已经解释了您的问题,但没有明确提出您的问题。请更清楚地重新表述您的问题
-
抱歉,我只想问一下我的结构定义是真的吗?