Hello all -

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");
+        }
     }
 }

This knocks out 5 more tests, I think. I may write some more just to
make sure we're hitting as many cases as we can.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to