Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Da li neko ima EBNF gramatiku za DDL?

[es] :: Art of Programming :: Da li neko ima EBNF gramatiku za DDL?

[ Pregleda: 2652 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

gajo2
Budapest

Član broj: 62614
Poruke: 518
*.ptt.yu.

Sajt: b.flyingoranges.com


+117 Profil

icon Da li neko ima EBNF gramatiku za DDL?15.01.2007. u 00:08 - pre 210 meseci
Pozdrav svima!

Zelim da napravim jednostavan SQL Extended Data Language parser. Trebaju mi samo komande CREATE TABLE, CREATE INDEX i ALTER TABLE, nista vise. Trazio sam svuda po internetu da li negde imaju gramatiku DDL-a, po mogucnosti u EBNF formatu, ali nisam nista nasao. Da li neko ima neki link ili dokument da mi posalje o ovome? Nije bitno koja se baza koristi, ja cu podrzati MySQL i Oracle, ali treba mi barem nesto priblizno.
 
Odgovor na temu

netoff
Duca Pantelić
USA

Član broj: 15761
Poruke: 42
*.sbb.co.yu.



Profil

icon Re: Da li neko ima EBNF gramatiku za DDL?15.01.2007. u 23:55 - pre 210 meseci
Šta je to SQL Extended Data Language?

Izgleda da nisi baš dobro tražio.
Code:

SQL Minimum Grammar
This section describes the minimum SQL syntax that an ODBC driver must support. The syntax described in this section is a subset of the Entry level syntax of SQL-92. 

An application can use any of the syntax in this section and be assured that any ODBC-compliant driver will support that syntax. To determine whether additional features of SQL-92 not in this section are supported, the application should call SQLGetInfo with the SQL_SQL_CONFORMANCE information type. Even if the driver does not conform to any SQL-92 conformance level, an application can still use the syntax described in this section. If a driver conforms to an SQL-92 level, on the other hand, it supports all syntax included in that level. This includes the syntax in this section because the minimum grammar described here is a pure subset of the lowest SQL-92 conformance level. Once the application knows the SQL-92 level supported, it can determine whether a higher-level feature is supported (if any) by calling SQLGetInfo with the individual information type corresponding to that feature. 

Drivers that work only with read-only data sources might not support those parts of the grammar included in this section that deal with changing data. An application can determine if a data source is read-only by calling SQLGetInfo with the SQL_DATA_SOURCE_READ_ONLY information type.

Statement
create-table-statement ::=
     CREATE TABLE base-table-name
     (column-identifier data-type [,column-identifier data-type]...) 

Important    As a data-type in a create-table-statement, applications must use a data type from the TYPE_NAME column of the result set returned by SQLGetTypeInfo.
delete-statement-searched ::=
     DELETE FROM table-name [WHERE search-condition]

drop-table-statement ::=
     DROP TABLE base-table-name 

insert-statement ::=
     INSERT INTO table-name [( column-identifier [, column-identifier]...)]
     VALUES (insert-value[, insert-value]... )

select-statement ::=
     SELECT [ALL | DISTINCT] select-list
     FROM table-reference-list
     [WHERE search-condition]
     [order-by-clause]

statement ::= create-table-statement
     | delete-statement-searched
     | drop-table-statement
     | insert-statement
     | select-statement
     | update-statement-searched

update-statement-searched
     UPDATE table-name
     SET column-identifier = {expression | NULL }
          [, column-identifier = {expression | NULL}]...
     [WHERE search-condition]

Elements Used in SQL Statements
The following elements are used in the SQL statements listed previously.

Element
base-table-identifier ::= user-defined-name

base-table-name ::= base-table-identifier

boolean-factor ::= [NOT] boolean-primary

boolean-primary ::= comparison-predicate | ( search-condition )

boolean-term ::= boolean-factor [AND boolean-term]

character-string-literal ::= ''{character}...''
(character is any character in the character set of the driver/data source. To include a single literal quote character ('') in a character-string-literal, use two literal quote characters [''''].)

column-identifier ::= user-defined-name

column-name ::= [table-name.]column-identifier

comparison-operator ::= < | > | <= | >= | = | <>

comparison-predicate ::= expression comparison-operator expression

data-type ::= character-string-type
(character-string-type is any data type for which the ""DATA_TYPE"" column in the result set returned by SQLGetTypeInfo is either SQL_CHAR or SQL_VARCHAR.)

digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 

dynamic-parameter ::= ?

expression ::= term | expression {+|–} term

factor ::= [+|–]primary

insert-value ::=
     dynamic-parameter
     | literal
     | NULL
     | USER

letter ::= lower-case-letter | upper-case-letter

literal ::= character-string-literal

lower-case-letter ::= a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z

order-by-clause ::=    ORDER BY sort-specification [, sort-specification]...

primary ::= column-name
     | dynamic-parameter
     | literal
     | ( expression )

search-condition ::= boolean-term [OR search-condition]

select-list ::= * | select-sublist [, select-sublist]... 
(select-list cannot contain parameters.)

select-sublist ::= expression

sort-specification ::= {unsigned-integer | column-name} [ASC | DESC]

table-identifier ::= user-defined-name

table-name ::= table-identifier

table-reference ::= table-name

table-reference-list ::= table-reference [,table-reference]...

term ::= factor | term {*|/} factor

unsigned-integer ::= {digit}

upper-case-letter ::= A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

user-defined-name ::= letter[digit | letter | _]...



Mala ispravka, možda bi bolje bilo reći SQL Iskazi a ne komande.

Ako ovo nije dovoljno u knjizi "A Guide to the SQL Standard" od C.J.Date-a sve je to lepo objašnjeno.

 
Odgovor na temu

gajo2
Budapest

Član broj: 62614
Poruke: 518
*.ptt.yu.

Sajt: b.flyingoranges.com


+117 Profil

icon Re: Da li neko ima EBNF gramatiku za DDL?16.01.2007. u 00:05 - pre 210 meseci
Sjajno! Hvala puno, ovo je upravo ono sto mi treba! I mislio sam na Data Definition Language (DDL) ali sam vec bio jako umoran...
 
Odgovor na temu

[es] :: Art of Programming :: Da li neko ima EBNF gramatiku za DDL?

[ Pregleda: 2652 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.