473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Capital letters causing problems =[

Hi guys just wandering if I could get a little help! , I have wrote a Perl script to sort out some data in my database, I am saving into an sql file but having a few problems executing the sql because of capital letters.

I have been given a list of 'From' and 'To' names, as there are multiple entries in my DB eg. Fred Bloggs, Bloggs Fred, F Bloggs are all the same person but I have organised the list like so.

Bloggs Fred, Fred Bloggs
F Bloggs, Fred Bloggs
Fred Bloggs, Fred Bloggs

So values on the left are 'From' and values on the right are 'To'.

heres my code:

Expand|Select|Wrap|Line Numbers
  1. #!perl.exe
  2. # script to CLEAN the AX4GANGS table
  3. # If values of FROM and TO are the same then ignore!
  4. # If values of FROM and TO are different INSERT 'To Names' to AX4GANGS table.
  5. # Delete values of FROM, from AX4GANGS table
  6. #
  7. # Jonny Carter
  8. #
  9. #
  10.  
  11. BEGIN
  12. {
  13.     ( $SCRIPTNAME=$0 )=~s/^.*\\//g;
  14.     $SCRIPTNAME=~s/^.*\\//g;
  15.  
  16.     #get the pm libfiles
  17.     push( @INC, "../pm" );
  18. }
  19.  
  20. use CGI;
  21. use DBI;
  22. use DBNAME;
  23. use LOG;
  24. use Time::Local;
  25.  
  26. $dbh=DBI->connect("dbi:mysql:host=$DB_host:dbname=$database",$DB_user,$DB_pass)
  27.     or die "could not conect to database $database";
  28.  
  29. %allaudited=( getsqllist( "select distinct AUDITED, '1' from AX4GANGS " ) );
  30. $n=keys(%allaudited);
  31.  
  32.  
  33. open FILE, "ax4audit.csv" or die  $!;
  34.  
  35. while( $line=<FILE> )
  36. {
  37.     chomp $line;
  38.   ($count,$company,$from,$to) = split( ',', $line );
  39.  
  40.   # AX4GANGS INSERTS and DELETES
  41.  
  42.  
  43.       ( $from eq $to ) && next;
  44.  
  45.     if ( ! $allaudited{$to} )
  46.     {
  47.         print "INSERT INTO AX4GANGS VALUES (NULL,'$company','$to',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'jonnyc',NULL);\n";
  48.         $allaudited{$to}="1";
  49.  
  50.     }
  51.     print "DELETE from AX4GANGS where AUDITED='$from';\n";
  52.  
  53.  
  54.   # AUDITS Table UPDATES
  55.  
  56.     print "UPDATE AUDITS set AUDITED ='$to' where AUDITED='$from';\n";
  57. }
  58.  
  59. close ( FILE );
  60. exit;
  61.  

Heres an example of what is happening:

I have a value of JONny Carter and a value of Jonny Carter.

for some reason when I then run the sql file I get both inserted into the table.

I hope I have explained this well enough ... Any help is really appreciated.
Nov 20 '08 #1
1 2319
Ah I sorted it now !! but thanks any way!

It was my error, I put JONny into my .csv file in the 'To' column ...All is working fine now!
Nov 20 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jeff | last post by:
Hi, I am trying to insert a space before all capital letters in a string except the first occurrence. For example: FirstSecondThird would become First Second Third Is there a regular...
4
by: Carlos Marangon | last post by:
Hello! People go to sign my guestbook and wrote all text in capital letters. Did you know any script that shows an window alert when one types the second capital letter? Best regards,
1
by: thomaz | last post by:
How I can place in capital letters the text of a COMBOBOX? For TEXTBOX I use: textBox1.CharacterCasing = CharacterCasing.Upper;... How to make the same for a COMBOBOX? There isnt a...
8
by: Peter Afonin | last post by:
Hello, I've created the domain registration system in ASP.NET. I'm using HttpWebRequest to post the data to the registrar's server. So in the Post string I'm passing the data like name, address,...
3
by: Bertha94 | last post by:
I am trying to set certain cells to capitalize any input whethere they have the caps lock on or not. I have toyed with "Private Sub Workbook_SheetChange" to turn all changes into an object with...
0
by: wbosw | last post by:
I'm trying to create a regex to find more than one capital letter position within a word. The below regex, finds the first capital letter in the word and returns the index for that character. I...
2
by: inferi9 | last post by:
hi, I am writng a program that takes a string and it must output if it is a palindrome, A palindrome is a string that is spelled and read the same way forward and backward, it workes fine with...
5
Presto731
by: Presto731 | last post by:
HOW do i make the letters in various fields on a form always be capital no matter if they used capital letters or not when typing?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.