hi,
i've posted today attached mail to dbi-users list, but after
some more inspection i think that maybe this list is more
appropriate.
another simple script, just with this one sql on pure DBI works
perfectly well.
attached mail contains a fragment from a log of some catalyst application.
just about a code which uses update_or_create on table with foreign key
the are two connections to schema, one standard generated
by catalyst and used for autentication, and other one
from external model class which uses schema generated by catalyst
package WBT::Esk::Model;
use WBT::Esk::Schema;
use Moose;
use Data::Dumper;
use DateTime;
has schema => ( is=>'rw',
builder=>'_init_schema' );
sub _init_schema {
my $s= WBT::Esk::Schema->connect('dbi:mysql:esk');
return $s;
}
so probably those two connections may share single dbi handle
(same connection parameters)?
if someone has some clue, i'd be gratefull
--
regards
piotr
--- Begin Message ---
hi,
below some trace output of perl script.
just do not know whether the bug is in DBI, DBD::mysql, DBIx::Class or
mysql.
i appreciate any suggestion if the problem should be reported elsewhere
issuing query on mysql client console - i got correct results.
what's more, when table grows to 50 records, script/query starts working
correctly
for query
SELECT me.customer_id, me.company_id, me.person_id, me.customer_position,
me.instance_id FROM customer me WHERE ( me.customer_id IS NULL )
i got result
<- fetchrow_array= ( '37' '8' '4' 'f:8 os:4 i:3' '3' ) [5 items] row1 at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 2034 via at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 74
so searching for customer_id is null (which does not exist in database) i
got row
with customer_id=37
some help appreciated. it's know problem, or new one?
as i do not know whether trying to find the bug or
refactor code, as i'm short of time
tested on
ubuntu
DB<3> p $DBI::VERSION
1.609
DB<4> p $DBD::mysql::VERSION
4.012
DB<5> p $DBIx::Class::VERSION
0.08115
mysql Server version: 5.1.41-3ubuntu12.1-log (Ubuntu)
This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi
debian:
DB<3> p $DBI::VERSION
1.611
DB<5> p $DBD::mysql::VERSION
4.014
DB<6> p $DBIx::Class::VERSION
0.08123
mysql Server version: 5.1.47-1 (Debian)
This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi
log from ubuntu version
>> prepare_cached DISPATCH (DBI::db=HASH(0xa163eb0) rc1/5 @4 g0
imaa201 pid#25948) at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 2060 via at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 730
-> prepare_cached for DBD::mysql::db
(DBI::db=HASH(0xa163eb0)~0xa2712e8 'SELECT me.customer_id, me.company_id,
me.person_id, me.customer_position, me.instance_id FROM customer me WHERE (
me.customer_id IS NULL )' HASH(0xa276b48) 3) thr#8177008
>> prepare DISPATCH (DBI::db=HASH(0xa2712e8) rc1/8 @3 g0 imaa201
pid#25948) at /usr/local/lib/perl/5.10.1/DBI.pm line 1686 via at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 2060
1 -> prepare for DBD::mysql::db (DBI::db=HASH(0xa2712e8)~INNER 'SELECT
me.customer_id, me.company_id, me.person_id, me.customer_position,
me.instance_id FROM customer me WHERE ( me.customer_id IS NULL )'
HASH(0xa276b48)) thr#8177008
New 'DBI::st' (for DBD::mysql::st, parent=DBI::db=HASH(0xa2712e8),
id=undef)
dbih_setup_handle(DBI::st=HASH(0xa276d18)=>DBI::st=HASH(0xa276ce8),
DBD::mysql::st, a275588, Null!)
dbih_make_com(DBI::db=HASH(0xa2712e8), a272958, DBD::mysql::st, 252,
0) thr#8177008
dbih_setup_attrib(DBI::st=HASH(0xa276ce8), Err,
DBI::db=HASH(0xa2712e8)) SCALAR(0xa163f70) (already defined)
dbih_setup_attrib(DBI::st=HASH(0xa276ce8), State,
DBI::db=HASH(0xa2712e8)) SCALAR(0xa163f90) (already defined)
dbih_setup_attrib(DBI::st=HASH(0xa276ce8), Errstr,
DBI::db=HASH(0xa2712e8)) SCALAR(0xa163fa0) (already defined)
dbih_setup_attrib(DBI::st=HASH(0xa276ce8), TraceLevel,
DBI::db=HASH(0xa2712e8)) 0 (already defined)
dbih_setup_attrib(DBI::st=HASH(0xa276ce8), FetchHashKeyName,
DBI::db=HASH(0xa2712e8)) 'NAME' (already defined)
dbih_setup_attrib(DBI::st=HASH(0xa276ce8), HandleSetErr,
DBI::db=HASH(0xa2712e8)) undef (not defined)
dbih_setup_attrib(DBI::st=HASH(0xa276ce8), HandleError,
DBI::db=HASH(0xa2712e8)) CODE(0xa271448) (already defined)
dbih_setup_attrib(DBI::st=HASH(0xa276ce8), ReadOnly,
DBI::db=HASH(0xa2712e8)) undef (not defined)
dbih_setup_attrib(DBI::st=HASH(0xa276ce8), Profile,
DBI::db=HASH(0xa2712e8)) undef (not defined)
-> dbd_st_prepare MYSQL_VERSION_ID 50145, SQL statement: SELECT
me.customer_id, me.company_id, me.person_id, me.customer_position,
me.instance_id FROM customer me WHERE ( me.customer_id IS NULL )
>- dbd_st_free_result_sets
<- dbd_st_free_result_sets RC -1
<- dbd_st_free_result_sets
>count_params statement SELECT me.customer_id, me.company_id,
me.person_id, me.customer_position, me.instance_id FROM customer me WHERE (
me.customer_id IS NULL )
<- dbd_st_prepare
1 <- prepare= DBI::st=HASH(0xa276d18) at
/usr/local/lib/perl/5.10.1/DBI.pm line 1686 via at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 2060
<- prepare_cached= DBI::st=HASH(0xa276d18) at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 2060 via at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 730
>> execute DISPATCH (DBI::st=HASH(0xa276d18) rc1/2 @1 g0 ima1041
pid#25948) at /usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line
1481 via at /usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line
738
-> execute for DBD::mysql::st (DBI::st=HASH(0xa276d18)~0xa276ce8)
thr#8177008
-> dbd_st_execute for 0a275478
>- dbd_st_free_result_sets
<- dbd_st_free_result_sets RC -1
<- dbd_st_free_result_sets
mysql_st_internal_execute MYSQL_VERSION_ID 50145
>parse_params statement SELECT me.customer_id, me.company_id,
me.person_id, me.customer_position, me.instance_id FROM customer me WHERE (
me.customer_id IS NULL )
<- dbd_st_execute returning imp_sth->row_num 1
<- execute= 1 at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 1481 via at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 738
>> fetchrow_array DISPATCH (DBI::st=HASH(0xa276d18) rc1/2 @1 g1 ima0
pid#25948) at /usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line
2034 via at /usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 74
-> fetchrow_array for DBD::mysql::st
(DBI::st=HASH(0xa276d18)~0xa276ce8) thr#8177008
-> dbd_st_fetch
dbd_st_fetch for 0a275478, chopblanks 0
dbd_st_fetch result set details
imp_sth->result=0a288088
mysql_num_fields=5
mysql_num_rows=1
mysql_affected_rows=1
dbd_st_fetch for 0a275478, currow= 1
dbih_setup_fbav alloc for 5 fields
dbih_setup_fbav now 5 fields
<- dbd_st_fetch, 5 cols
<- fetchrow_array= ( '37' '8' '4' 'f:8 os:4 i:3' '3' ) [5 items] row1
at /usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 2034 via at
/usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 74
>> fetchrow_array DISPATCH (DBI::st=HASH(0xa276d18) rc1/2 @1 g1 ima0
pid#25948) at /usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line
2035 via at /usr/local/share/perl/5.10.1/DBIx/Class/Storage/DBI.pm line 74
-> fetchrow_array for DBD::mysql::st
(DBI::st=HASH(0xa276d18)~0xa276ce8) thr#8177008
-> dbd_st_fetch
dbd_st_fetch for 0a275478, chopblanks 0
dbd_st_fetch result set details
imp_sth->result=0a288088
mysql_num_fields=5
mysql_num_rows=1
mysql_affected_rows=1
dbd_st_fetch for 0a275478, currow= 2
dbd_st_fetch, no more rows to fetch
--> dbd_st_finish
(...)
mysql>
| customer | CREATE TABLE `customer` (
`customer_id` int(11) NOT NULL AUTO_INCREMENT,
`company_id` int(11) NOT NULL,
`person_id` int(11) NOT NULL,
`customer_position` varchar(45) COLLATE utf8_polish_ci DEFAULT NULL,
`instance_id` int(11) NOT NULL,
PRIMARY KEY (`customer_id`),
KEY `fk_customer_1` (`company_id`),
KEY `fk_customer_2` (`person_id`),
KEY `fk_customer_3` (`instance_id`),
KEY `index5` (`customer_id`,`instance_id`),
CONSTRAINT `fk_customer_1` FOREIGN KEY (`company_id`) REFERENCES
`company` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_customer_2` FOREIGN KEY (`person_id`) REFERENCES `person`
(`person_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_customer_3` FOREIGN KEY (`instance_id`) REFERENCES
`instance` (`instance_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8
COLLATE=utf8_polish_ci
--
regards
piotr
--- End Message ---
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]