This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aleph (9)
- # announcements (6)
- # beginners (42)
- # calva (4)
- # cider (9)
- # clara (2)
- # clj-kondo (1)
- # cljdoc (108)
- # cljs-dev (10)
- # clojure (25)
- # clojure-brasil (1)
- # clojure-chicago (1)
- # clojure-europe (4)
- # clojure-italy (42)
- # clojure-nl (14)
- # clojure-uk (66)
- # clojurebridge (3)
- # clojurescript (23)
- # clojutre (2)
- # community-development (1)
- # cursive (2)
- # datomic (4)
- # figwheel-main (21)
- # fulcro (23)
- # jobs-discuss (1)
- # kaocha (1)
- # off-topic (10)
- # pedestal (4)
- # reitit (2)
- # shadow-cljs (41)
- # spacemacs (7)
- # sql (20)
- # xtdb (3)
in Honeysql is there a way to explicitly declare a variable as a varchar instead of nvarchar?
@dbernal Not sure what you're asking... The JDBC driver is where the type handling is, not HoneySQL.
I think just specifying the variable as varchar worked. So making sure that the string that I was passing into HoneySQL had "foo AS VARCHAR(40)" attached
oh, nvm. What I said didn't work. What you said is correct. I need to specify it at the driver level. Is there a way to do it with the clojure.java.jdbc driver?
@dbernal The driver will "do the right thing". Can you explain why you think you need to tell the driver to do something different for some particular column?
If the DB column is nvarchar, the value should be inserted/updated as that type of value automatically.
clojure.java.jdbc is not a "driver" by the way, it is a wrapper for whatever JDBC driver you are using.
my query is declaring an nvarchar when the underlying DB value is varchar which is creating some performance issues when doing the conversion. So I need to ensure that the input variables into my query are declared as varchar
If I understand correctly what you're saying the driver should understand that the column is varchar and therefore declares the variable as varchar?
@dbernal I'm not sure what you mean by "my query is declaring an nvarchar" -- queries don't "declare" types...
next.jdbc don't do anything with types -- they just pass everything through to the driver (as
Object, essentially) and leave it up to the driver to perform any coercion necessary.
so something like this
I think the JTDS driver is taking one of the strings I'm sending as input and converting it into an NVARCHAR when I need it to be a VARCHAR. I realize now that the jdbc wrappers don't do anything with types. I think the issue I'm having now is with the driver
DECLARE @P0 BIGINT, @P1 BIGINT, @P53 NVARCHAR(4000), -- VARCHAR @P54 BIGINT, @P55 BIGINT, @P56 BIGINT, @P57 BIGINT, @P58 NVARCHAR(4000), -- VARCHAR @P59 BIGINT, @P60 NVARCHAR(4000), -- VARCHAR @P61 NVARCHAR(4000), -- VARCHAR @P62 NVARCHAR(4000), -- VARCHAR @P63 NVARCHAR(4000), -- VARCHAR @P64 BIGINT, @P65 BIGINT
@dbernal Is that SQL something to do with stored procedures? I've never used
Interesting... Have you tried the official MS driver, just to see if the behavior is the same?