国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

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

COMP9315 代做、SQL 語言編程代寫

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



COMP9315 24T1    Assignment 1
Adding a PersonName Data Type to PostgreSQL    DBMS Implementation
Last updated: Saturday 9th March 10:19am
Most recent changes are shown in red ... older changes are shown in brown.
Aims
This assignment aims to give you

an understanding of how data is treated inside a DBMS
practice in adding a new base type to PostgreSQL
The goal is to implement a new data type for PostgreSQL, complete with input/output functions, comparison operators, formatting functions, and the ability to build indexes on values of the type.

Summary
Deadline
Friday 15 March, 11:59pm

Pre-requisites:
before starting this assignment, it would be useful to complete Prac Work P04

Late Penalty:
0.03 marks off the final mark for each hour late
for the first 5 days late; total mark of zero thereafter

Marks:
This assignment contributes 15 marks toward your total mark for this course.

Submission:
Webcms3 > Assignments > Ass1 Submission > Make Submission
or, on CSE machines, give cs9315 ass1 pname.c pname.source
Make sure that you read this assignment specification carefully and completely before starting work on the assignment.
Questions which indicate that you haven't done this will simply get the response "Please read the spec".

We use the following names in the discussion below

PG_CODE ... the directory where your PostgreSQL source code is located   (on vxdb, /localstorage/$USER/postgresql-15.6/)
PG_HOME ... the directory where you have installed the PostgreSQL binaries   (on vxdb, /localstorage/$USER/pgsql/bin/)
PG_DATA ... the directory where you have placed PostgreSQL's data   (on vxdb, /localstorage/$USER/pgsql/data/)
PG_LOG ... the file where you send PostgreSQL's log output   (on vxdb, /localstorage/$USER/pgsql/data/log)
Introduction
PostgreSQL has an extensibility model which, among other things, provides a well-defined process for adding new data types into a PostgreSQL server. This capability has led to the development by PostgreSQL users of a number of types (such as polygons) which have become part of the standard distribution. It also means that PostgreSQL is the database of choice in research projects which aim to push the boundaries of what kind of data a DBMS can manage.

In this assignment, we will be adding a new data type for dealing with people's names. "Hmmm", you say, "but aren't they just text strings, typically implemented as two attributes, one for family name and one for given names?". That may be true, but making names into a separate base data type allows us to explore how we store and manipulate them.

One common way of writing names (e.g. used in UNSW student systems) is

Shepherd,John Andrew
Swift, Taylor
Martin, Eric Andre
Lakshminarasimhan,Venkateswaran Chandrasekara
Marshall-Martin, Sally Angela
Featherstone,Albert Basil Ernest George Harold Randolph William
i.e.
FamilyName,GivenNames
Note: some of the examples above have a space after the comma; some don't. We give a more precise description of what text strings are valid PersonNames below.

Adding Data Types in PostgreSQL
The process for adding new base data types in PostgreSQL is described in the following sections of the PostgreSQL documentation:

38.13 User-defined Types
38.10 C-Language Functions
38.14 User-defined Operators
SQL: CREATE TYPE
SQL: CREATE OPERATOR
SQL: CREATE OPERATOR CLASS
Section 38.13 uses an example of a complex number type, which you can use as a starting point for defining your PersonName data type (see below). There are other examples of new data types under the directories:

PG_CODE/contrib/chkpass/ ... an auto-encrypted password datatype
PG_CODE/contrib/citext/ ... a case-insensitive character string datatype
PG_CODE/contrib/seg/ ... a confidence-interval datatype
These may or may not give you some useful ideas on how to implement the PersonName data type. For example, many of these data types are fixed-size, while PersonNames are variable-sized. A potentially useful example of implementing variable-sized types can be found in:

PG_CODE/src/tutorial/funcs.c ... implementation of several data types
Setting Up
You ought to start this assignment with a fresh copy of PostgreSQL, without any changes that you might have made for the Prac exercises (unless these changes are trivial). Note that you only need to configure, compile and install your PostgreSQL server once for this assignment. All subsequent compilation takes place in the src/tutorial directory, and only requires modification of the files there.

Once you have re-installed your PostgreSQL server, you should run the following commands:

