Recent

Author Topic: TMSSQLConnection - sqlDB component for accessing MS SQL Server  (Read 140737 times)

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #165 on: April 16, 2012, 05:04:34 pm »
Just a FYI, I got the connector working great with the version of Lazarus that was released last month.   Works great, looking forward to it being included by default :-)
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

nomorelogic

  • Full Member
  • ***
  • Posts: 165
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #166 on: April 16, 2012, 08:17:28 pm »
I made some small changes to pasql.lpr to fix some problems I had testing it in Linux:
-
Code: [Select]
SetEnvironmentVariable is now compiled only in windows (as in other place in same source)
-
Code: [Select]
select ... from RDB$DATABASE doesn't work in MSSQL

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #167 on: April 17, 2012, 09:26:54 am »
Thanks a lot, logic!

I'm incorporating the changes. The TDSVER thing makes sense as AFAIU, you can't change environment variables in a running process on POSIX systems..
Some questions:
- why did you disable odbcconn? Isn't that available on Linux or just not on your system?
- I noticed you updated a test query I wrote for Firebird; good fix you gave but instead of accepting your code I just removed it (it was meant to demonstrate something)...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

nomorelogic

  • Full Member
  • ***
  • Posts: 165
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #168 on: April 17, 2012, 10:08:10 am »
I'm incorporating the changes. The TDSVER thing makes sense as AFAIU, you can't change environment variables in a running process on POSIX systems..
I think you're rigth

- why did you disable odbcconn? Isn't that available on Linux or just not on your system?
not for unavaiability, simply to test without this unit
I did not understand the presence, then I forgot to uncomment :P

I made some test with MsSql syntax (ie: exec stored proc that return a recordset) and all goes well.
Really good work

mdbs99

  • Full Member
  • ***
  • Posts: 121
  • Software Engineer. Husband. Trader.
    • website
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #169 on: August 08, 2012, 03:55:36 am »
Hi,

Guys, do you have some update about the TMSSQLConnection class and, more important, about the libiconv2.dll and dblib.dll updates?

Thanks.

Lacak2

  • Guest
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #170 on: August 08, 2012, 07:31:29 am »
- TMSSQLConnection class is now part of FCL sqlDB, so all updates goes into SVN

- dblib.dll is compiled from FreeTDS db-lib . Latest stable release is 0.91 and precompiled DLL you can find:
ftp://ftp.freepascal.org/fpc/contrib/windows/

- libiconv2.dll is 3rd party so updates you can check f.e. at:
http://gnuwin32.sourceforge.net/packages/libiconv.htm

mdbs99

  • Full Member
  • ***
  • Posts: 121
  • Software Engineer. Husband. Trader.
    • website
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #171 on: August 08, 2012, 02:10:54 pm »
Hi Lacak, some time...

Well, yesterday I was back to a project (in production) that uses TMSSQLConnection to update some things so, I remember I use the same dblib.dll that you sent me a long time ago.
You said, If I remember well, that you compiled the dblib.dll yourself and had to change something...

- TMSSQLConnection class is now part of FCL sqlDB, so all updates goes into SVN
Yeah, I know. I use FPC 2.6.1 and I got the updates but I ask to know about new features or problems...
Yesterday I was very happy when the autoinc worked perfectly using SQLdb and mssql, very good!

Quote
- dblib.dll is compiled from FreeTDS db-lib . Latest stable release is 0.91 and precompiled DLL you can find:
ftp://ftp.freepascal.org/fpc/contrib/windows/
Hm... I did not know about this link. I will update the dblib.dll. Thanks!

Quote
- libiconv2.dll is 3rd party so updates you can check f.e. at:
http://gnuwin32.sourceforge.net/packages/libiconv.htm
I can update any time or depends the version of dblib.dll?

Best regards.

Lacak2

  • Guest
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #172 on: August 08, 2012, 03:00:08 pm »
You said, If I remember well, that you compiled the dblib.dll yourself and had to change something...
AFAIR all my private changes was also applied later into FreeTDS project sources, so you can now compile direct FreeTDS without need of any special customization

Yeah, I know. I use FPC 2.6.1 and I got the updates but I ask to know about new features or problems...
I am not aware of any new problems and also AFAIK no new features were added ...

