[Mono-list] How to fix StrLike bug in 2.4

Kornél Pál kornelpal at gmail.com
Mon Mar 22 16:36:07 EDT 2010


Hi,

StrLike implementation seems to be very inefficient and is also 
defective because does not escape characters that have special meaning 
in regular expressions that are used as the underlaying implementation.

I would suggest you to use regular expressions because those are more 
properly supported.

Kornél

Andrus wrote:
> Code below produes invalid result (False) in 2.4 and 2.6
> How to fix it so it runs properly in 2.4.2 ?
> 
> Andrus.
> 
> 
> using System;
> using System.IO;
> 
> class Program
> {
> 
>     static void Main()
>     {
>         string source = @"SELECT COALESCE(kartotee.Aj,0) AS Aj,
> kartotee.Doktyyp AS Doktyyp, COALESCE(kartotee.Dokumnr,0) AS Dokumnr,
> COALESCE(kartotee.Hind,0) AS Hind, COALESCE(rid.Inpdoktyyp,'') AS
> Inpdoktyyp,
> COALESCE(rid.Inpdokumnr,0) AS Inpdokumnr, COALESCE(kartotee.Kogpak,0) AS
> Kogpak, COALESCE(kartotee.Kogus,0) AS Kogus, kartotee.Kuupaev AS Kuupaev,
> COALESCE(kartotee.Partii,'') AS Partii, COALESCE(kartotee.Skaubasumm,0) AS
> Skaubasumm, COALESCE(kartotee.St,0) AS St, COALESCE(kartotee.Toode,'') AS
> Toode, COALESCE(kartotee.Vkaubasumm,0) AS Vkaubasumm,
> COALESCE(kartotee.Vm,0)
> AS Vm, COALESCE(kartotee.Yksus,'') AS Yksus, COALESCE(Artliik.Arttyyp,'') AS
> ArtliikArttyyp, COALESCE(Dok.Kellaaeg,'') AS DokKellaaeg, Dok.Kuupaev AS
> DokKuupaev, COALESCE(Dok.Raha,'') AS DokRaha, COALESCE(Toode.Jaehind,0) AS
> ToodeJaehind, COALESCE(Toode.Nimetus,'') AS ToodeNimetus,
> COALESCE(Toode.Yhik,'') AS ToodeYhik
> FROM ({0}) kartotee
> JOIN prpalk ON true
> JOIN toode ON kartotee.toode=toode.toode
> LEFT JOIN artliik USING(grupp,liik)
> LEFT JOIN rid ON rid.id=kartotee.id
> LEFT JOIN dok ON kartotee.dokumnr=dok.dokumnr
> LEFT JOIN klient ON dok.klient=klient.kood
> ";
> 
>         string pattern = @"SELECT*FROM ({0}) *";
> 
>         var res = Microsoft.VisualBasic.CompilerServices.StringType.StrLike(
>             source, pattern,
>             Microsoft.VisualBasic.CompareMethod.Text);
>         Console.WriteLine(res.ToString());
>         Console.ReadLine();
>     }
> }
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 


More information about the Mono-list mailing list