$ cd PG_CODE/src/tutorial
$ cp complex.c pname.c
$ cp complex.source pname.source
Note the pname.* files will contain many references to complex; I do not want to see any remaining occurences of the word complex in the files that you eventually submit. These files simply provide a template in which you create your PersonName type.

Once you've made the pname.* files, you should also edit the Makefile in this directory and add the green text to the following lines:

MODULES = complex funcs pname
DATA_built = advanced.sql basics.sql complex.sql funcs.sql syscat.sql pname.sql
The rest of the work for this assignment involves editing only the pname.c and pname.source files. In order for the Makefile to work properly, you must use the identifier _OBJWD_ in the pname.source file to refer to the directory holding the compiled library. You should never modify directly the pname.sql file produced by the Makefile. Place all of your C code in the pname.c file; do not create any other *.c files.

Note that your submitted versions of pname.c and pname.source should not contain any references to the complex type. Make sure that the documentation (comments in program) describes the code that you wrote. Leaving the word complex anywhere in either pname.* file will result in a 1 mark penalty.

The Person Name Data Type
We wish to define a new base type PersonName to represent people's names, in the format FamilyName,GivenNames. We also aim to define a useful set of operations on values of type PersonName and wish to be able to create indexes on attributes of type PersonName. How you represent PersonName values internally, and how you implement the functions to manipulate them internally, is up to you. However, they must satisfy the requirements below.

Once implemented correctly, you should be able to use your PostgreSQL server to build the following kind of SQL applications:

create table Students (
   zid       integer primary key,
   name      PersonName not null,
   degree    text,
   -- etc. etc.
);

insert into Students(zid,name,degree) values
(9300035,'Shepherd, John Andrew', 'BSc(Computer Science)'),
(5012345,'Smith, Stephen', 'BE(Hons)(Software Engineering)');

create index on Students using hash (name);

select a.zid, a.name, b.zid
from   Students a join Students b on (a.name = b.name);

select family(name), given(name), show(name)
from   Students;

select name,count(*)
from   Students
group  by name;
Having defined a hash-based file structure, we would expect that the queries would make use of it. You can check this by adding the keyword EXPLAIN before the query, e.g.

db=# explain analyze select * from Students where name='Smith,John';
which should, once you have correctly implemented the data type and loaded sufficient data, show that an index-based scan of the data is being used. Note that this will only be evident if you use a large amount of data (e.g. one of the larger test data samples to be provided).

Person Name values
Valid PersonNames will have the above format with the following qualifications:

there may be a single space after the comma
there will be no people with just one name (e.g. no Prince, Jesus, Aristotle, etc.)
there will be no numbers (e.g. noGates, William 3rd)
there will be no titles (e.g. no Dr, Prof, Mr, Ms)
there will be no initials (e.g. no Shepherd,John A)
In other words, you can ignore the possibility of certain types of names while implementing your input and output functions.

If titles occur, you can assume that they will occur after a comma after the given names, e.g. "Smith, John, Dr". If a string that looks like a title occurs (accidentally) where a name might occur, treat it as a name.

A more precise definition can be given using a BNF grammar:

PersonName ::= Family','Given | Family', 'Given

Family     ::= NameList
Given      ::= NameList

NameList   ::= Name | Name' 'NameList

Name       ::= Upper Letters

Letter     ::= Upper | Lower | Punc

Letters    ::= Letter | Letter Letters

Upper      ::= 'A' | 'B' | ... | 'Z'
Lower      ::= 'a' | 'b' | ... | 'z'
Punc       ::= '-' | "'"
You should not make any assumptions about the maximum length of a PersonName.

Under this syntax, the following are valid names:

Smith,John
Smith, John
O'Brien, Patrick Sean
Mahagedara Patabendige,Minosha Mitsuaki Senakasiri
I-Sun, Chen Wang
Clifton-Everest,Charles Edward
The following names are not valid in our system:

Jesus                     # no single-word names
Smith  ,  Harold          # space before the ","
Gates, William H., III    # no initials, too many commas
A,B C                     # names must contain at least 2 letters
Smith, john               # names begin with an upper-case letter
Think about why each of the above is invalid in terms of the syntax definition.

Important: for this assignment, we define an ordering on names as follows:

the ordering is determined initially by the ordering on the Family Name
if the Family Names are equal, then the ordering is determined by the Given Names
ordering of parts is determined lexically
There are examples of how this works in the section on Operations on PersonNames below.

