On Sep 14, 2008, at 8:07 AM, Pascal Craponne wrote: > Hi guys, > > Matthew, are you interested in joining the team? You could commit > your changes on your own.
I would be delighted to join the team and help out where I can. I've attached a diff of my changes regardless in case someone else wants to confirm the test passes before that. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
oracle_index_of_fixes.diff
Description: Binary data
>
> Pablo, Matthew, regarding the 0/1 start index, that's a good point,
> and we have two options:
> 1. give to each potentially problematic SQL generation method both
> values, the one where index starts at 0, the other where index
> starts at 1.
> 2. add some characteristics to the ISqlProvider, telling if string
> indexes start at 0 or 1, for example.
I would definitely say the second choice. An override string,
something like Option Base in Visual Basic :-)
>
> What's you favorite flavor?
>
> On Sun, Sep 14, 2008 at 11:56, Pablo Iñigo Blasco
> <[EMAIL PROTECTED]> wrote:
>
>
> 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.
>
>
>
>
>
>
> --
> Pascal.
>
> jabber/gtalk: [EMAIL PROTECTED]
> msn: [EMAIL PROTECTED]
>
>
> --~--~---------~--~----~------------~-------~--~----~
> This message is part of the topic "Oracle and a batch of fixed
> IndexOf*
> Tests" in the Google Group "DbLinq" for which you requested email
> updates.
> To stop receiving email updates for this topic, please visit the topic
> at http://groups.google.com/group/dblinq/t/b8c211c03d16d2db
> -~----------~----~----~----~------~----~------~--~---
>
