Nuta
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować się zalogować lub zmienić katalog.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Na tej stronie przedstawiono, które elementy członkowskie platformy .NET są tłumaczone na funkcje SQL podczas korzystania z dostawcy SQLite.
Funkcje agregujące
| .NET | SQL | Dodano element w |
|---|---|---|
| grupa. Average(x => x.Property) | AVG(Właściwość) | |
| grupa. Average(x => x.DecimalProperty) | ef_avg(DecimalProperty) | EF Core 9.0 |
| grupa. Count() | COUNT(*) | |
| grupa. LongCount() | COUNT(*) | |
| grupa. Max(x => x.Property) | MAX(Właściwość) | |
| grupa. Min(x => x.Property) | MIN(Właściwość) | |
| grupa. Sum(x => x.Property) | SUM(Właściwość) | |
| grupa. Sum(x => x.DecimalProperty) | ef_sum(DecimalProperty) | EF Core 9.0 |
| struna. Concat(grupa. Select(x => x.Property)) | group_concat(Właściwość, '') | |
| struna. Join(separator, grupa. Select(x => x.Property)) | group_concat(Właściwość, @separator) |
Funkcje binarne
| .NET | SQL | Dodano element w |
|---|---|---|
| Bajtów. Contains(value) | instr(@bytes, char(@value)) > 0 | |
| Bajtów. Długość | length(@bytes) | |
| Bajtów. SequenceEqual(sekunda) | @bytes = @second | |
| EF. Functions.Hex(bajty) | szesnastkowy (@bytes) | |
| EF. Functions.Substr(bajty, startIndex) | substr(@bytes, @startIndex) | |
| EF. Functions.Substr(bajty, startIndex, długość) | substr(@bytes, @startIndex, @length) | |
| EF. Functions.Unhex(wartość) | unhex(@value) | |
| EF. Functions.Unhex(value, ignoreChars) | unhex(@value, @ignoreChars) |
Funkcje konwersji
| .NET | SQL |
|---|---|
| boolValue.ToString() | CAST(@boolValue AS TEXT) |
| byteValue.ToString() | CAST(@byteValue JAKO TEKST) |
| Bajtów. ToString() | CAST(@bytes AS TEXT) |
| charValue.ToString() | CAST(@charValue AS TEXT) |
| dateTime.ToString() | CAST(@dateTime AS TEXT) |
| dateTimeOffset.ToString() | CAST(@dateTimeOffset AS TEXT) |
| decimalValue.ToString() | CAST(@decimalValue AS TEXT) |
| doubleValue.ToString() | CAST(@doubleValue JAKO TEKST) |
| floatValue.ToString() | CAST(@floatValue AS TEXT) |
| guid. ToString() | CAST(@guid AS TEXT) |
| intValue.ToString() | CAST(@intValue AS TEXT) |
| longValue.ToString() | CAST(@longValue AS TEXT) |
| sbyteValue.ToString() | CAST(@sbyteValue AS TEXT) |
| shortValue.ToString() | CAST(@shortValue AS TEXT) |
| timeSpan.ToString() | CAST(@timeSpan AS TEXT) |
| uintValue.ToString() | CAST(@uintValue AS TEXT) |
| ushortValue.ToString() | CAST(@ushortValue AS TEXT) |
Funkcje daty i godziny
| .NET | SQL | Dodano element w |
|---|---|---|
| dateOnly.AddDays(wartość) | date(@dateOnly, @value || ' dni') | |
| dateOnly.AddMonths(miesiące) | date(@dateOnly, @months || " months" (miesiące) | |
| dateOnly.AddYears(wartość) | date(@dateOnly, @value || " lata") | |
| dateOnly.Day | strftime("%d", @dateOnly) | |
| dateOnly.DayOfWeek | strftime("%w', @dateOnly) | |
| dateOnly.DayOfYear | strftime("%j', @dateOnly) | |
| DateOnly.FromDateTime(dateTime) | date(@dateTime) | |
| dateOnly.Month | strftime("%m', @dateOnly) | |
| dateOnly.Year | strftime("%Y', @dateOnly) | |
| dateOnly.DayNumber | CAST(julianday(@dateOnly) — julianday('0001-01-01') AS INTEGER) | EF Core 10.0 |
| DateTime.Now | datetime('now', 'localtime') | |
| DateTime.Today | datetime('now', 'localtime', 'start of day') | |
| DateTime.UtcNow | datetime('now') | |
| dateTime.AddDays(wartość) | datetime(@dateTime, @value || ' dni') | |
| dateTime.AddHours(wartość) | datetime(@dateTime, @d || " godziny") | |
| dateTime.AddMilliseconds(wartość) | datetime(@dateTime, (@value / 1000.0) || " sekundy") | |
| dateTime.AddMinutes(wartość) | datetime(@dateTime, @value || ' min') | |
| dateTime.AddMonths(miesiące) | datetime(@dateTime, @months || " months" (miesiące) | |
| dateTime.AddSeconds(wartość) | datetime(@dateTime, @value || " sekundy") | |
| dateTime.AddTicks(wartość) | datetime(@dateTime, (@value / 100000000.0) || " sekundy") | |
| dateTime.AddYears(value) | datetime(@dateTime, @value || " lata") | |
| dateTime.Date | datetime(@dateTime, "początek dnia") | |
| dateTime.Day | strftime("%d", @dateTime) | |
| dateTime.DayOfWeek | strftime("%w', @dateTime) | |
| dateTime.DayOfYear | strftime("%j', @dateTime) | |
| dateTime.Hour | strftime("%H', @dateTime) | |
| dateTime.Millisecond | (strftime('%f', @dateTime) * 1000) % 1000 | |
| dateTime.Minute | strftime("%M', @dateTime) | |
| dateTime.Month | strftime("%m', @dateTime) | |
| dateTime.Second | strftime("%S", @dateTime) | |
| dateTime.Ticks | (julianday(@dateTime) - julianday('0001-01-01 00:00:00')) * 86400000000000 | |
| dateTime.TimeOfDay | time(@dateTime) | |
| dateTime.Year | strftime("%Y', @dateTime) |
Uwaga
Niektóre bazy danych SQL zostały uproszczone w celach ilustracyjnych. Rzeczywisty język SQL jest bardziej złożony do obsługi szerszego zakresu wartości.
Funkcje liczbowe
| .NET | SQL | Dodano element w |
|---|---|---|
| -decimalValue | ef_negate(@decimalValue) | |
| decimalValue — d | ef_add(@decimalValue, ef_negate(@d)) | |
| decimalValue * d | ef_multiply(@decimalValue, @d) | |
| decimalValue /d | ef_divide(@decimalValue, @d) | |
| liczba dziesiętna % d | ef_mod(@decimalValue, @d) | |
| decimalValue + d | ef_add(@decimalValue, @d) | |
| decimalValue < d | ef_compare(@decimalValue, @d)< 0 | |
| decimalValue <= d | ef_compare(@decimalValue, @d)<= 0 | |
| decimalValue > d | ef_compare(@decimalValue, @d)> 0 | |
| decimalValue >= d | ef_compare(@decimalValue, @d)>= 0 | |
| podwójny. DegreesToRadians (stopnie) | radiany (@degrees) | |
| podwójny. RadianyToDegrees (radiany) | stopnie (@dradians) | |
| doubleValue % d | mod(@doubleValue, @d) | |
| EF. Functions.Random() | abs(random() / 9223372036854780000.0) | |
| Math.Abs(wartość) | abs(@value) | |
| Math.Acos(wartość) | acos(@value) | |
| Math.Acosh(d) | acosh(@d) | |
| Math.Asin(d) | asin(@d) | |
| Math.Asinh(d) | asinh(@d) | |
| Math.Atan(d) | atan(@d) | |
| Math.Atan2(y, x) | atan2(@y, @x) | |
| Math.Atanh(d) | atanh(@d) | |
| Math.Ceiling(d) | sufit (@d) | |
| Math.Cos(d) | cos(@d) | |
| Math.Cosh(wartość) | cosh(@value) | |
| Math.Exp(d) | exp(@d) | |
| Math.Floor(d) | floor(@d) | |
| Math.Log(d) | ln(@d) | EF Core 8.0 |
| Math.Log(a, newBase) | log(@newBase, @a) | EF Core 8.0 |
| Math.Log2(x) | log2(@x) | EF Core 8.0 |
| Math.Log10(d) | log10(@d) | EF Core 8.0 |
| Math.Max(val1, val2) | max(@val1, @val2) | |
| Math.Min(val1, val2) | min(@val1, @val2) | |
| Math.Pow(x, y) | pow(@x, @y) | EF Core 8.0 |
| Math.Round(d) | round(@d) | |
| Math.Round(d, cyfry) | zaokrąglij(@d, @digits) | |
| Math.Sign(d) | sign(@d) | EF Core 8.0 |
| Math.Sin(a) | sin(@a) | EF Core 8.0 |
| Math.Sinh(wartość) | sinh(@value) | EF Core 8.0 |
| Math.Sqrt(d) | sqrt(@d) | EF Core 8.0 |
| Math.Tan(a) | tan(@a) | EF Core 8.0 |
| Math.Tanh(wartość) | tanh(@value) | EF Core 8.0 |
| Math.Truncate(d) | obcinanie (@d) | EF Core 8.0 |
Napiwek
Oprócz metod wymienionych tutaj, ogólne matematyczne implementacje i metody odpowiadające MathF są tłumaczone również. Na przykład , Math.Sin, MathF.Sindouble.Sini float.Sin wszystkie mapuj sin na funkcję w języku SQL.
Napiwek
Funkcje SQL poprzedzone ef_ są tworzone przez program EF Core.
Funkcje ciągów
| .NET | SQL |
|---|---|
| Char. ToLower(c) | lower(@c) |
| Char. ToUpper(c) | upper(@c) |
| EF. Functions.Collate(operand, sortowanie) | @operand COLLATE @collation |
| EF. Functions.Glob(matchExpression, pattern) | @matchExpression GLOB @pattern |
| EF. Functions.Like(matchExpression, pattern) | @matchExpression LUBIĆ @pattern |
| EF. Functions.Like(matchExpression, pattern, escapeCharacter) | @matchExpression JAK @pattern UCIECZKA @escapeCharacter |
| Regex.IsMatch(input, pattern) | @input REGEXP @pattern |
| struna. Compare(strA, strB) | PRZYPADEK, GDY @strA = @strB WTEDY 0 ... KONIEC |
| struna. Concat(str0, str1) | @str0 || @str1 |
| struna. IsNullOrEmpty(wartość) | @value MA WARTOŚĆ NULL LUB @value = "" |
| struna. IsNullOrWhiteSpace(wartość) | @value IS NULL LUB trim(@value) = '' |
| stringValue.CompareTo(strB) | PRZYPADEK, GDY @stringValue = @strB WTEDY 0 ... KONIEC |
| stringValue.Contains(wartość) | instr(@stringValue, @value)> 0 |
| stringValue.EndsWith(wartość) | @stringValue LIKE '%' || @value |
| stringValue.FirstOrDefault() | substr(@stringValue, 1, 1) |
| stringValue.IndexOf(wartość) | instr(@stringValue, @value) - 1 |
| stringValue.LastOrDefault() | substr(@stringValue, length(@stringValue), 1) |
| stringValue.Length | length(@stringValue) |
| stringValue.Replace(oldValue, newValue) | replace(@stringValue, @oldValue, @newValue) |
| stringValue.StartsWith(wartość) | @stringValue LIKE @value || '%' |
| stringValue.Substring(startIndex) | substr(@stringValue, @startIndex + 1) |
| stringValue.Substring(startIndex, length) | substr(@stringValue, @startIndex + 1, @length) |
| stringValue.ToLower() | lower(@stringValue) |
| stringValue.ToUpper() | upper(@stringValue) |
| stringValue.Trim() | trim(@stringValue) |
| stringValue.Trim(trimChar) | trim(@stringValue, @trimChar) |
| stringValue.TrimEnd() | rtrim(@stringValue) |
| stringValue.TrimEnd(trimChar) | rtrim(@stringValue, @trimChar) |
| stringValue.TrimStart() | ltrim(@stringValue) |
| stringValue.TrimStart(trimChar) | ltrim(@stringValue, @trimChar) |
Uwaga
Niektóre bazy danych SQL zostały uproszczone w celach ilustracyjnych. Rzeczywisty język SQL jest bardziej złożony do obsługi szerszego zakresu wartości.
Różne funkcje
| .NET | SQL |
|---|---|
| kolekcja. Contains(element) | @item W @collection |
| enumValue.HasFlag(flaga) | @enumValue & @flag = @flag |
| Nullable. GetValueOrDefault() | łączenie (@nullable, 0) |
| Nullable. GetValueOrDefault(defaultValue) | coalesce(@nullable, @defaultValue) |