Leser: 1
5 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/perl use strict; use warnings; use MySchema; use Data::Dumper; my $schema = MySchema->connect('DBI:SQLite:dbname=../../Testdb','',''); $schema->storage->debug(1); my @userroles = $schema->resultset('UserRole')->search->all; for my $userrole ( @userroles ){ print $userrole->UserID->Username, " .. ", $userrole->RoleID->Role, "\n"; if( $userrole->UserID->Username eq 'testperson' ){ $userrole->set_column( 'RoleID', 1 ); $userrole->update; } }
QuoteSELECT me.UserID, me.RoleID FROM Gefa_User_Role me:
SELECT me.UserID, me.Username, me.Passwort, me.Active, me.Locked, me.SessionID FROM Gefa_User me WHERE ( ( ( me.UserID = ? ) ) ): '1'
SELECT me.RoleID, me.Role FROM Gefa_Role me WHERE ( ( ( me.RoleID = ? ) ) ): '2'
Oberkellner .. Rolle2
SELECT me.UserID, me.Username, me.Passwort, me.Active, me.Locked, me.SessionID FROM Gefa_User me WHERE ( ( ( me.UserID = ? ) ) ): '2'
SELECT me.RoleID, me.Role FROM Gefa_Role me WHERE ( ( ( me.RoleID = ? ) ) ): '2'
testperson .. Rolle2
UPDATE Gefa_User_Role SET RoleID = ? WHERE ( RoleID = ? AND UserID = ? ): '1', '1', '2'
DBIx::Class::InflateColumn::update(): Can't update MySchema::UserRole=HASH(0x1f46f70): row not found at test.pl line 33
$userrole->update({ RoleID => 1 });
5 Einträge, 1 Seite |