99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代寫CS 205、代做C++程序設計
代寫CS 205、代做C++程序設計

時間:2024-10-28  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



Advanced Database Organization - Fall 2024 CS 525 - All Sections Programming Assignment III: Record Manager Due: Friday, October 18th 2024 by 23h59
1. Task
The goal of this assignment is to implement a simple record manager. The record manager handles tables with a fixed schema. Clients can insert records, delete records, update records, and scan through the records in a table. A scan is associated with a search condition and only returns records that match the search condition. Each table should be stored in a separate page file and your record manager should access the pages of the file through the buffer manager implemented in the last assignment.
Hints: This assignment is much more complex than the previous assignments and it is easy to get stuck if you are unclear about how to structure your solution and what data structures to use. Sit down with a piece of paper first and design the data structures and architecture for your implementation.
  • •

• •
Record Representation : The data types we consider for this assignment are all fixed length. Thus, for a given schema, the size of a record is fixed too.
Page Layout : You will have to define how to layout records on pages. Also you need to reserve some space on each page for managing the entries on the page. Refresh your memory on the page layouts discussed in class! For example, how would you represent slots for records on pages and manage free space.
Table information pages : You probably will have to reserve one or more pages of a page file to store, e.g., the schema of the table.
: The assignment requires you to use record IDs that are a combination of page and slot number. : Since your record manager has to support deleting records you need to track available free space on pages. An easy solution is to link pages with free space by reserving space for a pointer to the next free space on each page. One of the table information pages can then have a pointer to the first page with free space. One alternative is to use several pages to store a directory recording how much free
space you have for each page.
2. tables.h
This header defines basic data structures for schemas, tables, records, record ids (RIDs), and values. Furthermore, this header defines functions for serializing these data structures as strings. The serialization functions are provided (   ). There are four datatypes that can be used for records of a table: integer ( DT INT ), float (   ), strings of a fixed length ( DT STRING ), and boolean ( DT BOOL ). All records in a table conform to a common schema defined for this table. A record is simply a record id ( rid consisting of a page number and slot number) and the concatenation of the binary representation of its attributes according to the schema ( data ).
2.1. Schema. A schema consists of a number of attributes ( ). For each attribute we record the name ) and data type ( dataTypes ). For attributes of type we record the size of the strings in
. Furthermore, a schema can have a key defined. The key is represented as an array of integers that are the positions of the attributes of the key ( keyAttrs ). For example, consider a relation R(a,b,c) where a then
keyAttrs would be [0] .
2.2. Data Types and Binary Representation. Values of a data type are represented using the struct. The value struct represents the values of a data type using standard C data types. For example, a string is a
and an integer using a C int . Note that values are only used for expressions and for returning data to the client of the record manager. Attribute values in records are stored slightly different if the data type is string. Recall that in C a string is an array of characters ended by a 0 byte. In a record, strings are stored without the additional 0 byte in the end. For example, for strings of length 4 should occupy 4 bytes in the data field of the record.
   Record IDs
 Free Space Management
 rm serializer.c
  DT FLOAT
 numAttr
 ( attrNames
 typeLength
  DT STRING
    1
Value
 char *

2.3. Interface. :
  #ifndef TABLES_H
#define TABLES_H
#include "dt.h"
// Data Types, Records, and Schemas
typedef enum DataType {
  DT_INT = 0,
  DT_STRING = 1,
  DT_FLOAT = 2,
  DT_BOOL = 3
} DataType;
typedef struct Value {
  DataType dt;
  union v {
    int intV;
    char *stringV;
    float floatV;
    bool boolV;
} v;
} Value;
typedef struct RID {
  int page;
  int slot;
} RID;
typedef struct Record
{
RID id;
  char *data;
} Record;
// information of a table schema: its attributes, datatypes,
typedef struct Schema
{
  int numAttr;
  char **attrNames;
  DataType *dataTypes;
  int *typeLength;
  int *keyAttrs;
  int keySize;
} Schema;
// TableData: Management Structure for a Record Manager to handle one relation
typedef struct RM_TableData
{
  char *name;
  Schema *schema;
  void *mgmtData;
} RM_TableData;
#define MAKE_STRING_VALUE(result, value)                                \
  do {                                                                  \
    (result) = (Value *) malloc(sizeof(Value));                         \
    (result)->dt = DT_STRING;                                           \
    (result)->v.stringV = (char *) malloc(strlen(value) + 1);           \
    strcpy((result)->v.stringV, value);                                 \
} while(0)
#define MAKE_VALUE(result, datatype, value) \ do { \ (result) = (Value *) malloc(sizeof(Value)); \ (result)->dt = datatype; \ switch(datatype) \ {\
2

       case DT_INT:                                                      \
        (result)->v.intV = value;                                       \
        break;                                                          \
      case DT_FLOAT:                                                    \
        (result)->v.floatV = value;                                     \
        break;                                                          \
      case DT_BOOL:                                                     \
        (result)->v.boolV = value;                                      \
        break;                                                          \
}\ } while(0)
// debug and read methods
extern Value *stringToValue (char *value);
extern char *serializeTableInfo(RM_TableData *rel);
extern char *serializeTableContent(RM_TableData *rel);
extern char *serializeSchema(Schema *schema);
extern char *serializeRecord(Record *record, Schema *schema);
extern char *serializeAttr(Record *record, Schema *schema, int attrNum);
extern char *serializeValue(Value *val);
#endif
 3. expr.h