Representing Person Names
The first thing you need to do is to decide on an internal representation for your PersonName data type. You should do this, however, after you have looked at the description of the operators below, since what they require may affect how you decide to structure your internal PersonName values.

When you read strings representing PersonName values, they are converted into your internal form, stored in the database in this form, and operations on PersonName values are carried out using this data structure. It is useful to define a canonical form for names, which may be slightly different to the form in which they are read (e.g. "Smith, John" might be rendered as "Smith,John"). When you display PersonName values, you should show them in canonical form, regardless of how they were entered or how they are stored.

The first functions you need to write are ones to read and display values of type PersonName. You should write analogues of the functions complex_in(), complex_out that are defined in the file complex.c. Call them, e.g., pname_in() and pname_out(). Make sure that you use the V1 style function interface (as is done in complex.c).

Note that the two input/output functions should be complementary, meaning that any string displayed by the output function must be able to be read using the input function. There is no requirement for you to retain the precise string that was used for input (e.g. you could store the PersonName value internally in a different form such as splitting it into two strings: one for the family name(s), and one for the given name(s)).

One thing that pname_in() must do is determine whether the name has the correct structure (according to the grammar above). Your pname_out() should display each name in a format that can be read by pname_in().

Note that you are not required to define binary input/output functions, called receive_function and send_function in the PostgreSQL documentation, and called complex_send and complex_recv in the complex.cfile.

As noted above, you cannot assume anything about the maximum length of names. If your solution uses two fixed-size buffers (one for family, one for given) then your mark is limited to a maximum of 8/15, even if you pass all of the tests.

Operations on person names
You must implement all of the following operations for the PersonName type:

PersonName1 = PersonName2 ... two names are equal

Two PersonNames are equivalent if, they have the same family name(s) and the same given name(s).

PersonName1: Smith,John
PersonName2: Smith, John
PersonName3: Smith, John David
PersonName4: Smith, James

(PersonName1 = PersonName1) is true
(PersonName1 = PersonName2) is true
(PersonName2 = PersonName1) is true        (commutative)
(PersonName2 = PersonName3) is false
(PersonName2 = PersonName4) is false
PersonName1 > PersonName2 ... the first PersonName is greater than the second

PersonName1 is greater than PersonName2 if the Family part of PersonName1 is lexically greater than the Family part of PersonName2. If the Family parts are equal, then PersonName1 is greater than PersonName2 if the Given part of PersonName1 is lexically greater than the Given part of PersonName2.

PersonName1: Smith,James
PersonName2: Smith,John
PersonName3: Smith,John David
PersonName4: Zimmerman, Trent

(PersonName1 > PersonName2) is false
(PersonName1 > PersonName3) is false
(PersonName3 > PersonName2) is true
(PersonName1 > PersonName1) is false
(PersonName4 > PersonName3) is true
Other operations:   <>,   >=,   <,   <=

You should also implement the above operations, whose semantics is hopefully obvious from the descriptions above. The operators can typically be implemented quite simply in terms of the first two operators.

family(PersonName) returns just the Family part of a name

PersonName1: Smith,James
PersonName2: O'Brien,Patrick Sean
PersonName3: Mahagedara Patabendige,Minosha Mitsuaki Senakasir
PersonName4: Clifton-Everest,David Ewan

family(PersonName1) returns "Smith"
family(PersonName2) returns "O'Brien"
family(PersonName3) returns "Mahagedara Patabendige"
family(PersonName4) returns "Clifton-Everest"
given(PersonName) returns just the Given part of a name

PersonName1: Smith,James
PersonName2: O'Brien,Patrick Sean
PersonName3: Mahagedara Patabendige,Minosha Mitsuaki Senakasir
PersonName4: Clifton-Everest,David Ewan

given(PersonName1) returns "James"
given(PersonName2) returns "Patrick Sean"
given(PersonName3) returns "Minosha Mitsuaki Senakasir"
given(PersonName4) returns "David Ewan"
show(PersonName) returns a displayable version of the name

It appends the entire Family name to the first Given name (everything before the first space, if any), separated by a single space.

PersonName1: Smith,James
PersonName2: O'Brien,Patrick Sean
PersonName3: Mahagedara Patabendige,Minosha Mitsuaki Senakasir
PersonName4: Clifton-Everest,David Ewan
PersonName5: Bronte,Greta-Anna Maryanne

