[Dbix-class] insert not working.
Rajeev Prasad
rp.neuli at yahoo.com
Sun Aug 14 06:07:26 GMT 2011
hello, can someone tell what is wrong here. thx. (I am totally new to db op=
erations in perl)
first table structure:
Table =
Action =
Rows =
Type =
Collation =
Size =
Overhead =
=
testdbtasks Browse Structure Search Insert Empty Drop 0 MyISAM ascii_=
general_ci 1.0 KiB - =
=
testdbusers Browse Structure Search Insert Empty Drop 0 MyISAM ascii_=
general_ci 1.0 KiB - =
2 tables =
Sum
0
MyISAM
ascii_general_ci
2.0 KiB
0 B
testdbtasks:
#
Column
Type
Collation
Attributes
Null
Default
Extra
Action
1 =
useridchar(6) ascii_general_ci =
No None =
Change Drop More =
2 =
taskvarchar(50) ascii_general_ci =
No None =
Change Drop More =
3 =
taskstart_datedate =
=
No None =
Change Drop More =
4 =
taskstart_timetime =
=
No None =
Change Drop More =
5 =
taskend_datedate =
=
No None =
Change Drop More =
6 =
taskend_timetime =
=
No None =
Change Drop More =
7 =
statuschar(1) ascii_general_ci =
No None =
Change Drop More =
#
Column
Type
Collation
Attributes
Null
Default
Extra
Action
1 =
useridchar(6) ascii_general_ci =
No None =
Change Drop More =
2 =
passwordvarchar(10) ascii_bin =
No None =
Change Drop More =
generated schema:
#!/usr/bin/perl
use strict;
use warnings;
use DBIx::Class::Schema::Loader qw/make_schema_at/;
make_schema_at(
=A0=A0=A0=A0=A0=A0=A0 "Mysqltestdb::Schema",
=A0=A0=A0=A0=A0=A0=A0 {debug =3D> 0, dump_directory =3D> "../testdb/",
=A0=A0=A0=A0=A0=A0=A0 generate_pod =3D> 0,},
=A0=A0=A0=A0=A0=A0=A0 ["dbi:mysql:mysqltestdb:localhost:3306", 'root', 'mys=
qlpassword'],
);
this gets me:
$ ls -R testdb/
testdb/:
Mysqltestdb
testdb/Mysqltestdb:
Schema=A0 Schema.pm
testdb/Mysqltestdb/Schema:
Result=A0 ResultSet
testdb/Mysqltestdb/Schema/Result:
Testdbtask.pm=A0 Testdbuser.pm
testdb/Mysqltestdb/Schema/ResultSet:
so i am trying to run the following script now from different directory. (i=
nspired from http://search.cpan.org/~abraxxa/DBIx-Class-0.08195/lib/DBIx/Cl=
ass/Manual/Example.pod)
#!/usr/bin/perl
use strict;
use warnings;
use Mysqltestdb::Schema;
my $schema =3D Mysqltestdb::Schema->connect("dbi:mysql:mysqltestdb:localhos=
t:3306", 'root', 'mysql5');
my @users =3D (['test123'], ['test456']);
$schema->populate('testdbusers', [
=A0=A0 [qw/userid/],
=A0=A0 @testdbuserss,
]);
I am getting:
Can't locate Mysqltestdb/Schema.pm in @INC (@INC contains: /etc/perl /usr/l=
ocal/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share=
/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) =
at ./insertdb.pl line 6.
BEGIN failed--compilation aborted at ./insertdb.pl line 6.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20110813/719=
b54e4/attachment-0001.htm
More information about the DBIx-Class
mailing list