This header defines data structures and functions to deal with expressions for scans. These functions are imple- mented in expr.c . Expressions can either be constants (stored as a Value struct), references to attribute values (represented as the position of an attribute in the schema), and operator invocations. Operators are either com- parison operators (equals and smaller) that are defined for all data types and boolean operators AND , OR , and
NOT . Operators have one or more expressions as input. The expression framework allows for arbitrary nesting of operators as long as their input types are correct. For example, you cannot use an integer constant as an input to a boolean AND operator. As explained below, one of the parameters of the scan operation of the record manager is an expression representing the scan condition.
3.1. Interface. :
    #ifndef EXPR_H
#define EXPR_H
#include "dberror.h"
#include "tables.h"
// datatype for arguments of expressions used in conditions
typedef enum ExprType {
  EXPR_OP,
  EXPR_CONST,
  EXPR_ATTRREF
} ExprType;
typedef struct Expr {
  ExprType type;
  union expr {
    Value *cons;
    int attrRef;
    struct Operator *op;
  } expr;
} Expr;
// comparison operators
typedef enum OpType {
  OP_BOOL_AND,
  OP_BOOL_OR,
  OP_BOOL_NOT,
  OP_COMP_EQUAL,
  OP_COMP_SMALLER
} OpType;
3

 typedef struct Operator {
  OpType type;
  Expr **args;
} Operator;
// expression evaluation methods
extern RC valueEquals (Value *left, Value *right, Value *result);
extern RC valueSmaller (Value *left, Value *right, Value *result);
extern RC boolNot (Value *input, Value *result);
extern RC boolAnd (Value *left, Value *right, Value *result);
extern RC boolOr (Value *left, Value *right, Value *result);
extern RC evalExpr (Record *record, Schema *schema, Expr *expr, Value **result);
extern RC freeExpr (Expr *expr);
extern void freeVal(Value *val);
#define CPVAL(_result,_input) \ do { \ (_result)->dt = _input->dt; \ switch(_input->dt) \ {\ case DT_INT: \
      (_result)->v.intV = _input->v.intV;
      break;                                                            \
    case DT_STRING:                                                     \
