Dancer and DBIx::Class
Stefan Hornburg (Racke)[email protected]
eCommerce Software
I Magento
Database Administration
I phpmyadmin
I phppgadmin
TableEditor Features
I Different database systems MySQL, PostgreSQL
I higher level of abstraction
I modern frontend
TableEditor
DBIx::Class without Dancer Plugin
use I n t e r c h a n g e 6 : : Schema ;
$schema = I n t e r c h a n g e 6 : : Schema
−
>connect( . . . ) ; $schema−
> r e s u l t s e t ( ’ User ’ )−
>search ( { . . } ) ;DBIx::Class with Dancer Plugin
use Dancer : : P l u g i n : : DBIC ;
schema
−
> r e s u l t s e t ( ’ User ’ )−
>search ( { . . } ) ; r e s u l t s e t ( ’ User ’ )−
>search ( { . . } ) ;Configuration
p l u g i n s : DBIC : d e f a u l t : dsn : d b i : mysql : i n t e r c h a n g e 6 user : ra ck e pass : n e v a i r b e schema_class : I n t e r c h a n g e 6 : : SchemaMultiple Schemas
p l u g i n s : DBIC : d e f a u l t : dsn : d b i : mysql : i n t e r c h a n g e 6 user : ra ck e pass : n e v a i r b e schema_class : I n t e r c h a n g e 6 : : Schema l e g a c y : dsn : d b i : mysql : i n t e r c h a n g e 5 user : ra ck e pass : n e v a i r b e schema_class : I n t e r c h a n g e 5 : : SchemaMultiple Schemas
use Dancer : : P l u g i n : : DBIC ;
UTF-8 for MySQL
p l u g i n s : DBIC : d e f a u l t : dsn : d b i : mysql : i n t e r c h a n g e 6 user : ra ck e pass : n e v a i r b e schema_class : I n t e r c h a n g e 6 : : Schema o p t i o n s : m y s q l _ e n a b l e _ u t f 8 : 1Create schema dynamically
I
schema_class
missing in configurationI DBIx::Class::Schema::Loader
I test and development
Overview Dancer::Session::DBIC
I configuration
I serialization
Engines
I Templates
TT, Xslate, Flute, ...
I Sessions
Storable, Database, DBIC
I Logger
File, Syslog
I Serializer
Configuration
session name of session engine (DBIC)
session_options options
Configuration
s e s s i o n : " DBIC " s e s s i o n _ o p t i o n s : dsn : d b i : mysql : i n t e r c h a n g e 6 user : ra ck e pass : n e v a i r b e schema_class : I n t e r c h a n g e 6 : : Schema r e s u l t s e t : Session id_column : s e s s i o n s _ i d data_column : s e s s i o n _ d a t aConfiguration
s e t s e s s i o n => ’ DBIC ’ ;
Example table
CREATE TABLE ‘ sessions ‘ (
‘ s e s s i o n s _ i d ‘ v a r c h a r ( 2 5 5 ) NOT NULL , ‘ s e s s i o n _ d a t a ‘ t e x t NOT NULL , ‘ c r e a t e d ‘ d a t e t i m e NOT NULL , ‘ l a s t _ m o d i f i e d ‘ d a t e t i m e NOT NULL , PRIMARY KEY ( ‘ s e s s i o n s _ i d ‘ ) ) ENGINE=InnoDB ;
Serializer
s e t ’ s e s s i o n _ o p t i o n s ’ => {
schema => schema ,
s e r i a l i z e r => sub { YAML : : Dump(@_) ; } , d e s e r i a l i z e r => sub { YAML : : Load (@_) ; } , } ;
Overview TableEditor
I Installation I Frontend I Login I Relationships I Limitations I ConfigurationInstallation
g i t c l o n e h t t p s : / / g i t h u b . com / i n t e r c h a n g e / T a b l e E d i t o r cd T a b l e E d i t o r
cpanm . . / b i n / app . p l
Driver
I DBD::mysql
I DBD::Pg
Frontend
I Angular
I Bootstrap
Login
I Dancer::Plugin::Auth::Extensible I Provider I Unix I DBIC I Database(planned)Relationships
I might_have
I has_many
I belongs_to
Limitations
I Primary key foronecolumn only
I Speed (complex schemas)
Planned Features
I Search (Solr)
Development
Dancer2
Plugin::DBIC
https://metacpan.org/pod/Dancer2::
Plugin::DBIC
Session::DBIC not yet ported