Skip to content

Instantly share code, notes, and snippets.

@massa
Created April 8, 2022 11:08
Show Gist options
  • Save massa/4745e90a5a7502c4cae2ebb7e96c9600 to your computer and use it in GitHub Desktop.
Save massa/4745e90a5a7502c4cae2ebb7e96c9600 to your computer and use it in GitHub Desktop.
#!/usr/bin/env raku
use v6.d;
use DBIish;
use YAMLish;
my %cred = load-yaml("%*ENV<HOME>/.creds.yaml".IO.slurp)<gabinete>;
my $db = DBIish.connect: 'mysql', :host<127.0.0.1>, :3306port, |%cred;
$db.execute('drop database if exists testedb');
$db.execute('create database if not exists testedb');
$db.execute('use testedb');
$db.execute('drop table if exists teste01');
$db.execute(q:to/END/);
create table if not exists teste01 (
id INTEGER PRIMARY KEY auto_increment,
nome varchar(200),
obs blob(2000)
)
END
$db.execute('insert into teste01 set nome = "Bruno", obs = "We dont talk about Bruno"');
$db.execute('insert into teste01 set id = 5, nome = "Pepa", obs = "Controls the weather"');
$db.execute('insert into teste01 set nome = "Marisol"');
say save-yaml $db.execute('select * from teste01').allrows;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment