google-code-export / pymssql

Automatically exported from code.google.com/p/pymssql
GNU Lesser General Public License v2.1
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. To refer issue 48 and issue50, build pymssql for windows.
2. 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
4. download and install tdm-gcc 4.5.2 from http://tdm-gcc.tdragon.net/download
5. clone pymssql source.
6. run the msys shell
7. $ export PATH=/c/devtool/mingw_tdm/bin/:$PATH
8. $ gcc -v
   gcc version 4.5.2 (tdm-1)
9. $ cd /d/work/libiconv-1.13.1
11. $ ./configure --prefix=/opt/freetds/freetds --disable-shared 
--enable-static --enable-extra-encodings
12. $ make
13. $ make install
14. $ cd /d/work/freetds-0.91.dev.20110523RC2
15. $ $ ./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
16. $ make
17. $ make install
18. zip [msys_inst_path]\opt\freetds folder to freetds.zip
19. replace [pymssql_src]\win32\freetds.zip with new freetds.zip
20. 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',

21. run cmd.exe and cd D:\work\pymssql19_hg
22. D:\work\pymssql19_hg>set PATH=c:\devtool\mingw_tdm\bin;%PATH%
23. D:\work\pymssql19_hg>python26 setup.py build -c mingw32 bdist_wininst

Original issue reported on code.google.com by marun...@gmail.com on 24 May 2011 at 11:20

GoogleCodeExporter commented 9 years ago
I miss the freetds.zip.
As it is too big, it is attached as split 7 file.
This is first file.

Original comment by marun...@gmail.com on 24 May 2011 at 11:31

Attachments:

GoogleCodeExporter commented 9 years ago
This is second file.

Original comment by marun...@gmail.com on 24 May 2011 at 11:32

Attachments:

GoogleCodeExporter commented 9 years ago
I attach the pymssql windows installer for python 2.5, 2.6, 2.7 using above 
library.

Original comment by marun...@gmail.com on 24 May 2011 at 11:36

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by rsyr...@gmail.com on 8 Mar 2012 at 3:21

GoogleCodeExporter commented 9 years ago

Original comment by msabr...@gmail.com on 7 Aug 2013 at 2:01

GoogleCodeExporter commented 9 years ago

Original comment by msabr...@gmail.com on 19 Sep 2013 at 5:48

GoogleCodeExporter commented 9 years ago

Original comment by msabr...@gmail.com on 19 Sep 2013 at 5:49