On Sun, Sep 14, 2008 at 6:32 AM, Ardekantur <[EMAIL PROTECTED]>wrote:
>
> Hello all -
Hi Matthew!
>
>
> Puttering through some of the tests for Oracle and caught a fairly
> simple fix for a couple of tests. Where the default SQL provider users
> `STRPOS` for getting the right behavior from #IndexOf LINQ queries,
> Oracle has INSTR and SUBSTR.
>
> Thus:
>
> Index: src/DbLinq.Oracle/OracleSqlProvider.cs
> ===================================================================
> --- src/DbLinq.Oracle/OracleSqlProvider.cs (revision 876)
> +++ src/DbLinq.Oracle/OracleSqlProvider.cs (working copy)
> @@ -92,5 +92,28 @@
> @"SELECT * FROM ({3}{0}{3}) WHERE {2} > {1}",
> GetLiteralLimit(select, offsetAndLimit), offset,
> LimitedRownum, NewLine);
> }
> +
> + protected override string GetLiteralStringIndexOf(string
> baseString, string searchString, string startIndex, string count)
> + {
> + // SUBSTR(baseString, StartIndex)
> + string substring = GetLiteralSubString(baseString,
> startIndex, count);
> +
> + // INSTR(SUBSTR(baseString, StartIndex), searchString) ---
> > range 1:n , 0 => doesn't exist
> + return string.Format("INSTR({0},{1})", substring,
> searchString);
> + }
> +
> + protected override string GetLiteralStringIndexOf(string
> baseString, string searchString, string startIndex)
> + {
> + // SUBSTR(baseString,StartIndex)
> + string substring = GetLiteralSubString(baseString,
> startIndex);
> +
> + // INSTR(SUBSTR(baseString, StartIndex), searchString) ---
> > range 1:n , 0 => doesn't exist
> + return string.Format("INSTR({0},{1})", substring,
> searchString);
> + }
> +
> + protected override string GetLiteralStringIndexOf(string
> baseString, string searchString)
> + {
> + return GetLiteralSubtract(string.Format("INSTR({0},{1})",
> baseString, searchString), "1");
> + }
> }
> }
>
It seems to be fine. The main potential problem you should consider here is
the 'indexes start offset' difference between pl-sql and clr. Most of
sql-engine has as first array index = 1. In the other hand, clr and most of
programming languages has as first array index = 0. If you have considered
it, it shoud be ok.
> This knocks out 5 more tests, I think.
Great :-D
> I may write some more just to
> make sure we're hitting as many cases as we can.
That would be fantastic, they would be reused by others vendors too.
I have tried apply the patch over the Oracle folder, but it crashes, wich
revision are you using? could you send an attached .patch file?
Regards.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---