show(PersonName1) returns "James Smith"
show(PersonName2) returns "Patrick O'Brien"
show(PersonName3) returns "Minosha Mahagedara Patabendige"
show(PersonName4) returns "David Clifton-Everest"
show(PersonName5) returns "Greta-Anna Bronte"
Hint: test out as many of your C functions as you can outside PostgreSQL (e.g. write a simple test driver) before you try to install them in PostgreSQL. This will make debugging much easier.

You should ensure that your definitions capture the full semantics of the operators (e.g. specify commutativity if the operator is commutative). You should also ensure that you provide sufficient definitions so that users of the PersonName type can create hash-based indexes on an attribute of type PersonName.

Submission
You need to submit two files: pname.c containing the C functions that implement the internals of the PersonName data type, and pname.source containing the template SQL commands to install the PersonName data type into a PostgreSQL server. Do not submit the pname.sql file, since it contains absolute file names which are not helpful in our test environment.
請加QQ:99515681  郵箱:99515681@qq.com   WX:codehelp 

掃一掃在手機打開當前頁
  • 上一篇:菲律賓黑名單洗白要多久 &#160;黑名單洗白費用
  • 下一篇:代做COMP2013、代寫 c++/java,Python 編程
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務 管路
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真技術服務
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲勞振動
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲
    流體cfd仿真分析服務 7類仿真分析代做服務40個行業
    流體cfd仿真分析服務 7類仿真分析代做服務4
    超全面的拼多多電商運營技巧,多多開團助手,多多出評軟件徽y1698861
    超全面的拼多多電商運營技巧,多多開團助手
    CAE有限元仿真分析團隊,2026仿真代做咨詢服務平臺
    CAE有限元仿真分析團隊,2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗證碼 寵物飼養 十大衛浴品牌排行 suno 豆包網頁版入口 wps 目錄網 排行網

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

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

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    亚洲欧洲三级| 午夜精品区一区二区三| 欧美成人免费va影院高清| 欧美一区二区视频在线| 国产伦精品一区二区三区四区视频| 色偷偷91综合久久噜噜| 少妇高清精品毛片在线视频| 国产肉体ⅹxxx137大胆| 国产精品入口日韩视频大尺度| 日韩在线电影一区| 91久久精品久久国产性色也91| 精品免费日产一区一区三区免费| 欧美第一黄网| www.99久久热国产日韩欧美.com| 岛国视频一区| 99精品国产一区二区| 欧美激情一区二区三区高清视频| 麻豆一区二区三区在线观看 | 久久一区二区精品| 一本—道久久a久久精品蜜桃| 国产无限制自拍| 国产精品对白刺激| 免费特级黄色片| 国产成人精品自拍| 午夜一区二区三视频在线观看| www日韩视频| 亚洲熟妇av一区二区三区| 国产乱子伦精品| 亚洲一区 在线播放| 99久久久精品视频| 午夜精品久久久久久久男人的天堂| 国产一区二区三区精彩视频| 久久国产天堂福利天堂| 国产欧美日韩91| 欧美精品在线观看| 国产欧美日韩精品在线观看| 日韩精品―中文字幕| 亚洲精品免费av| 欧美性大战久久久久| 国产成人精品视频在线观看| 欧美日韩国产高清视频| 国产精品久久网| 国产日韩av高清| 一区二区视频在线免费| 91久热免费在线视频| 日本久久亚洲电影| 国产成人在线小视频| 欧美性视频网站| 不卡av日日日| www亚洲国产| 日本一区免费在线观看| 久久精品国产亚洲7777| 国产无限制自拍| 亚洲国产一区二区在线| 久久精品美女| 蜜桃网站成人| 亚洲成人一区二区三区| 日韩综合中文字幕| 国产日产亚洲精品| 性欧美亚洲xxxx乳在线观看| www.亚洲成人| 国内精品一区二区三区四区| 亚洲一区亚洲二区亚洲三区| 国产成人一区二区| 黄色一级二级三级| 亚洲自拍欧美另类| 日韩中文字幕视频在线观看| 国产乱人伦精品一区二区三区| 无码人妻丰满熟妇区96| 国产精品嫩草影院久久久| 成人国产精品久久久| 日韩一级免费在线观看| 美女精品久久久| 九九久久九九久久| 国产噜噜噜噜噜久久久久久久久| 日韩av日韩在线观看| 久久五月情影视| 国产精品亚洲第一区| 青青在线免费观看| 宅男av一区二区三区| 日韩中文字幕亚洲| 成人在线国产精品| 日本一区二区三区免费看| 精品国产中文字幕| 精品国产一区二区三区久久久狼| 成人国产精品久久久久久亚洲| 欧美视频在线观看网站| 欧美一区二区色| 萌白酱国产一区二区| 精品国产欧美一区二区五十路| 91精品久久久久久久久久久久久| 国产99在线播放| 日本精品一区二区| 美日韩精品免费视频| 国产美女精品在线观看| 欧美在线视频导航| 大地资源第二页在线观看高清版| 国产深夜男女无套内射| 欧美精品一区二区性色a+v| 一区二区传媒有限公司| 国产精品加勒比| 日韩亚洲精品视频| 久久男人的天堂| 国产伦理久久久| 国内精品久久久久影院优| 日韩暖暖在线视频| 欧美极品美女电影一区| 国产精品久久久久久久午夜| 国产精品成人品| 91久久综合亚洲鲁鲁五月天| 日日噜噜噜夜夜爽爽| 国内精品视频久久| 欧美亚洲另类视频| 日韩国产精品一区二区三区| 亚洲资源视频| 欧美日本精品在线| 不卡伊人av在线播放| 国产精品美女久久久久av超清 | 日韩一级片播放| 久久成人精品一区二区三区| 国产精品免费视频久久久| 国产精品99久久久久久久久| 不卡日韩av| 成人中文字幕在线播放| 国产精品一区二区免费在线观看| 国产又爽又黄的激情精品视频| 欧美老熟妇喷水| 欧美牲交a欧美牲交| 欧美中在线观看| 日韩精品在在线一区二区中文| 久久久亚洲国产| 精品一区二区三区无码视频| 日本公妇乱淫免费视频一区三区| 亚洲免费视频一区| 一区二区三区精品国产| 国产精品美女久久久久av福利| 国产精品果冻传媒潘| 久久久久亚洲精品| 视频一区二区三| 国产精品久久一| 国产欧美日韩91| 亚洲一区美女| 国产精品99久久免费黑人人妻| 欧美日韩另类综合| 国产精品丝袜白浆摸在线| av动漫在线观看| 国产极品jizzhd欧美| 成人在线观看毛片| 国产免费一区二区三区视频| 日日摸天天爽天天爽视频| zzijzzij亚洲日本成熟少妇| 秋霞久久久久久一区二区| 久久久精品亚洲| 欧洲精品在线视频| 午夜精品久久久内射近拍高清| 久久久久久久久久久久久久一区 | 黄色一级片国产| 中文字幕在线观看一区二区三区| 久久国产精品免费观看| 精品无人区一区二区三区| 日韩伦理一区二区三区av在线| 亚洲www在线| 久久久久久国产精品免费免费| 国产精品尤物福利片在线观看| 永久免费看av| 99久久精品免费看国产四区| 亚洲最新在线| 大地资源第二页在线观看高清版| 亚洲国产日韩美| 亚洲高清在线观看一区| 日韩亚洲综合在线| 精品久久一二三| 国产精品视频一区二区三区经| 97人人爽人人喊人人模波多| 国产精品一区二区三区观看| 久久久精品亚洲| 日本不卡在线播放| 日韩中文有码在线视频| 国产精品美女在线| 国产精品国产三级国产aⅴ9色| 国产欧美日韩中文字幕在线| 国产肉体ⅹxxx137大胆| 狠狠色综合一区二区| 青草网在线观看| 欧美高清视频一区 | 国产精品视频自拍| 中文字幕在线亚洲三区| 亚洲视频精品一区| 久久久久久久久久亚洲| 成人免费在线网址| 成人在线精品视频| 97精品久久久| 久热精品视频在线| 久久国产手机看片| 日韩国产欧美一区| 国产精品12| 国产精品福利小视频| 亚洲色欲久久久综合网东京热| 欧美激情中文字幕乱码免费| 色噜噜狠狠一区二区三区 |