My 2 cents, it is also worth to use rose db object autoreconnect plugin and new_or_cached() instead of new ().
-- HtH, Sergey (from mobile) 08 янв. 2014 г. 12:50 пользователь "Sergey Andreev" < [email protected]> написал: > Thank you! Now I'm sees where i've got mistake. > > > 2014/1/8 LesPaul7String <[email protected]> > >> Hi Sergey, >> this is how I got it working >> in folder my_app/lib/MyApp/Models/ >> I have a file called Base.pm >> this is the code from it: >> >> package MyApp::Models::Base; >> >> use strict; >> use warnings; >> >> use parent 'Rose::DB'; >> >> __PACKAGE__->use_private_registry; >> >> __PACKAGE__->register_db( >> driver => 'mysql', >> database => 'my_db', >> host => 'localhost', >> username => 'root', >> password => '', >> ); >> >> 1; >> >> >> then, in the same folder I have a file called Object.pm >> this is the code from it: >> >> package MyApp::Models::Object; >> >> use strict; >> use warnings; >> >> use parent 'Rose::DB::Object'; >> >> use MyApp::Models::Base; >> >> sub init_db { MyApp::Models::Base->new }; >> >> 1; >> >> >> then, let's say you have a table called 'artists' >> I have a fille called Artists.pm >> this is the code: >> package MyApp::Models::Rooms; >> >> use strict; >> use warnings; >> >> use parent 'MyApp::Models::Object'; >> >> __PACKAGE__->meta->make_manager_class('artists'); >> >> __PACKAGE__->meta->setup( >> table => 'artists', >> columns => [ qw(id name) ], >> pk_columns => 'id', >> ); >> >> 1; >> >> >> This should work, if you search for an artists or if you want to retrieve >> multiple ones :) >> >> Regards, >> Andrei >> >> On Saturday, January 4, 2014 1:09:09 PM UTC+2, Sergey Andreev wrote: >>> >>> Good day everyone. >>> Can anyone who use Rose::DB::Object, share the sample code how you >>> manage connections? >>> I'm always have same error 'No database information found for domain >>> 'default' and type 'default'. >>> Can't get what i'm doing wrong. >>> Thank you. >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > Sergey Andreev > > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/mojolicious. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/groups/opt_out.