\
      (_result)->v.stringV = (char *) malloc(strlen(_input->v.stringV));        \
      strcpy((_result)->v.stringV, _input->v.stringV);                  \
      break;                                                            \
    case DT_FLOAT:                                                      \
      (_result)->v.floatV = _input->v.floatV;                           \
      break;                                                            \
    case DT_BOOL:                                                       \
      (_result)->v.boolV = _input->v.boolV;                             \
      break;                                                            \
}\ } while(0)
#define MAKE_BINOP_EXPR(_result,_left,_right,_optype)                   \
    do {                                                                \
      Operator *_op = (Operator *) malloc(sizeof(Operator));            \
      _result = (Expr *) malloc(sizeof(Expr));                          \
      _result->type = EXPR_OP;                                          \
      _result->expr.op = _op;                                           \
      _op->type = _optype;                                              \
      _op->args = (Expr **) malloc(2 * sizeof(Expr*));                  \
      _op->args[0] = _left;                                             \
      _op->args[1] = _right;                                            \
    } while (0)
#define MAKE_UNOP_EXPR(_result,_input,_optype)                          \
  do {                                                                  \
    Operator *_op = (Operator *) malloc(sizeof(Operator));              \
    _result = (Expr *) malloc(sizeof(Expr));                            \
    _result->type = EXPR_OP;                                            \
    _result->expr.op = _op;                                             \
    _op->type = _optype;                                                \
    _op->args = (Expr **) malloc(sizeof(Expr*));                        \
    _op->args[0] = _input;                                              \
  } while (0)
#define MAKE_ATTRREF(_result,_attr)                                     \
  do {                                                                  \
    _result = (Expr *) malloc(sizeof(Expr));                            \
    _result->type = EXPR_ATTRREF;                                       \
    _result->expr.attrRef = _attr;                                      \
} while(0)
#define MAKE_CONS(_result,_value)                                       \
  do {                                                                  \
    _result = (Expr *) malloc(sizeof(Expr));                            \
    _result->type = EXPR_CONST;                                         \
    _result->expr.cons = _value;                                        \
} while(0) #endif // EXPR
 4

4. record mgr.h
We now discuss the interface of the record manager as defined in record mgr.h . There are five types of functions in the record manager:
• functions for table and record manager management, • functions for handling the records in a table,
• functions related to scans,
• functions for dealing with schemas, and
• function for dealing with attribute values and creating records. We now discuss each of these function types
4.1. Table and Record Manager Functions. Similar to previous assignments, there are functions to initialize and shutdown a record manager. Furthermore, there are functions to create, open, and close a table. Creating a table should create the underlying page file and store information about the schema, free-space, ... and so on in the Table Information pages. All operations on a table such as scanning or inserting records require the table to be opened first. Afterwards, clients can use the RM TableData struct to interact with the table. Closing a table should cause all outstanding changes to the table to be written to the page file. The getNumTuples function returns the number of tuples in the table.
4.2. Record Functions. These functions are used to retrieve a record with a certain RID , to delete a record with a certain RID , to insert a new record, and to update an existing record with new values. When a new record is inserted the record manager should assign an RID to this record and update the record parameter passed to insertRecord .
4.3. Scan Functions. A client can initiate a scan to retrieve all tuples from a table that fulfill a certain condition (represented as an Expr ). Starting a scan initializes the RM ScanHandle data structure passed as an argument to
startScan . Afterwards, calls to the next method should return the next tuple that fulfills the scan condition. If NULL is passed as a scan condition, then all tuples of the table should be returned. next should return RC RM NO MORE TUPLES once the scan is completed and RC OK otherwise (unless an error occurs of course). Below
is an example of how a client can use a scan. 4.4. Interface. :
          RM_TableData *rel = (RM_TableData *) malloc(sizeof(RM_TableData));
RM_ScanHandle *sc = (RM_ScanHandle *) malloc(sizeof(RM_ScanHandle));
Schema *schema;
Record *r = (Record *) malloc(sizeof(Record));
int rc;
// initialize Schema schema (not shown here) // create record to hold results createRecord(&r, schema);
// open table R for scanning
openTable(rel, "R");
// initiate the scan passing the scan handle sc
startScan(rel, sc, NULL);
// call next on the RM_ScanHandle sc to fetch next record into r
while((rc = next(sc, r)) == RC_OK)
  {
  // do something with r
}
// check whether we stopped because of an error or because the scan was finished
if (rc != RC_RM_NO_MORE_TUPLES) // handle the error
// close scanhandle & table
closeScan(sc);
closeTable(rel);
 Closing a scan indicates to the record manager that all associated resources can be cleaned up.
