Table creation/Postal addresses: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 237:
[1] 16 Brougnard 666 rue des Cascades Paris Seine 75042
</lang>
 
 
=={{header|Erlang}}==
Line 777 ⟶ 776:
 
This example uses mysql, but DBI supports a extensive list of database drivers. See [http://dbi.perl.org/ dbi.perl.org] for more info.
 
=={{header|Perl 6}}==
{{works with|Rakudo|2017.09}}
 
Like Perl DBI, Perl 6 DBIish supports many different databases. An example using SQLite is shown here.
 
<lang perl6>use DBIish;
 
my $dbh = DBIish.connect('SQLite', :database<addresses.sqlite3>);
 
my $sth = $dbh.do(q:to/STATEMENT/);
DROP TABLE IF EXISTS Address;
CREATE TABLE Address (
addrID INTEGER PRIMARY KEY AUTOINCREMENT,
addrStreet TEXT NOT NULL,
addrCity TEXT NOT NULL,
addrState TEXT NOT NULL,
addrZIP TEXT NOT NULL
)
STATEMENT</lang>
 
=={{header|Phix}}==
Line 879 ⟶ 858:
zip varchar(20) not null
);</lang>
 
 
 
=={{header|PureBasic}}+SQLite==
Easiest approach with sqlite. Further possible: PostgresQL or each other over ODBC.
<lang Purebasic>
UseSQLiteDatabase()
Procedure CheckDatabaseUpdate(Database, Query$)
Result = DatabaseUpdate(Database, Query$)
If Result = 0
Print(DatabaseError())
EndIf
ProcedureReturn Result
EndProcedure
openconsole()
DatabaseFile$ = GetCurrentDirectory()+"/rosettadb.sdb"
If CreateFile(0, DatabaseFile$)
CloseFile(0)
If OpenDatabase(0, DatabaseFile$, "", "")
CheckDatabaseUpdate(0,"CREATE TABLE address ( addrID INTEGER PRIMARY KEY AUTOINCREMENT, addrStreet TEXT Not NULL, addrCity TEXT Not NULL, addrState TEXT Not NULL, addrZIP TEXT Not NULL)")
CloseDatabase(0)
Else
print("Can't open database !")
EndIf
Else
print("Can't create the database file !")
EndIf
closeconsole()
</lang>
 
=={{header|PowerShell}}+SQLite==
Line 952 ⟶ 902:
1 Monster Cookie 666 Sesame St Holywood CA 90013
</pre>
 
=={{header|PureBasic}}+SQLite==
Easiest approach with sqlite. Further possible: PostgresQL or each other over ODBC.
<lang Purebasic>
UseSQLiteDatabase()
Procedure CheckDatabaseUpdate(Database, Query$)
Result = DatabaseUpdate(Database, Query$)
If Result = 0
Print(DatabaseError())
EndIf
ProcedureReturn Result
EndProcedure
openconsole()
DatabaseFile$ = GetCurrentDirectory()+"/rosettadb.sdb"
If CreateFile(0, DatabaseFile$)
CloseFile(0)
If OpenDatabase(0, DatabaseFile$, "", "")
CheckDatabaseUpdate(0,"CREATE TABLE address ( addrID INTEGER PRIMARY KEY AUTOINCREMENT, addrStreet TEXT Not NULL, addrCity TEXT Not NULL, addrState TEXT Not NULL, addrZIP TEXT Not NULL)")
CloseDatabase(0)
Else
print("Can't open database !")
EndIf
Else
print("Can't create the database file !")
EndIf
closeconsole()
</lang>
 
=={{header|Python}}+SQLite==
Line 1,038 ⟶ 1,015:
National Security Council, 1700 Pennsylvania Avenue NW, Washington.
</pre>
 
=={{header|Perl 6Raku}}==
(formerly Perl 6)
{{works with|Rakudo|2017.09}}
 
Like Perl DBI, Perl 6 DBIish supports many different databases. An example using SQLite is shown here.
 
<lang perl6>use DBIish;
 
my $dbh = DBIish.connect('SQLite', :database<addresses.sqlite3>);
 
my $sth = $dbh.do(q:to/STATEMENT/);
DROP TABLE IF EXISTS Address;
CREATE TABLE Address (
addrID INTEGER PRIMARY KEY AUTOINCREMENT,
addrStreet TEXT NOT NULL,
addrCity TEXT NOT NULL,
addrState TEXT NOT NULL,
addrZIP TEXT NOT NULL
)
STATEMENT</lang>
 
=={{header|REXX}}==
10,327

edits