<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to patches</title><link>https://sourceforge.net/p/python-sybase/patches/</link><description>Recent changes to patches</description><atom:link href="https://sourceforge.net/p/python-sybase/patches/feed.rss" rel="self"/><language>en</language><lastBuildDate>Thu, 03 Nov 2016 06:46:25 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/python-sybase/patches/feed.rss" rel="self" type="application/rss+xml"/><item><title>Support varchar &gt; 255 characters long</title><link>https://sourceforge.net/p/python-sybase/patches/13/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Attached patch supports long vaarchar / text / binary data.  Assumes you have built against and run against ctlib 12.5 or later,  I've not tested with FreeTDS.&lt;/p&gt;
&lt;p&gt;As far as I can test, this works for select, SP result sets, cursor.execute() for insert/update, cursor.callproc() parameters, BCP-in and BCP-out.&lt;/p&gt;
&lt;p&gt;If you are getting errors like 'A data length of 256 exceeds the maximum length allowed for CHAR data.'  or 'Character or binary data returned from Adaptive Server has been truncated. The client application does not support more than 255 bytes of data as a result column or output parameter.' this patch may help.&lt;/p&gt;
&lt;p&gt;Line numbers may be a bit off, we have some local mods also.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregory Bond</dc:creator><pubDate>Thu, 03 Nov 2016 06:46:25 -0000</pubDate><guid>https://sourceforge.net44f349e0731041bcef93fb9bfecddcb93ba02f4e</guid></item><item><title>ASE 15.0 on Win32</title><link>https://sourceforge.net/p/python-sybase/patches/12/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you very much for your work on the Sybase driver, it works! I wanted to mention that ASE 15 has slightly different naming convention for its *.lib files. The following works in Win32 section of setup.py:&lt;/p&gt;
&lt;p&gt;syb_libs = ['libsybblk', 'libsybct', 'libsybcs']&lt;/p&gt;
&lt;p&gt;The driver also builds and works well for ASE 12.5 on Windows, without any modifications. I tested all that on Windows XP SP3 with Python 2.7.1 and VC 9 (Visual Studio 2008).&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sergey</dc:creator><pubDate>Sat, 19 Mar 2011 18:38:02 -0000</pubDate><guid>https://sourceforge.netf68ce1c9177e53c33a0c7c2c8b92662554f10e43</guid></item><item><title>Patch to build with Sybase 12.5 on WinXP/mingw</title><link>https://sourceforge.net/p/python-sybase/patches/11/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Attempt to build using the mingw compiler on Windows XP using the real Sybase libs fails at link stage.  Root cause is that the nasty tangle of #ifs in the Sybase csconfig.h header doesn't properly set CS_PUBLIC for this compiler, so header doesn't have the correct __stdcall attributes, causing the linker to fail (.o file has "blk_alloc", .lib has "_blk_alloc").&lt;/p&gt;
&lt;p&gt;Attached patch fixes this.... If I understand things, this should also fix similar issues with cygwin and other non-VisualStudio compilers, and should not hurt for VisualStudio, but I have no way of testing this claim.&lt;/p&gt;
&lt;p&gt;Patch should not affect FreeTDS users.&lt;/p&gt;
&lt;p&gt;I also have no way of knowing inf this is a problem or of testing this patch with other Sybase versions.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregory Bond</dc:creator><pubDate>Thu, 23 Dec 2010 06:27:05 -0000</pubDate><guid>https://sourceforge.netd455cc65be8daca1424e8ef221f1251aa62bda77</guid></item><item><title>Allow strings for smalldatetime</title><link>https://sourceforge.net/p/python-sybase/patches/10/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;datetime types allow strings (suitably formatted) to be used to set values.  Smalldatetime doesn't, due to cut-n-paste.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregory Bond</dc:creator><pubDate>Mon, 20 Dec 2010 05:56:34 -0000</pubDate><guid>https://sourceforge.net51ff0eb1d6a821e90a45b27e5411bc0c08df2ea1</guid></item><item><title>Return None on NULL datetime otuput</title><link>https://sourceforge.net/p/python-sybase/patches/9/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;This patch changes the dictionary DateTimeAsPython so the output conversion functions will return None when a stored procedure returns NULL for a datetime output value.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Robert Boehne</dc:creator><pubDate>Wed, 08 Dec 2010 18:06:08 -0000</pubDate><guid>https://sourceforge.net51f9ba3a8ca21fb5e71544cc09cf0b16d5a78b79</guid></item><item><title>use spaces for indentation everywhere</title><link>https://sourceforge.net/p/python-sybase/patches/8/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;The class definition for DBAPITypeObject was made with a mixture of tabs and spaces - this patch converts the tabs to the appropriate number of spaces.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Robert Boehne</dc:creator><pubDate>Wed, 08 Dec 2010 18:00:26 -0000</pubDate><guid>https://sourceforge.net4cffc4bf4e63337cdd504588dfa1928d885e4a22</guid></item><item><title>Collapsing two or more result sets / return status</title><link>https://sourceforge.net/p/python-sybase/patches/7/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;There is a problem retrieving data from cursor with two or more result sets. Let's assume we have following Transact-SQL procedure:&lt;/p&gt;
&lt;p&gt;create procedure SampleProc&lt;br /&gt;
as&lt;br /&gt;
begin&lt;br /&gt;
select 1 as col1, 2 as col2&lt;br /&gt;
union&lt;br /&gt;
select 11,12&lt;/p&gt;
&lt;p&gt;select 3 as col3, "4" as col4, 5 as col5&lt;br /&gt;
union&lt;br /&gt;
select 31,"41",51&lt;br /&gt;
end&lt;/p&gt;
&lt;p&gt;and corresponding python code to get first result set:&lt;/p&gt;
&lt;p&gt;import Sybase&lt;/p&gt;
&lt;p&gt;db=Sybase.connect('Sybase','user','pass','')&lt;br /&gt;
cur = db.cursor()&lt;br /&gt;
cur.execute('exec SampleProc')&lt;/p&gt;
&lt;p&gt;rs = cur.fetchall()&lt;br /&gt;
print rs&lt;/p&gt;
&lt;p&gt;I expect output like "[(1, 2), (11, 12)]", but it is a bit longer: "[(1, 2), (11, 12), (3, '4', 5), (31, '41', 51)]".&lt;br /&gt;
I.e. cursor has returned both results instead of first one.&lt;/p&gt;
&lt;p&gt;Patch makes some changes in class Cursor to fix it.&lt;br /&gt;
1. Method _start(): add private variable _empty_set to test if end of result set has been reached.&lt;/p&gt;
&lt;p&gt;def _start(self):&lt;br /&gt;
self._result_list = []&lt;br /&gt;
self._rownum = -1&lt;br /&gt;
self.rowcount = -1&lt;br /&gt;
self.description = None&lt;br /&gt;
self._empty_set = False&lt;/p&gt;
&lt;p&gt;status = self._cmd.ct_send()&lt;br /&gt;
if status != CS_SUCCEED:&lt;br /&gt;
self._raise_error(Error('ct_send'))&lt;br /&gt;
self._fetching = True&lt;br /&gt;
return self._mainloop()&lt;/p&gt;
&lt;p&gt;2. Method _row_result(): delete call of _mainloop() and check end of result set. _mainloop() is the cause of getting all result sets instead of one.&lt;/p&gt;
&lt;p&gt;def _row_result(self):&lt;br /&gt;
logical_result = []&lt;br /&gt;
if self._empty_set:&lt;br /&gt;
count = 0&lt;br /&gt;
else:&lt;br /&gt;
count = self._fetch_rows(self._bufs, logical_result)&lt;br /&gt;
self._rownum += count&lt;br /&gt;
self._result_list += logical_result&lt;br /&gt;
self._empty_set = count == 0&lt;/p&gt;
&lt;p&gt;3. Method fetchmany(): check if there is more rows in current result set.&lt;/p&gt;
&lt;p&gt;def fetchmany(self, num = -1):&lt;br /&gt;
'''DB-API Cursor.fetchmany()&lt;br /&gt;
'''&lt;br /&gt;
self._lock()&lt;br /&gt;
try:&lt;br /&gt;
if self._rownum == -1:&lt;br /&gt;
self._raise_error(Error('No result set'))&lt;br /&gt;
if num &amp;lt; 0:&lt;br /&gt;
num = self.arraysize&lt;br /&gt;
while num &amp;gt; self._rownum and self._fetching and not self._empty_set:&lt;br /&gt;
self._row_result()&lt;br /&gt;
res = self._result_list[0:num]&lt;br /&gt;
del self._result_list[0:num]&lt;br /&gt;
self._rownum -= num&lt;br /&gt;
return res&lt;br /&gt;
finally:&lt;br /&gt;
self._unlock()&lt;/p&gt;
&lt;p&gt;4. Method fetchall(): the very same modification.&lt;/p&gt;
&lt;p&gt;def fetchall(self):&lt;br /&gt;
'''DB-API Cursor.fetchall()&lt;br /&gt;
'''&lt;br /&gt;
self._lock()&lt;br /&gt;
try:&lt;br /&gt;
if self._rownum == -1:&lt;br /&gt;
self._raise_error(Error('No result set'))&lt;br /&gt;
while self._fetching and not self._empty_set:&lt;br /&gt;
self._row_result()&lt;br /&gt;
res = self._result_list&lt;br /&gt;
self._result_list = []&lt;br /&gt;
self._rownum = 0&lt;br /&gt;
return res&lt;br /&gt;
finally:&lt;br /&gt;
self._unlock()&lt;/p&gt;
&lt;p&gt;5. Method nextset(): reset _empty_set and return True if _mainloop get empty set. Query may return empty result set, in that case variable _result_list would contain empty list. Though result set should be returned to client.&lt;/p&gt;
&lt;p&gt;def nextset(self):&lt;br /&gt;
'''DB-API Cursor.nextset()&lt;br /&gt;
'''&lt;br /&gt;
self._lock()&lt;br /&gt;
try:&lt;br /&gt;
if not self._fetching:&lt;br /&gt;
return None&lt;br /&gt;
status = self._cmd.ct_cancel(CS_CANCEL_CURRENT)&lt;br /&gt;
self._empty_set = False&lt;br /&gt;
self._result_list = []&lt;br /&gt;
self._rownum = -1&lt;br /&gt;
self.rowcount = -1&lt;br /&gt;
self._mainloop()&lt;br /&gt;
if self._result_list or self._empty_set:&lt;br /&gt;
return True&lt;br /&gt;
return None&lt;br /&gt;
finally:&lt;br /&gt;
self._unlock()&lt;/p&gt;
&lt;p&gt;With this changes we would get all result sets and it's descriptions separately. For example, following code:&lt;/p&gt;
&lt;p&gt;import Sybase&lt;/p&gt;
&lt;p&gt;db=Sybase.connect('Sybase','user','pass','')&lt;br /&gt;
cur = db.cursor()&lt;br /&gt;
cur.execute('exec SampleProc')&lt;/p&gt;
&lt;p&gt;rs = cur.fetchall()&lt;br /&gt;
print rs&lt;br /&gt;
while cur.nextset():&lt;br /&gt;
rs = cur.fetchall()&lt;br /&gt;
print rs&lt;/p&gt;
&lt;p&gt;will return:&lt;/p&gt;
&lt;p&gt;[(1, 2), (11, 12)]&lt;br /&gt;
[(3, '4', 5), (31, '41', 51)]&lt;/p&gt;
&lt;p&gt;Also i've added property status_result to store processed return status. It can be accessed after fetching all of result sets.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexey Novikov</dc:creator><pubDate>Thu, 18 Feb 2010 12:19:25 -0000</pubDate><guid>https://sourceforge.net2484f0d6a1807a509b586681b136803daf60cebb</guid></item><item><title>truncate option for BCP-in</title><link>https://sourceforge.net/p/python-sybase/patches/6/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Attached patch adds a truncate option to DataBuf and Bulkcopy objects to silently truncate when a string value in a BCP-in operation is too big for the underlying column.  Default is the existing behaviour: raise TypeError.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregory Bond</dc:creator><pubDate>Thu, 23 Oct 2008 03:49:24 -0000</pubDate><guid>https://sourceforge.net17938ae572fdc15b356c1f2130549175f9347ed6</guid></item><item><title>A faster Cursor.fetchall()</title><link>https://sourceforge.net/p/python-sybase/patches/5/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;fetchall() currently uses fetchone() iteratively to build the dataset.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;While fetchone() may not go to the database it does cause another lock acquisition (on both the cursor and connection) for every single row.  This causes a noticeable slowdown.&lt;/p&gt;
&lt;p&gt;If instead fetchall() uses fetchmany, locks only occur for each call to fetchmany.  If the user has set Cursor.arraysize this will mean far fewer acquisitions.&lt;/p&gt;
&lt;p&gt;eg arraysize=1000, returning a dataset of 10000 rows and 3 columns&lt;/p&gt;
&lt;p&gt;current implementation: 0.57 seconds&lt;br /&gt;
fetchmany implementation: 0.22 seconds&lt;/p&gt;
&lt;p&gt;(both numbers include IO to database)&lt;/p&gt;
&lt;p&gt;[I noticed this problem when I observed that this module was 4 times slower than the legacy sybase code I have running on systems here]&lt;/p&gt;
&lt;p&gt;Suggested Cursor.fetchall():&lt;br /&gt;
def fetchall(self):&lt;br /&gt;
self._lock()&lt;br /&gt;
try:&lt;br /&gt;
rows = []&lt;br /&gt;
while 1:&lt;br /&gt;
newRows = self.fetchmany(-1)&lt;br /&gt;
if not newRows: break&lt;br /&gt;
rows.extend(newRows)&lt;br /&gt;
return rows&lt;br /&gt;
finally:&lt;br /&gt;
self._unlock()&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Derek Harland</dc:creator><pubDate>Tue, 03 Jul 2007 05:23:41 -0000</pubDate><guid>https://sourceforge.netbe12dec6ef920053ad6c574050407281625a5cda</guid></item><item><title>Freetds bcp patch</title><link>https://sourceforge.net/p/python-sybase/patches/4/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;This patch allows to build python-sybase with bcp-support against freetds.&lt;/p&gt;
&lt;p&gt;I found it to work quite stable (thinks that went in came out again) but there are some issues with freetds:&lt;/p&gt;
&lt;p&gt;* Bcp in works with allpages locked tables only&lt;br /&gt;
* The rowcounts returned by blk_done und blk_rowxfer_mult aren't reliable.&lt;br /&gt;
* you might need to specify the same linkeroptions (-liconv etc) you used to build freetds&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">K.-M. Hansche</dc:creator><pubDate>Wed, 23 May 2007 11:02:26 -0000</pubDate><guid>https://sourceforge.net68ebe3a9f7c0ca0073e0d94b17d45ccd419cd271</guid></item></channel></rss>