4.5. Schema Functions. These helper functions are used to return the size in bytes of records for a given schema and create a new schema.
5

4.6. Attribute Functions. These functions are used to get or set the attribute values of a record and create a new record for a given schema. Creating a new record should allocate enough memory to the data field to hold the binary representations for all attributes of this record as determined by the schema.
4.7. Interface. :
  #ifndef RECORD_MGR_H
#define RECORD_MGR_H
#include "dberror.h"
#include "expr.h"
#include "tables.h"
// Bookkeeping for scans
typedef struct RM_ScanHandle
{
  RM_TableData *rel;
  void *mgmtData;
} RM_ScanHandle;
// table and manager
extern RC initRecordManager (void *mgmtData);
extern RC shutdownRecordManager ();
extern RC createTable (char *name, Schema *schema);
extern RC openTable (RM_TableData *rel, char *name);
extern RC closeTable (RM_TableData *rel);
extern RC deleteTable (char *name);
extern int getNumTuples (RM_TableData *rel);
// handling records in a table
extern RC insertRecord (RM_TableData *rel, Record *record);
extern RC deleteRecord (RM_TableData *rel, RID id);
extern RC updateRecord (RM_TableData *rel, Record *record);
extern RC getRecord (RM_TableData *rel, RID id, Record *record);
// scans
extern RC startScan (RM_TableData *rel, RM_ScanHandle *scan, Expr *cond);
extern RC next (RM_ScanHandle *scan, Record *record);
extern RC closeScan (RM_ScanHandle *scan);
// dealing with schemas
extern int getRecordSize (Schema *schema);
extern Schema *createSchema (int numAttr, char **attrNames, DataType *dataTypes, int *typeLength, int keySize, int
     *keys);
extern RC freeSchema (Schema *schema);
// dealing with records and attribute values
extern RC createRecord (Record **record, Schema *schema);
extern RC freeRecord (Record *record);
extern RC getAttr (Record *record, Schema *schema, int attrNum, Value **value);
extern RC setAttr (Record *record, Schema *schema, int attrNum, Value *value);
#endif // RECORD_MGR_H
 6

5. Optional Extensions
You can earn up to 20% bonus points for implementing optional extensions. A good implementation of one or two extensions will give you the maximum of 20% points. So rather than implementing 5 incomplete extensions, I
suggest
• • •
• •
you to focus on one extension first and if there is enough time, then add additional ones.
TIDs and tombstones : Implement the TID and Tombstone concepts introduced in class. Even though your implementation does not need to move around records, because they are fixed size, TIDs and Tombstones are important for real systems.
Null values : Add support for SQL style NULL values to the data types and expressions. This requires changes to the expression code, values, and binary record representation (e.g., you can use the NULL bitmaps introduced in class).
Check primary key constraints : On inserting and updating tuples, check that the primary key con- straint for the table holds. That is you need to check that no record with the same key attribute values as
the new record already exists in the table. Ordered scans: Add an parameter to the scan that determines a sort order of results, i.e., you should pass a list of attributes to sort on. For dare-devils: Implement this using external sorting, so you can sort arbitrarily large data.
Interactive interface : Implement a simple user interface. You should be able to define new tables, insert, update, and delete tuples, and execute scans. This can either be a shell or menu-based interface.
: Extend the scan code to support updates. Add a new method
that takes a condition (expression) which is used to determine which tuples to update and a pointer to a function which takes a record as input and returns the updated version of the record. That is the user of the   method should implement a method that updates the record values and then
pass this function to   . Alternatively, extend the expression model with new expression types
(e.g., adding two integers) and let take a list of expressions as a parameter. In this case the new values of an updated tuple are produced by applying the expressions to the old values of the tuple. This would closer to real SQL updates.
6. Source Code Structure
     Conditional updates using scans
 updateScan
updateScan
updateScan
 updateScan
