radsectors/sqlshim

Problems querying fields of SQLTYPE_TEXT

Closed this issue · 3 comments

Quoting comment left on issue #3 by @dexterfichuk:

...problems querying tables that have a field with the datatype text. As soon as it reaches that field, it returns none of the following fields back. If I cast it in my query to a varchar though it fixes everything.
Ref: #3 (comment)

My questions:

  • Clarify: you're getting no error, you're simply not getting all of the fields back?
  • Have you tested the problem queries in a windows/sqlsrv environment? Or even in SSMS or Toad or something?
  • If no, do you have a way to do so?

Just wanna rule out sql server before I start looking at sqlshim.

thanks!

If the query is calling fields that are say for example INT, VARCHAR, BIGINT, then it runs fine. But if the query was on fields of INT, VARCHAR, TEXT,BIGINT, the fields INT, VARCHAR would return normal, but then TEXT, BIGINT will return null.

I ran the query with just mssql and had the same problem, and it also persisted on a PDO connection with the odbc driver. I then subbed the driver to be $conn = new \PDO ("dblib:host=$serverName:$port;dbname=$dbname","$username","$pw"); in the sqlshim.php and it wokred flawlessly! So for now I just am using this because it works, still not sure what the cause is. I'm currently in an Ubuntu environment.

Thanks for the feedback. The ability to specify different connection types has been in the back of my mind for a while because it would definitely provide more flexibility and surely a higher rate of success.

It's just a matter of figuring out a good way to implement it...

  • The biggest thing to figure out is how to handle the differences between to two types of connection string... the logic used to build that will have to be rewritten.
  • The other task is deciding on a clear and easy way to customize the connection type with the init options. I'm thinking a DSN prefix option.

I'll have to do some tinkering.

dblib update (95c5f8f) solved this issue.
thanks @dexterfichuk!