473,786 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capital letters causing problems =[

5 New Member
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 2332
minimatrix
5 New Member
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
11006
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 expression or short function that can do this?
4
10772
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
3140
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 CharacterCasing metod for a COMBOBOX...
8
2033
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, phone number etc. The only two fields that are causing problems are the phone and fax fields. My only guess here is that's because they start with the "+" sign. So the string looks like this:
3
3010
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 capital letters, but I am afraid if anyone ever removed the protection, that could be dangerous. I have also set the font on some of my worksheets to Perpetua Titling MT, which works well except that the font is a little funky. For some reason, on my...
0
2695
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 would like to find both capital letter positions in the word heLLo and return both positions. Does anyone have any suggestions. Thanks in advance, Wbos Public Function FindPosition(ByVal word As String) ' Create a new Regex object....
2
4001
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 one word but if there is spaces or capital lettersor commas it won't work I used getline but without any effect.here is the code. #include <iostream> #include <string> using namespace std; int main () {
5
16992
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
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9492
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10108
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9960
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.