You source code directories should be structured as follows. You should reuse your existing storage manager and buffer manager implementations. So before you start to develop, please copy your storage manager and buffer manager implementations.
• Put all source files in a folder assign3 in your git repository
• This folder should contain at least
– the provided header and C files
– a make file for building your code Makefile.
– a bunch of *.c and *.h files implementing the record manager
– README.txt/README.md : A markdown or text file with a brief description of your solution
Example, the structure may look like that:
    git assign3
Makefile buffer_mgr.h buffer_mgr_stat.c buffer_mgr_stat.h dberror.c dberror.h
expr.c
expr.h record_mgr.h rm_serializer.c storage_mgr.h tables.h test_assign3_1.c test_expr.c test_helper.h
 7

7. Test cases
– Defines several helper methods for implementing test cases such as ASSERT TRUE .
• test expr.c
– This file implements several test cases using the expr.h interface. Please let your make file generate
a test expr binary for this code. You are encouraged to extend it with new test cases or use it as a
template to develop your own test files.
• test assign3 1.c
– This file implements several test cases using the record mgr.h interface. Please let your make file
generate a test assign3 binary for this code. You are encouraged to extend it with new test cases or use it as a template to develop your own test files.
 • test helper.h


請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp




 

掃一掃在手機打開當前頁
  • 上一篇:代寫BE205、代做C++語言程序
  • 下一篇:CSSE2010代做、代寫c/c++編程設計
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
    合肥機場巴士2號線
    合肥機場巴士2號線
    合肥機場巴士1號線
    合肥機場巴士1號線
  • 短信驗證碼 豆包 幣安下載 AI生圖 目錄網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          欧美亚洲一区三区| 韩国一区二区三区美女美女秀| 1204国产成人精品视频| 欧美亚洲免费电影| 欧美日韩直播| 亚洲精选视频免费看| 免费观看在线综合色| 好吊日精品视频| 久久久久久97三级| 黄色成人在线| 久久综合久久综合久久| 国产自产2019最新不卡| 午夜国产不卡在线观看视频| 国产精品九九| 亚洲欧美日韩综合| 国产精品麻豆va在线播放| 在线视频亚洲欧美| 欧美午夜在线| 亚洲欧美日韩人成在线播放| 国产精品成人一区二区| 亚洲天堂av综合网| 国产伦精品一区二区三区| 欧美亚洲系列| 伊人天天综合| 欧美激情第一页xxx| 亚洲精品一区二区三区四区高清| 欧美成熟视频| 亚洲国产另类久久久精品极度| 蜜桃av一区二区三区| 亚洲激情综合| 欧美日韩在线影院| 午夜精品久久久久久99热| 国产精品亚洲一区| 久久精品成人一区二区三区蜜臀 | 欧美福利一区二区| 亚洲精品影视在线观看| 欧美日韩专区在线| 亚洲在线成人精品| 精品福利av| 欧美日韩福利视频| 午夜久久tv| 亚洲第一毛片| 欧美午夜性色大片在线观看| 欧美在线高清| 亚洲第一视频网站| 欧美日韩亚洲免费| 久久成人这里只有精品| 最新国产乱人伦偷精品免费网站 | 日韩视频一区| 国产伦精品一区二区三区在线观看| 欧美一区二区三区男人的天堂| 一区二区在线不卡| 欧美视频专区一二在线观看| 欧美在线播放一区二区| 亚洲黄色一区二区三区| 国产精品青草综合久久久久99 | 国产精品丝袜91| 美国十次成人| 香蕉国产精品偷在线观看不卡| 亚洲高清影视| 国产欧美精品xxxx另类| 欧美成人精品激情在线观看| 亚洲欧美在线高清| 亚洲精品一区中文| 国产永久精品大片wwwapp| 欧美日韩在线视频一区| 裸体一区二区| 欧美亚洲一区三区| 在线一区二区视频| 亚洲国产女人aaa毛片在线| 国产精品免费一区二区三区在线观看 | 激情欧美亚洲| 国产精品久久久久久久久久免费 | 亚洲人成人一区二区在线观看| 国产欧美一区二区三区另类精品| 欧美久久久久久久久| 久久久久久久一区二区| 午夜精品久久久久久久99热浪潮| 99国产精品久久久久久久成人热| 在线免费观看成人网| 国产一区二区| 国产乱码精品一区二区三区av| 欧美日韩国产免费| 欧美激情国产精品| 女主播福利一区| 久久麻豆一区二区| 久久久久国产精品麻豆ai换脸| 亚洲欧美精品伊人久久| 亚洲视频欧美视频| 一区二区高清视频| 一个色综合导航| 亚洲老司机av| 亚洲免费播放| 99精品国产在热久久婷婷| 亚洲欧洲日本国产| 亚洲国产精品第一区二区三区 | 亚洲欧洲一区二区在线播放 | 嫩草影视亚洲| 麻豆精品传媒视频| 男人的天堂亚洲在线| 免费观看久久久4p| 欧美xx视频| 欧美区视频在线观看| 欧美精品久久久久久久久久| 欧美日韩不卡合集视频| 欧美色中文字幕| 欧美日韩情趣电影| 欧美午夜不卡在线观看免费 | 亚洲欧美国产高清| 亚洲午夜一区| 欧美亚洲综合另类| 久久精品视频免费播放| 久久久久久夜精品精品免费| 久久夜精品va视频免费观看| 麻豆精品91| 欧美日韩国产免费| 国产精品av久久久久久麻豆网| 国产精品美女久久久久av超清| 国产精品乱子久久久久| 国产欧美一区二区视频| 伊人成年综合电影网| 揄拍成人国产精品视频| 黄色成人在线免费| 亚洲精品极品| 亚洲一区二区三区色| 久久高清免费观看| 欧美激情精品久久久久| 欧美视频第二页| 国产精品色一区二区三区| 精品91视频| 中日韩美女免费视频网站在线观看| 亚洲欧美日本国产专区一区| 久久全球大尺度高清视频| 欧美精品1区| 国产精品一区二区在线观看| 亚洲第一区在线| 亚洲天堂男人| 卡一卡二国产精品| 国产精品免费视频xxxx| 精品电影在线观看| 亚洲一级在线| 欧美国产亚洲精品久久久8v| 国产精品影视天天线| 亚洲黄色影院| 欧美一级午夜免费电影| 欧美日韩国产精品| 黑人操亚洲美女惩罚| 亚洲一区二区欧美| 你懂的亚洲视频| 国产乱码精品1区2区3区| 亚洲免费高清| 母乳一区在线观看| 国产日产亚洲精品| 99在线热播精品免费| 久久天堂成人| 国产亚洲亚洲| 亚洲在线观看视频| 欧美区二区三区| 亚洲黄色成人| 久久久久久久久久久一区 | 国语精品中文字幕| 亚洲欧美国产日韩天堂区| 欧美日韩国产欧| 亚洲日本中文| 麻豆成人av| 极品尤物一区二区三区| 欧美亚洲综合久久| 国产精品久久久久久久久借妻| 99这里有精品| 欧美日韩精品一区| 亚洲精品免费在线播放| 老鸭窝亚洲一区二区三区| 国产性做久久久久久| 午夜国产精品视频免费体验区| 欧美日韩精品中文字幕| 亚洲美女一区| 欧美日韩高清在线观看| 亚洲精品国产精品乱码不99按摩| 玖玖玖国产精品| 欧美色综合天天久久综合精品| 媚黑女一区二区| 伊人激情综合| 另类国产ts人妖高潮视频| 国自产拍偷拍福利精品免费一| 欧美影院成年免费版| 国产欧美一区二区三区久久 | 久久久夜夜夜| 精品999日本| 免费视频久久| 亚洲精选一区| 欧美性猛交xxxx乱大交退制版 | 极品尤物av久久免费看| 久久九九免费| 亚洲电影免费在线观看| 欧美大片免费观看| 99国产精品私拍| 国产精品视频精品| 久久久久国产免费免费| 在线观看亚洲| 欧美新色视频|