Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Perl by Hugo Urquiza ( 15 years ago )
Line
1 #!/usr/bin/perl
2
3 #
4 #FILE
5 # ticket19.pl
6 #PURPOSE
7 # See ticket #19 :P
8 #AUTHOR
9 # (C) 2011 Hugo Urquiza for Airnetworks.
10 #
11
12 use DBI;
13
14 my $dsn = 'DBI:mysql:stf:localhost';
15 my $db_user_name = 'stf';
16 my $db_password = 'wsxedc';
17 my ($id, $password);
18 my $dbh = DBI->connect($dsn, $db_user_name, $db_password);
19
20 my $sth = $dbh->prepare("SELECT uId,cName FROM tCustomerBak");
21 $sth->execute();
22 while (my ($uId,$cName)=$sth->fetchrow_array())
23 {
24 $cName=~s/MR.//g;
25 $cName=~s/MRS.//g;
26 $cName=~s/\.//g;
27 $cName=~s/^\s+//;
28 $cName=~s/\s+$//;
29 my($cFirstName,$cLastName,$cLastName2)=split(/ /,$cName);
30 #debug only
31 #print("cFirstName=$cFirstName\n");
32 #print("cLastName=[$cLastName] [$cLastName2]\n");
33 if(length($cLastName)>1)
34 {
35 $cLastName=$dbh->quote("$cLastName $cLastName2");
36 }
37 else
38 {
39 $cLastName=$dbh->quote($cLastName2);
40 }
41 my $q="UPDATE tCustomer SET cFirstName='$cFirstName',cLastName=$cLastName WHERE uId=$uId";
42 my $update=$dbh->do($q) or die($q);
Revise this Paste
Children: 37169