close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 21 years ago

Closed 18 years ago

#49 closed enhancement (later)

LIKE function

Reported by: Víctor de Buen Remiro Owned by: Víctor de Buen Remiro
Priority: normal Milestone:
Component: Text Version: head
Severity: minor Keywords:
Cc: fdelamuela

Description

Hello

I think that some implementation of a text comparison function of the style of SQL
function LIKE should be a useful feature in TOL. I don't know if exist an standard
description of the behaviour of LIKE, or each SQL has a different prototype, but
I'm sure most analysts around the world are familiar with it. Inside BText class
there is a member function Match that should be used for this purpose.

Change History (4)

comment:1 Changed 21 years ago by danirus

Status: newassigned

comment:2 Changed 18 years ago by Víctor de Buen Remiro

Cc: fdelamuela added

* Bug 297 has been marked as a duplicate of this bug. *

comment:3 Changed 18 years ago by Víctor de Buen Remiro

Owner: changed from danirus to Víctor de Buen Remiro
Status: assignednew

comment:4 Changed 18 years ago by Víctor de Buen Remiro

Resolution: later
Status: newclosed

I propose a temporary solution available when a database is open.

Real SqlLike(Text txt, Text pattern)
{

Text qry = "select '"+txt+"' LIKE '"+pattern+"' from dual";

WriteLn(qry);

Set s = DBTable(qry);
If(Card(s)!=1,?,s[1][1])

};
PutDescription(I2(
"Calls to the currently open database LIKE function.",
"Llama a la función LIKE de la base de datos abierta."),SqlLike);

Real SqlLike("farola","%o%a");

With a AMD64 with local MySQL server the total time for 10000 iterations of SqlLike calls was 3.328 seconds. Calling TextMatch total 1000 times ends in 0.578 seconds.

A better solution needs to link to something regular expression library as Boost or perl-regexp that is a very hard work.

Note: See TracTickets for help on using tickets.