clueboy / pymssql_issues

0 stars 0 forks source link

[PATCH] freetds library linked against libiconv for windows #54

Open clueboy opened 11 years ago

clueboy commented 11 years ago

From marunguy on May 24, 2011 04:20:11

What steps will reproduce the problem? 1. To refer issue 48 and issue50 , build pymssql for windows.

  1. try to connect mssql server as below script. import pymssql conn = pymssql.connect(server="192.168.123.xxx", user="id", password="pw", database="db", charset="cp949") cur = conn.cursor() cur.execute("select * from mytable") for row in cur: print row What is the expected output? What do you see instead? It is expected that contents of table is printed. But, Python crash occurred.

Or, strings as CP949 encoding ( except ascii and unicode encoding ) is not printed correctly.

So, I compile freetds library linked against iconv library. And, freetds and iconv library is compiled as static library. So, pymssql module don't need freetds and iconv dll. What version of the product are you using? On what operating system? pymssql revision 678b5603ff53 Cython 0.14.1 Python 2.6.6 libiconv-1.13.1 freetds-0.91.dev.20110523RC2 msys tdm-gcc 4.5.2 Windows 7 SP1 Please provide any additional information below. Below is pymssql's build order using static freetds and iconv library.

  1. download and extract the libiconv-1.13.1 from http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz 2. download and extract the freetds-0.91rc from http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-0.91rc.tgz 3. download and install msys from www.mingw.org
  2. download and install tdm-gcc 4.5.2 from http://tdm-gcc.tdragon.net/download 5. clone pymssql source.
  3. run the msys shell
  4. $ export PATH=/c/devtool/mingw_tdm/bin/:$PATH
  5. $ gcc -v gcc version 4.5.2 (tdm-1)
  6. $ cd /d/work/libiconv-1.13.1
  7. $ ./configure --prefix=/opt/freetds/freetds --disable-shared --enable-static --enable-extra-encodings
  8. $ make
  9. $ make install
  10. $ cd /d/work/freetds-0.91.dev.20110523RC2
  11. $ $ ./configure --prefix=/opt/freetds/freetds --enable-threadsafe --disable-shared --enable-static --enable-msdblib --enable-odbc-wide --with-tdsver=7.2 --enable-libiconv --with-libiconv-prefix=/opt/freetds/freetds
  12. $ make
  13. $ make install
  14. zip [msys_inst_path]\opt\freetds folder to freetds.zip
  15. replace [pymssql_src]\win32\freetds.zip with new freetds.zip
  16. fix the setup.py as below. Because of iconv and sysdb order, link error occurred in pymssql build. So, iconv and sysdb order is changed. @@ -53,9 +53,9 @@ include_dirs = [os.path.join(FREETDS, 'include')] library_dirs = [os.path.join(FREETDS, 'lib')] libraries = [
    • 'libiconv',
    • 'sybdb',
    • 'libiconv',

      'iconv',

    • 'sybdb',
      'ws2_32',
      'wsock32',
      'kernel32',
  17. run cmd.exe and cd D:\work\pymssql19_hg
  18. D:\work\pymssql19_hg>set PATH=c:\devtool\mingw_tdm\bin;%PATH%
  19. D:\work\pymssql19_hg>python26 setup.py build -c mingw32 bdist_wininst

Original issue: http://code.google.com/p/pymssql/issues/detail?id=54

clueboy commented 11 years ago

From marunguy on May 24, 2011 04:31:41

I miss the freetds.zip. As it is too big, it is attached as split 7 file. This is first file.

Attachment: freetds.7z.001

clueboy commented 11 years ago

From marunguy on May 24, 2011 04:32:31

This is second file.

Attachment: freetds.7z.002

clueboy commented 11 years ago

From marunguy on May 24, 2011 04:36:11

I attach the pymssql windows installer for python 2.5, 2.6, 2.7 using above library.

Attachment: pymssql-1.9.909.win32-py2.5.exe.7z pymssql-1.9.909.win32-py2.6.exe.7z pymssql-1.9.909.win32-py2.7.exe.7z

clueboy commented 11 years ago

From rsyring on March 08, 2012 07:21:47

Status: Accepted

clueboy commented 11 years ago

From msabramo on August 07, 2013 07:01:35

Labels: patchincluded

clueboy commented 11 years ago

From msabramo on September 18, 2013 22:48:39

Labels: OpSys-Windows

clueboy commented 11 years ago

From msabramo on September 18, 2013 22:49:14

Labels: Windows