Closed rscx-r1 closed 5 months ago
Hm...sql text doesn't give us enough information to detect the type.
We might be able to add parameter annotations like @url:varchar(1500)
. Let me think about how we can do that without breaking existing code.
Looks great, but i need solve a problem today, did you have any ideas? project already based on your orm. =c
CONTAINS(url, CONVERT(varchar(1500), @url))
Incorrect syntax around the "CONVERT" keyword.
SELECT * FROM lines WHERE CONTAINS(url, CONVERT(varchar(1500), @url))
interesting. didn't know you can't use a function in the contains parameter list.
You might be able to declare a variable and convert with that:
DECLARE @u varchar(1500)
SELECT @u = @url
select * from url where CONTAINS (url, @u)
nah, that's not working too, Invalid object name "url".
i think @url:varchar(1500)
is the better idea, i solved it by temporarily by selfmade function but i will wait this update, and please add net7.0 support, thank you!
in v8.0.1 I added support for type tags in sqltext.
e.g.
[Sql("SELECT FROM lines WHERE CONTAINS(url, / TYPE: string(1500)" */ @url)")]
/* TYPE: type(size) */
before the parameter will set its typeDbType
. See: https://learn.microsoft.com/en-us/dotnet/api/system.data.dbtype?view=net-8.0I probably should have done this a while ago.
LMK how it works for you.
Hello, i have this code:
[Sql("SELECT * FROM lines WHERE CONTAINS(url, @url)")] Task<IList<LinesDB>> SelectLinesByUrl(string url);
With this code i cant use a CONTAINS predicate because Insight interpretes a nvarchar(MAX) automatically, how can i specify for example varchar(1500) (as in my database)?