This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Problem with mysql and wildcards

Help for those learning Tcl or writing their own scripts.
Post Reply
S
S0nnY
Voice
Posts: 8
Joined: Tue Sep 07, 2004 9:52 am
Location: Germany

Problem with mysql and wildcards

Post by S0nnY »

Hello,

I have a small problem. I want to create an "global ignore function" for a game script.
All my code works fine but i want to add hosts in the database containing a wildcard "*!*@Test*.org" for example.
But when the bots connects to the database an gets the informations the check the user host the * isn't a wildcard anymore also "test!test@Test.users.quakenet.org" is not matched.

How can I convert the sign * back to a wildcard ?

greetz
S0nnY
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

post code & log
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
S
S0nnY
Voice
Posts: 8
Joined: Tue Sep 07, 2004 9:52 am
Location: Germany

Post by S0nnY »

Ok here is a split of the ignore check code

$host ==> examp@example.users.quakenet.org

Code: Select all

  
  set ign(hosts) "[hosts:get]" <== returns all added hosts in the database ("examp@*.org"  "*@test.users.quakenet.org" for example)
  foreach h0st $ign(hosts) {
    if {[string match -nocase "$h0st" $host]} {
      return 1
    } else {
      return 0
    }
  }


proc hosts:get { } {
  global ign
  set sqlhand [mysqlconnect -host $ign(ip) -user $ign(user) -password $ign(pass)]
  mysqluse $sqlhand $ign(tab)
  set return "[mysqlsel $sqlhand "SELECT host FROM $ign(ignoredb)" -list]"
  mysqlclose $sqlhand
  return $return
}

the * is not recognized as wildcard
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

so what's the problem, you don't get *'s back from db? what did you put there and what did you get back using [hosts:get]?
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
S
S0nnY
Voice
Posts: 8
Joined: Tue Sep 07, 2004 9:52 am
Location: Germany

Post by S0nnY »

"[hosts:get]" <== returns all added hosts in the database ("examp@*.org" "*@test.users.quakenet.org"
a * which is returned from the mysqdatabase is "marked" as "normal" sign and not as wildcard. this is my problem
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

mysql use % as wildcard, not *
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

what do you care about mySQL's interpretation of *? you don't have WHERE clause anyway

if *'s come back to you as you saved them, I fail to see the problem here
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
Post Reply