in reply to MySQL pattern matching

This is way off-topic for this, but I can see two things wrong. First off, you aren't actually returning any records.

You may want to use this...
my $csr = $dbh->sqlSelectMany("*", "company_contact_info", "region='S +an Diego'"); while(my $row = $csr->fetchrow_hashref()) { #row is now a single returned row that matched your query; }
As well, your SQL regular expression is also wrong. When doing regular expressions in SQL, you want to use LIKE (for mySQL and SQL Server I believe at least)
SELECT * FROM company_contact_info WHERE REGION LIKE "%San Diego%"
Without LIKE, it won't interpret the string as a regular expression, and thus will be searching for "\%San Diego\%"

This begs another question. Why are you storing items in your database as strings. If they are raw address fields, then there's no good way to do it (unless you parse the results as you receive them and store a string independant region key, but that depends on the application in which you are calling this database.) Indexes and numerical keys can be quite helpful and much faster.

Hope this helps.    --jay

Replies are listed 'Best First'.
Re: Re: MySQL pattern matching
by cdherold (Monk) on Feb 24, 2002 at 19:42 UTC
    Jay, That did help. Turns out all i needed was to use LIKE.

    to answer your question ... I'm only storing addresses as strings. I needed to go and find key words in the address and based on this assign the row a 'region' identifier. 'LIKE %keyword%' worked exactly as i needed. for my simplictic projects this seems to work right now. the other stuff you're talking about i've heard and seen mentioned, but haven't really gotten into. still just feeling my way around this area. hopefully i'll grow into more advanced and efficient structures as i use it and learn more. but for now, just trying to get along. thanks.