Quote
- libiconv2.dll is 3rd party so updates you can check f.e. at:
http://gnuwin32.sourceforge.net/packages/libiconv.htm
I can update any time or depends the version of dblib.dll?
here I am not sure ... it depends ... FreeTDS db-lib is compiled using libiconv - iconv.h, libiconv.lib which exports some functions. When signatures of these function do not change, then I would say, that you can upgrade libiconv2.dll without need to recompile dblib.dll

mdbs99

  • Full Member
  • ***
  • Posts: 121
  • Software Engineer. Husband. Trader.
    • website
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #173 on: August 08, 2012, 03:36:39 pm »
AFAIR all my private changes was also applied later into FreeTDS project sources, so you can now compile direct FreeTDS without need of any special customization
That is amazing, I did not know, congratulations!

I am not aware of any new problems and also AFAIK no new features were added ...
OK

here I am not sure ... it depends ... FreeTDS db-lib is compiled using libiconv - iconv.h, libiconv.lib which exports some functions. When signatures of these function do not change, then I would say, that you can upgrade libiconv2.dll without need to recompile dblib.dll
Any way, I saw that you put the libiconv in the same zip, on the FTP link so, no problems.

But I saw that exists a dblib_x64.zip too. The TMSSQLConnection already working on 64bit too?
Why the zip file do not contain the libiconv?

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #174 on: August 08, 2012, 04:56:09 pm »
Quote
But I saw that exists a dblib_x64.zip too. The TMSSQLConnection already working on 64bit too?
Yes.
Quote
Why the zip file do not contain the libiconv?
Seems very difficult to find. I'm trying to build one with VS2010.

mdbs99

  • Full Member
  • ***
  • Posts: 121
  • Software Engineer. Husband. Trader.
    • website
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #175 on: August 08, 2012, 05:12:40 pm »
Quote
But I saw that exists a dblib_x64.zip too. The TMSSQLConnection already working on 64bit too?
Yes.
Quote
Why the zip file do not contain the libiconv?
Seems very difficult to find. I'm trying to build one with VS2010.
Ok Ludo!
Please, tell us if you can (here and/or on the list).

Lacak2

  • Guest
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #176 on: August 09, 2012, 07:36:36 am »
Why the zip file do not contain the libiconv?
As Ludo mentioned, I was not able find libiconv for Win64. For Win32 there is http://gnuwin32.sourceforge.net/packages/libiconv.htm. For Win64 there exists http://sourceforge.net/projects/gnuwin64/ but no files are there published ATM.

So if Ludo will compile own libiconv from sources then also db-lib can be recompiled and updated in ftp://ftp.freepascal.org/fpc/contrib/windows/
(then I would recommend put Win32 and 64 versions into one ZIP with 2 directories Win32 and Win64)

mdbs99

  • Full Member
  • ***
  • Posts: 121
  • Software Engineer. Husband. Trader.
    • website
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #177 on: August 09, 2012, 02:14:34 pm »
Ok Lacak, very good.
Thanks for the info.

mdbs99

  • Full Member
  • ***
  • Posts: 121
  • Software Engineer. Husband. Trader.
    • website
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #178 on: August 10, 2012, 03:25:11 am »
Hi,

Imagine this query:
declare @id int
update f set @id = f.id from foo f

How I can get the @id parameter using SQLdb?
If I use q.Open (adding select @id as id) I got an exception. If I use q.ExecSQL I do not access to the parameter.

Thanks.

Lacak2

  • Guest
Re: TMSSQLConnection - sqlDB component for accessing MS SQL Server
« Reply #179 on: August 10, 2012, 07:41:14 am »
Which exception ? "Cannot open non-select statement"?

Problem is in fact that batch SQL statements parsing is not supported. So if you set SQL.Text to something like:
'declare @id int; select @id=f.ident_field from pokus1 f; select @id;'
(multiple SQL statements)

Then SQLParse does not describe this statement type as stSelect and when you try open such statement you will get above mentioned exception.

So ATM I do not know how to help you  :(
... Only put your statements into stored procedure and use EXEC ...

 

TinyPortal © 2005-2018