Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[drafts] removed old Squirrel example, added new Squerl one
- Loading branch information
Carl Masak
committed
Sep 28, 2009
1 parent
756685b
commit 9c16b38
Showing
2 changed files
with
29 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use v6; | ||
use Squerl; | ||
|
||
my $DB = Squerl.sqlite('example.db'); | ||
|
||
$DB.create_table: 'fruits', | ||
'id' => 'primary_key', | ||
'name' => 'String', | ||
'qty' => 'Int', | ||
; | ||
|
||
my $fruits = $DB<fruits>; | ||
|
||
my $i = 0; | ||
for <apples pears oranges ninjas peaches papayas> | ||
Z < 50 20 70 3 15 35> -> $name, $qty { | ||
|
||
$fruits.insert($i++, $name, +$qty); | ||
} | ||
|
||
# those ninjas get in anywhere | ||
$fruits.filter('name' => 'ninjas').delete; | ||
|
||
# new shipment of pears | ||
$fruits.filter('name' => 'pears').update('qty' => 40); | ||
|
||
for $fruits.filter(sql_number('qty').gt(35)).llist { | ||
say sprintf 'There are %d %s', .[2], .[1]; | ||
} |
This file was deleted.
Oops, something went wrong.