You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
(3) |
Apr
(26) |
May
(7) |
Jun
|
Jul
(12) |
Aug
|
Sep
(13) |
Oct
(6) |
Nov
(14) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(31) |
Feb
(15) |
Mar
(6) |
Apr
(18) |
May
(11) |
Jun
(3) |
Jul
(7) |
Aug
(5) |
Sep
(6) |
Oct
(1) |
Nov
(2) |
Dec
(6) |
2004 |
Jan
(3) |
Feb
(3) |
Mar
(18) |
Apr
(4) |
May
(13) |
Jun
(32) |
Jul
(21) |
Aug
(22) |
Sep
(11) |
Oct
(2) |
Nov
(6) |
Dec
(5) |
2005 |
Jan
(4) |
Feb
(16) |
Mar
(21) |
Apr
(10) |
May
(1) |
Jun
(5) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(15) |
Nov
(20) |
Dec
|
2006 |
Jan
(3) |
Feb
(1) |
Mar
(3) |
Apr
(5) |
May
(4) |
Jun
(6) |
Jul
(23) |
Aug
(6) |
Sep
(5) |
Oct
(8) |
Nov
|
Dec
(12) |
2007 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
(9) |
Jun
(1) |
Jul
(6) |
Aug
(5) |
Sep
(3) |
Oct
|
Nov
(5) |
Dec
(6) |
2008 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(3) |
May
|
Jun
(12) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
(1) |
Dec
(4) |
2009 |
Jan
|
Feb
(2) |
Mar
(16) |
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(21) |
Sep
(11) |
Oct
(4) |
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2011 |
Jan
(9) |
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
(1) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: mike <mik...@gm...> - 2005-10-27 19:15:04
|
hi sorry for posting so many times... but i would like to tell you that it's o= k now. somehow, i recompiled the Sybase.py you posted using the Sybase-0.37 module i downloaded from object craft web site. I just replace the Sybase.py from Sybase-0.37 with the one you posted, recompiled, and it works.. Somehow , the Sybase.py from the actual source didn't work. thanks On 10/26/05, Nidositko, James <Jam...@gs...> wrote: > > > Mistakenly sent last reply to list as HTML. Repeated here: > > > Mike, > I had some discussions earlier this year with Dave about fixing the > rowcount stuff in the recent versions of the Sybase module (0.36 and 0.37 > ). > I was under the impression that these fixes had been incorporated and > released, but I did not check that before responding to your question. > Sorry for the confusion. > > The last official version that I know of where rowcount() worked was > 0.36-pre2. There were extensive changes to the structure of the code > between that version and the actual 0.36 release. The rowcount problems > were introduced by some of those changes and carried forward into 0.37. > > I'm assuming that you're using 0.37. > > The attached copy of Sybase.py fixes the rowcount issues. It is > based on the version released with 0.37. > > Dave, any chance of getting an official release with rowcount() > working? > > -Jim > > _______________________________________________ > Python-sybase mailing list > Pyt...@ww... > https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase > |
From: mike <mik...@gm...> - 2005-10-27 19:07:19
|
hi ok i have retried, redownload sybase-037, recompile and retested , but it still gives me -1 as a workaround, i will just do a check on the "user" criteria as well as check for existence of the table to be updated before i actually do the update. This way i can more or less be sure that it will definitely update. thanks again On 10/26/05, Nidositko, James <Jam...@gs...> wrote: > > > Mistakenly sent last reply to list as HTML. Repeated here: > > > Mike, > I had some discussions earlier this year with Dave about fixing the > rowcount stuff in the recent versions of the Sybase module (0.36 and 0.37 > ). > I was under the impression that these fixes had been incorporated and > released, but I did not check that before responding to your question. > Sorry for the confusion. > > The last official version that I know of where rowcount() worked was > 0.36-pre2. There were extensive changes to the structure of the code > between that version and the actual 0.36 release. The rowcount problems > were introduced by some of those changes and carried forward into 0.37. > > I'm assuming that you're using 0.37. > > The attached copy of Sybase.py fixes the rowcount issues. It is > based on the version released with 0.37. > > Dave, any chance of getting an official release with rowcount() > working? > > -Jim > > _______________________________________________ > Python-sybase mailing list > Pyt...@ww... > https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase > |
From: mike <mik...@gm...> - 2005-10-27 18:43:26
|
thanks for the help, appreciate that. my version of Sybase ASE is 12.5 and when i did the compiling in Solaris 8, i use gcc and just "python setup.py install" and no other flags or options. Don't know whether it has anything to do with that rowcount stuff , maybe my environment has something to do with it but anyway, just some info on my side on what i did.... I will try out the Sybase.py you posted. Will keep you informed. On 10/26/05, Nidositko, James <Jam...@gs...> wrote: > > Mike, > I had some discussions earlier this year with Dave about fixing the > rowcount stuff in the recent versions of the Sybase module (0.36 and 0.37= ). > I was under the impression that these fixes had been incorporated and > released, but I did not check that before responding to your question. So= rry > for the confusion. > The last official version that I know of where rowcount() worked was > 0.36-pre2. There were extensive changes to the structure of the code > between that version and the actual 0.36 release. The rowcount problems > were introduced by some of those changes and carried forward into 0.37. > I'm assuming that you're using 0.37. > The attached copy of Sybase.py fixes the rowcount issues. It is based on > the version released with 0.37. > Dave, any chance of getting an official release with rowcount() working? > -Jim > > ------------------------------ > *From:* mike [mailto:mik...@gm...] > *Sent:* Wednesday, October 26, 2005 10:56 AM > *To:* Nidositko, James > *Cc:* pyt...@ww... > *Subject:* Re: [python-sybase] how to get return value of update/delete > > hi thanks for the reply. > I went to try the codes out > > def exec_updtstmt(Svr,Login,Pass,Db,SQL): > ''' Connects to database specified, exec the SQL and returns value''' > try: > db =3D Sybase.connect(Svr, Login,Pass ,Db) > c =3D db.cursor() > try: > c.execute(SQL) > print "Cursor rowcount after update (no rows) is: %d" % c.rowcount > db.commit() > db.close() > except Sybase.DatabaseError: > return 9 > except: > return 2 > > stmt =3D ''' > update table > set col_1 =3D 1 > where login =3D "user" > ''' > > exec_updtstmt(Svr,Login,Pass,DbInt,stmt) > > what i got is "Cursor rowcount after update (no rows) is: -1" and when i > checked the table > it is updated. Although the update works, i would wish to get that return > to indicate to the user whether success or failure > . > thanks for any further help > > > > > On 10/26/05, Nidositko, James <Jam...@gs...> wrote: > > > > > > Mike, > > There is no inherent concept of a "return value" from an executed SQL > > statement. You can produce such a result by encapsulating your SQL > > statements within stored procedures by detecting the rowcount and > > setting > > the return value in response, but there isn't really any need for you t= o > > do > > that. > > > > 1) It sounds like the error case that you're trying to describe below > > should > > be detected by getting a rowcount of zero from the update. > > > > 2) Rowcount does work. Here is some sample code that will show rowcount > > working in various situations. > > > > c=3Ddbc.cursor() > > print "Cursor rowcount is initialized to: %d" % c.rowcount > > c.execute ("create table __test_rowcount (col1 varchar(10) NULL)") > > print "Cursor rowcount after create table is: %d" % c.rowcount > > > > c.execute("insert __test_rowcount (col1) values ('asdf')") > > print "Cursor rowcount after insert 1 is: %d" % c.rowcount > > > > c.execute("insert __test_rowcount (col1) values ('asdf')") > > print "Cursor rowcount after insert 2 is: %d" % c.rowcount > > > > c.execute("update __test_rowcount set col1 =3D 'qwer' where col1 =3D > > 'asdf'") > > print "Cursor rowcount after update is: %d" % c.rowcount > > > > c.execute("update __test_rowcount set col1 =3D 'qwer' where col1 =3D 'n= ot > > there'") > > print "Cursor rowcount after update (no rows) is: %d" % c.rowcount > > > > c.execute("select count(*) from __test_rowcount") > > print "Cursor rowcount after execute for select is: %d" % c.rowcount > > c.fetchall() > > print "Cursor rowcount after fetch for select is: %d" % c.rowcount > > > > c.execute("delete __test_rowcount where col1 =3D 'qwer'") > > print "Cursor rowcount after delete is: %d" % c.rowcount > > > > The only unusual case is select. Then, the rowcount is not set until th= e > > fetch is performed. > > > > -Jim > > > > -----Original Message----- > > From: pyt...@ww... > > [mailto:pyt...@ww...] On Behalf Of > > pyt...@ww... > > Sent: Tuesday, October 25, 2005 10:00 PM > > To: pyt...@ww... > > Subject: Python-sybase Digest, Vol 5, Issue 3 > > > > > > Today's Topics: > > > > 1. how to get return value of update/delete statement (michael lee) > > > > > > ---------------------------------------------------------------------- > > > > Message: 1 > > Date: Tue, 25 Oct 2005 18:30:07 +0800 > > From: michael lee <mik...@gm...> > > Subject: [python-sybase] how to get return value of update/delete > > statement > > To: Python Sybase < pyt...@ww...> > > Message-ID: > > <e32...@ma...> > > Content-Type: text/plain; charset=3D"iso-8859-1" > > > > hi > > how can i successfully get the return of an update or delete statement > > using > > the Sybase module? > > i am doing a CGI script whereby if a user keys in the wrong name, i > > would > > want to catch that error eg if key in wrong username, my CGI script wil= l > > call Sybase to execute < update table set this =3D a-value where name = =3D > > 'wronguser' > and then return a value indicating "not found" > > but i am not able to figure out how to catch this return value. Any > > advise? > > .... > > cur.execute(update_statement) > > .... > > my table is being updated though when i tried a valid user. I tried > > rowcount but also not working. > > thanks > > -------------- next part -------------- > > An HTML attachment was scrubbed... > > URL: > > http://www.object-craft.com.au/pipermail/python-sybase/attachments/2005= 1025/ > > > > 0c35109c/attachment-0001.html > > > > ------------------------------ > > > > _______________________________________________ > > Python-sybase mailing list > > Pyt...@ww... > > https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase > > > > > > End of Python-sybase Digest, Vol 5, Issue 3 > > ******************************************* > > > > > |
From: Nidositko, J. <Jam...@gs...> - 2005-10-27 08:46:39
|
Mistakenly sent last reply to list as HTML. Repeated here: Mike, I had some discussions earlier this year with Dave about fixing the rowcount stuff in the recent versions of the Sybase module (0.36 and 0.37). I was under the impression that these fixes had been incorporated and released, but I did not check that before responding to your question. Sorry for the confusion. The last official version that I know of where rowcount() worked was 0.36-pre2. There were extensive changes to the structure of the code between that version and the actual 0.36 release. The rowcount problems were introduced by some of those changes and carried forward into 0.37. I'm assuming that you're using 0.37. The attached copy of Sybase.py fixes the rowcount issues. It is based on the version released with 0.37. Dave, any chance of getting an official release with rowcount() working? -Jim |
From: mike <mik...@gm...> - 2005-10-27 07:56:02
|
hi thanks for the reply. I went to try the codes out def exec_updtstmt(Svr,Login,Pass,Db,SQL): ''' Connects to database specified, exec the SQL and returns value''' try: db =3D Sybase.connect(Svr, Login,Pass ,Db) c =3D db.cursor() try: c.execute(SQL) print "Cursor rowcount after update (no rows) is: %d" % c.rowcount db.commit() db.close() except Sybase.DatabaseError: return 9 except: return 2 stmt =3D ''' update table set col_1 =3D 1 where login =3D "user" ''' exec_updtstmt(Svr,Login,Pass,DbInt,stmt) what i got is "Cursor rowcount after update (no rows) is: -1" and when i checked the table it is updated. Although the update works, i would wish to get that return t= o indicate to the user whether success or failure . thanks for any further help On 10/26/05, Nidositko, James <Jam...@gs...> wrote: > > > Mike, > There is no inherent concept of a "return value" from an executed SQL > statement. You can produce such a result by encapsulating your SQL > statements within stored procedures by detecting the rowcount and setting > the return value in response, but there isn't really any need for you to > do > that. > > 1) It sounds like the error case that you're trying to describe below > should > be detected by getting a rowcount of zero from the update. > > 2) Rowcount does work. Here is some sample code that will show rowcount > working in various situations. > > c=3Ddbc.cursor() > print "Cursor rowcount is initialized to: %d" % c.rowcount > c.execute("create table __test_rowcount (col1 varchar(10) NULL)") > print "Cursor rowcount after create table is: %d" % c.rowcount > > c.execute("insert __test_rowcount (col1) values ('asdf')") > print "Cursor rowcount after insert 1 is: %d" % c.rowcount > > c.execute("insert __test_rowcount (col1) values ('asdf')") > print "Cursor rowcount after insert 2 is: %d" % c.rowcount > > c.execute("update __test_rowcount set col1 =3D 'qwer' where col1 =3D 'asd= f'") > print "Cursor rowcount after update is: %d" % c.rowcount > > c.execute("update __test_rowcount set col1 =3D 'qwer' where col1 =3D 'not > there'") > print "Cursor rowcount after update (no rows) is: %d" % c.rowcount > > c.execute("select count(*) from __test_rowcount") > print "Cursor rowcount after execute for select is: %d" % c.rowcount > c.fetchall() > print "Cursor rowcount after fetch for select is: %d" % c.rowcount > > c.execute("delete __test_rowcount where col1 =3D 'qwer'") > print "Cursor rowcount after delete is: %d" % c.rowcount > > The only unusual case is select. Then, the rowcount is not set until the > fetch is performed. > > -Jim > > -----Original Message----- > From: pyt...@ww... > [mailto:pyt...@ww...] On Behalf Of > pyt...@ww... > Sent: Tuesday, October 25, 2005 10:00 PM > To: pyt...@ww... > Subject: Python-sybase Digest, Vol 5, Issue 3 > > > Today's Topics: > > 1. how to get return value of update/delete statement (michael lee) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 25 Oct 2005 18:30:07 +0800 > From: michael lee <mik...@gm...> > Subject: [python-sybase] how to get return value of update/delete > statement > To: Python Sybase <pyt...@ww...> > Message-ID: > <e32...@ma...> > Content-Type: text/plain; charset=3D"iso-8859-1" > > hi > how can i successfully get the return of an update or delete statement > using > the Sybase module? > i am doing a CGI script whereby if a user keys in the wrong name, i would > want to catch that error eg if key in wrong username, my CGI script will > call Sybase to execute < update table set this =3D a-value where name =3D > 'wronguser' > and then return a value indicating "not found" > but i am not able to figure out how to catch this return value. Any > advise? > .... > cur.execute(update_statement) > .... > my table is being updated though when i tried a valid user. I tried > rowcount but also not working. > thanks > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > > http://www.object-craft.com.au/pipermail/python-sybase/attachments/200510= 25/ > 0c35109c/attachment-0001.html > > ------------------------------ > > _______________________________________________ > Python-sybase mailing list > Pyt...@ww... > https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase > > > End of Python-sybase Digest, Vol 5, Issue 3 > ******************************************* > |
From: Nidositko, J. <Jam...@gs...> - 2005-10-27 07:17:15
|
Mike, There is no inherent concept of a "return value" from an executed SQL statement. You can produce such a result by encapsulating your SQL statements within stored procedures by detecting the rowcount and setting the return value in response, but there isn't really any need for you to do that. 1) It sounds like the error case that you're trying to describe below should be detected by getting a rowcount of zero from the update. 2) Rowcount does work. Here is some sample code that will show rowcount working in various situations. c=dbc.cursor() print "Cursor rowcount is initialized to: %d" % c.rowcount c.execute("create table __test_rowcount (col1 varchar(10) NULL)") print "Cursor rowcount after create table is: %d" % c.rowcount c.execute("insert __test_rowcount (col1) values ('asdf')") print "Cursor rowcount after insert 1 is: %d" % c.rowcount c.execute("insert __test_rowcount (col1) values ('asdf')") print "Cursor rowcount after insert 2 is: %d" % c.rowcount c.execute("update __test_rowcount set col1 = 'qwer' where col1 = 'asdf'") print "Cursor rowcount after update is: %d" % c.rowcount c.execute("update __test_rowcount set col1 = 'qwer' where col1 = 'not there'") print "Cursor rowcount after update (no rows) is: %d" % c.rowcount c.execute("select count(*) from __test_rowcount") print "Cursor rowcount after execute for select is: %d" % c.rowcount c.fetchall() print "Cursor rowcount after fetch for select is: %d" % c.rowcount c.execute("delete __test_rowcount where col1 = 'qwer'") print "Cursor rowcount after delete is: %d" % c.rowcount The only unusual case is select. Then, the rowcount is not set until the fetch is performed. -Jim -----Original Message----- From: pyt...@ww... [mailto:pyt...@ww...] On Behalf Of pyt...@ww... Sent: Tuesday, October 25, 2005 10:00 PM To: pyt...@ww... Subject: Python-sybase Digest, Vol 5, Issue 3 Today's Topics: 1. how to get return value of update/delete statement (michael lee) ---------------------------------------------------------------------- Message: 1 Date: Tue, 25 Oct 2005 18:30:07 +0800 From: michael lee <mik...@gm...> Subject: [python-sybase] how to get return value of update/delete statement To: Python Sybase <pyt...@ww...> Message-ID: <e32...@ma...> Content-Type: text/plain; charset="iso-8859-1" hi how can i successfully get the return of an update or delete statement using the Sybase module? i am doing a CGI script whereby if a user keys in the wrong name, i would want to catch that error eg if key in wrong username, my CGI script will call Sybase to execute < update table set this = a-value where name = 'wronguser' > and then return a value indicating "not found" but i am not able to figure out how to catch this return value. Any advise? .... cur.execute(update_statement) .... my table is being updated though when i tried a valid user. I tried rowcount but also not working. thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.object-craft.com.au/pipermail/python-sybase/attachments/20051025/ 0c35109c/attachment-0001.html ------------------------------ _______________________________________________ Python-sybase mailing list Pyt...@ww... https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase End of Python-sybase Digest, Vol 5, Issue 3 ******************************************* |
From: michael l. <mik...@gm...> - 2005-10-26 03:30:17
|
hi how can i successfully get the return of an update or delete statement usin= g the Sybase module? i am doing a CGI script whereby if a user keys in the wrong name, i would want to catch that error eg if key in wrong username, my CGI script will call Sybase to execute < update table set this =3D a-val= ue where name =3D 'wronguser' > and then return a value indicating "not found" but i am not able to figure out how to catch this return value. Any advise? .... cur.execute(update_statement) .... my table is being updated though when i tried a valid user. I tried rowcount but also not working. thanks |
From: michael l. <mik...@gm...> - 2005-10-15 23:06:01
|
hi i had downlaoded the latest version of Python Sybase module and was setting it up on my Windows machine using "python setup.py install" when i encountered error compiling sybasect. It says i need Visual Studio 7.1 which i don't have. how can i resolve this? i am not into purchasing Visual Studio right now. thanks |
From: <sk...@po...> - 2005-10-06 13:54:30
|
I could have sworn that at some point I read that the execute() method of connection objects was deprecated. I can't find any indication of that now. Did my feeble brain erroneously map "extension to the DB API" with "deprecated"? Thanks, -- Skip Montanaro Katrina Benefit Concerts: http://www.musi-cal.com/katrina sk...@po... |
From: <sk...@po...> - 2005-09-29 11:15:34
|
me> It doesn't look like Python's datetime module is supported in 0.37 me> of the Python Sybase module. I think the attached patch gets you at least part of the way there. Skip |
From: <sk...@po...> - 2005-09-29 10:33:50
|
It doesn't look like Python's datetime module is supported in 0.37 of the Python Sybase module. I modified things in 0.36 to support it, but the code in Sybase.py has changed enough that I think I need to do things from scratch again. My notion of "support" is that programmers should be able to transparently input datetime.datetime (or datetime.date or datetime.time) objects and receive such objects as output without having to mess around with sybasect.datetime(). Is that the goal? Has anyone else already done this? Thanks, -- Skip Montanaro Katrina Benefit Concerts: http://www.musi-cal.com/katrina sk...@po... |
From: <sk...@po...> - 2005-09-24 07:25:05
|
Dave> From this page: Dave> http://www.object-craft.com.au/projects/sybase/sybase/module-Sybase.html Dave> db = Sybase.connect('SYBASE', 'sa', '', delay_connect = 1) Dave> db.set_property(Sybase.CS_HOSTNAME, 'secret') Dave> db.connect() Dave> The delay_connect argument tells the Connection object not to Dave> connect to the server immediately. This allows you to set Dave> properties then connect using the connect() method. Thanks. I've gotten so used to working with software that has minimal documentation (much of the stuff here at work :-) or documentation that is so voluminous that it's hard to navigate around in (the major database vendors' docs qualify here), that I frequently ignore the documentation altogether or give up after a quick scan. Skip |
From: Dave C. <dj...@ob...> - 2005-09-23 23:04:16
|
sk...@po... wrote: > skip> What am I doing wrong here? > > ... > >>>> conn.set_property(Sybase.CS_APPNAME, "foo") > ... > skip> ct_con_props(SET,APPNAME): user api layer: external error: This property > skip> cannot be set after a connection to a server has been established. > > Looking at the Open Client docs on the Sybase site it says that CS_APPNAME > and CS_HOSTNAME are login properties that take effect "only if set before > the connection is established". I eventually figured out that a change was > needed to Sybase.Connection.__init__. here's a udiff against 0.37: > > --- Sybase.py.~1~ 2005-04-06 17:46:43.000000000 -0500 > +++ Sybase.py 2005-09-22 11:49:58.849060000 -0500 > @@ -836,7 +836,8 @@ > class Connection: > > def __init__(self, dsn, user, passwd, database = None, > - strip = 0, auto_commit = 0, delay_connect = 0, locking = 1): > + strip = 0, auto_commit = 0, delay_connect = 0, locking = 1, > + appname = "", hostname = ""): > '''DB-API Sybase.Connect() > ''' > self._conn = self._cmd = None > @@ -863,6 +864,14 @@ > status = conn.ct_con_props(CS_SET, CS_PASSWORD, passwd) > if status != CS_SUCCEED: > self._raise_error(Error, 'ct_con_props') > + if appname: > + status = conn.ct_con_props(CS_SET, CS_APPNAME, appname) > + if status != CS_SUCCEED: > + self._raise_error(Error, 'ct_con_props') > + if hostname: > + status = conn.ct_con_props(CS_SET, CS_HOSTNAME, hostname) > + if status != CS_SUCCEED: > + self._raise_error(Error, 'ct_con_props') > if not delay_connect: > self.connect() >From this page: http://www.object-craft.com.au/projects/sybase/sybase/module-Sybase.html db = Sybase.connect('SYBASE', 'sa', '', delay_connect = 1) db.set_property(Sybase.CS_HOSTNAME, 'secret') db.connect() The delay_connect argument tells the Connection object not to connect to the server immediately. This allows you to set properties then connect using the connect() method. - Dave -- http://www.object-craft.com.au |
From: <sk...@po...> - 2005-09-23 09:52:50
|
skip> What am I doing wrong here? ... >>>> conn.set_property(Sybase.CS_APPNAME, "foo") ... skip> ct_con_props(SET,APPNAME): user api layer: external error: This property skip> cannot be set after a connection to a server has been established. Looking at the Open Client docs on the Sybase site it says that CS_APPNAME and CS_HOSTNAME are login properties that take effect "only if set before the connection is established". I eventually figured out that a change was needed to Sybase.Connection.__init__. here's a udiff against 0.37: --- Sybase.py.~1~ 2005-04-06 17:46:43.000000000 -0500 +++ Sybase.py 2005-09-22 11:49:58.849060000 -0500 @@ -836,7 +836,8 @@ class Connection: def __init__(self, dsn, user, passwd, database = None, - strip = 0, auto_commit = 0, delay_connect = 0, locking = 1): + strip = 0, auto_commit = 0, delay_connect = 0, locking = 1, + appname = "", hostname = ""): '''DB-API Sybase.Connect() ''' self._conn = self._cmd = None @@ -863,6 +864,14 @@ status = conn.ct_con_props(CS_SET, CS_PASSWORD, passwd) if status != CS_SUCCEED: self._raise_error(Error, 'ct_con_props') + if appname: + status = conn.ct_con_props(CS_SET, CS_APPNAME, appname) + if status != CS_SUCCEED: + self._raise_error(Error, 'ct_con_props') + if hostname: + status = conn.ct_con_props(CS_SET, CS_HOSTNAME, hostname) + if status != CS_SUCCEED: + self._raise_error(Error, 'ct_con_props') if not delay_connect: self.connect() -- Skip Montanaro Katrina Benefit Concerts: http://www.musi-cal.com/katrina sk...@po... |
From: <sk...@po...> - 2005-09-23 08:41:43
|
What am I doing wrong here? >>> import Sybase >>> conn = Sybase.Connection(...) >>> conn.set_property(Sybase.CS_APPNAME, "foo") Traceback (most recent call last): File "<stdin>", line 1, in ? File "/opt/lang/python/lib/python2.3/site-packages/3rdParty/Sybase.py", line 883, in set_property status = conn.ct_con_props(CS_SET, prop, value) File "/opt/lang/python/lib/python2.3/site-packages/3rdParty/Sybase.py", line 148, in _clientmsg_cb raise DatabaseError(_fmt_client(msg)) Sybase.DatabaseError: Layer: 1, Origin: 1 ct_con_props(SET,APPNAME): user api layer: external error: This property cannot be set after a connection to a server has been established. I got the same error when trying to set the CS_HOSTNAME property. This is with 0.36 running on Solaris/Intel connecting to a 12.5 server. Thx, -- Skip Montanaro Katrina Benefit Concerts: http://www.musi-cal.com/katrina sk...@po... |
From: Andrew M. <an...@ob...> - 2005-09-20 06:20:11
|
>The leak exists on Linux using FreeTDS. Very easy to see. Maybe the leak is in FreeTDS (I don't use the Python-sybase module, however, I'm just lurking)? -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ |
From: Bradley F. <br...@re...> - 2005-09-20 04:54:09
|
The leak exists on Linux using FreeTDS. Very easy to see. -----Original Message----- From: Grant McDonald [mailto:gmc...@in...]=20 Sent: Monday, September 19, 2005 12:10 AM To: 'Dave Cole'; Bradley Feldman Cc: pyt...@ww... Subject: RE: [python-sybase] Sybase 0.37 BIG Memory Leak -- Simple = Program FYI,=20 On WinXP with Sybase Open Client 12.5.0 GA memory usage was constant at 6948K.=20 Regards,=20 Grant McDonald=20 Important notice: This message is intended for the individual(s) and entity(s) addressed. The information contained in this transmission and = any attached, may be confidential and may also be the subject of legal privilege, public interest immunity or legal professional privilege. Any review, retransmission, dissemination or other use of, taking of any = action in reliance upon this information by person or entities other than the recipient is prohibited and requires authorization from the sender. If = you are not the addressee indicated in this message (or responsible for = delivery of the message to such person) you may not copy or deliver this message = to anyone. In such cases you should destroy this message and kindly notify = the sender by reply email.=20 WARNING: Although Infocomp has taken reasonable precautions so that no viruses are present in this e-mail, the company cannot accept = responsibility for any loss or damage arising from the use of e-mail attachments. |
From: Grant M. <gmc...@in...> - 2005-09-19 21:08:42
|
FYI, On WinXP with Sybase Open Client 12.5.0 GA memory usage was constant at 6948K. Regards, Grant McDonald |
From: Dave C. <dj...@ob...> - 2005-09-19 20:44:36
|
Bradley Feldman wrote: > Dave, et al: > > I was noticing memory growing and growing steadily while accessing my > database using Sybase 0.37 (along with FreeTDS 0.62.4). This has become a > huge concern for me, so I wrote simple program to see if I could recreate > the problem. > > Here's a simple program (slightly modified from Dave's 0.37 release notes) > that recreates the memory leak: > ========================== > > import Sybase > > db = Sybase.connect('db','sa','sa','master',auto_commit=True) > db.execute("if exists (select name from sysobjects where name = > 'sp_test_output') begin drop procedure sp_test_output end") > db.execute("create procedure sp_test_output @num int, @result int output as > select @result = @num") > > for i in range(200): > for j in range(1000): > c = db.cursor() > r = c.callproc('sp_test_output', {'@num': 12345, '@result': > Sybase.OUTPUT(1)}) > #r = c.callproc('sp_test_output', {'@num': 12345,'@result': 1}) > print r > ============================ > > Running this program and watching TOP - you'll see memory usage steadily > growing (with either callproc line). Should not be. > > Please, this is a _very_ important concern. I'm happy to work with whomever > I need to debug/fix this and obtain a patched Sybase module. Sorry, I am extremely busy at the moment and cannot spare the time to debug this. Is anyone able to try the code with the Sybase client libraries and verify if the same problem exists? - Dave -- http://www.object-craft.com.au |
From: Bradley F. <br...@re...> - 2005-09-18 21:15:40
|
Dave, et al: I was noticing memory growing and growing steadily while accessing my database using Sybase 0.37 (along with FreeTDS 0.62.4). This has become = a huge concern for me, so I wrote simple program to see if I could = recreate the problem. Here's a simple program (slightly modified from Dave's 0.37 release = notes) that recreates the memory leak: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D import Sybase db =3D Sybase.connect('db','sa','sa','master',auto_commit=3DTrue) db.execute("if exists (select name from sysobjects where name =3D 'sp_test_output') begin drop procedure sp_test_output end") db.execute("create procedure sp_test_output @num int, @result int = output as select @result =3D @num") for i in range(200): for j in range(1000): c =3D db.cursor() r =3D c.callproc('sp_test_output', {'@num': 12345, '@result': Sybase.OUTPUT(1)}) #r =3D c.callproc('sp_test_output', {'@num': 12345,'@result': = 1}) print r =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Running this program and watching TOP - you'll see memory usage steadily growing (with either callproc line). Should not be. Please, this is a _very_ important concern. I'm happy to work with = whomever I need to debug/fix this and obtain a patched Sybase module. Thanks in advance. *Bradley |
From: Paul R. <pau...@ve...> - 2005-09-09 19:36:21
|
Bradley, I had this same problem. I patched the code, but just for reads (I don't need to write those values). I have attached the patch file. Dave Cole, can we get these into the repository? Paul Rensing On Mon, 2005-08-29 at 17:05 -0400, Bradley Feldman wrote: > Does not seem so.... Anyone have any ideas for a quick patch? Right now > I'm typecasting back done to int type (4 byte). > > Thanks, > > *Bradley > > Here's the traceback: > > File "/usr/lib/python2.4/site-packages/Sybase.py", line 392, in start > return _FetchNow.start(self, arraysize) > File "/usr/lib/python2.4/site-packages/Sybase.py", line 324, in start > self._row_result() > File "/usr/lib/python2.4/site-packages/Sybase.py", line 345, in > _read_result > while _fetch_rows(self._cmd, bufs, logical_result): > File "/usr/lib/python2.4/site-packages/Sybase.py", line 267, in > _fetch_rows > rows.append(_extract_row(bufs, 0)) > File "/usr/lib/python2.4/site-packages/Sybase.py", line 242, in > _extract_row > row[col] = _column_value(buf[n]) > TypeError: unknown data format > > --- > > def _column_value(val): > if use_datetime and type(val) is DateTimeType: > return DateTime.DateTime(val.year, val.month + 1, val.day, > val.hour, val.minute, > val.second + val.msecond / 1000.0) > else: > return val > > def _extract_row(bufs, n): > '''Extract a row tuple from buffers. > ''' > row = [None] * len(bufs) > col = 0 > for buf in bufs: > --->>>> row[col] = _column_value(buf[n]) <----- ERROR HERE > col = col + 1 > return tuple(row) > > _______________________________________________ > Python-sybase mailing list > Pyt...@ww... > https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase -- Paul Rensing <pau...@ve...> |
From: Bradley F. <br...@re...> - 2005-09-08 16:24:15
|
Dave: I've been working with the Sybase module (latest version) and have run = into a snag in dealing with very precise datetime values. In my case, I = need to preserve a Full datetime value **including milliseconds** and pass it on = to the database. I'm using the following code: sSubmit =3D str(datetime.datetime.now()) dtSubmit =3D Sybase.datetime(sSubmit) This produces a DateTimeType object, but the msecond value is always = zero. It seems to get everything else correctly It seemed like a silly parsing bug, so I tried a work around, grabbing = the milliseconds myself and trying to set them with: dtSubmit.msecond =3D 349499 (whatever) But this turned into a "TypeError: readonly attribute" exception So now I'm stuck. Have you or anyone else got a workaround .... Or a = quick fix? Is there a non-string way of creating a DateTimeType? Don't see anything else in the docs. Many thanks in advance! *Bradley |
From: Adam H. <ad...@de...> - 2005-08-31 05:53:37
|
I had a hell of a time getting python-sybase working on x86-64, and I ended up with only a workaround, so I thought I'd ask for the proper fix on the mailing list. The problem begins in servermsg_cb in ctx.c -- and so an exception is triggered on the very first command to interact with the server (ct_connect()). Coming into servermsg_cb(), cs_msg is a valid CS_SERVERMSG struct, with msgnumber =3D=3D 5701 ("Database context switched to 'blah'"). After the memmove() on line 315 (I'm using python-sybase 0.37), server_msg->msg.msgnumber =3D=3D 5701, still. Then comes the Py_BuildValue(= ) (which I don't understand too well, I'm no Python-C API expert), and finally call_callback() is called, which calls _servermsg_cb() in Sybase.py. The first line is: mn =3D msg.msgnumber However, msg.msgnumber =3D=3D 8589940293L ! If I ignore that error and proceed, the very next server message (a database switch, since I pass 4 arguments to Sybase.connect()), comes back with msg.msgnumber =3D=3D 4294972997L. For some reason, Python is using more bits than it needs. 8589940293L =3D= =3D 2**33 + 5701, and 4294972997L =3D=3D 2**32 + 5701. My workaround is to change the line in Sybase.py:_servermsg_cb() to: mn =3D msg.msgnumber % 2**32 Now everything seems to work perfectly! Yay! However, that's obviously not the proper solution. Can anybody see what's wrong? Has anybody else gotten python-sybase working on amd64? --=20 Adam Hooper <ad...@de...> |
From: Bradley F. <br...@re...> - 2005-08-30 14:04:54
|
Does not seem so.... Anyone have any ideas for a quick patch? Right now I'm typecasting back done to int type (4 byte). Thanks, *Bradley Here's the traceback: File "/usr/lib/python2.4/site-packages/Sybase.py", line 392, in start return _FetchNow.start(self, arraysize) File "/usr/lib/python2.4/site-packages/Sybase.py", line 324, in start self._row_result() File "/usr/lib/python2.4/site-packages/Sybase.py", line 345, in _read_result while _fetch_rows(self._cmd, bufs, logical_result): File "/usr/lib/python2.4/site-packages/Sybase.py", line 267, in _fetch_rows rows.append(_extract_row(bufs, 0)) File "/usr/lib/python2.4/site-packages/Sybase.py", line 242, in _extract_row row[col] = _column_value(buf[n]) TypeError: unknown data format --- def _column_value(val): if use_datetime and type(val) is DateTimeType: return DateTime.DateTime(val.year, val.month + 1, val.day, val.hour, val.minute, val.second + val.msecond / 1000.0) else: return val def _extract_row(bufs, n): '''Extract a row tuple from buffers. ''' row = [None] * len(bufs) col = 0 for buf in bufs: --->>>> row[col] = _column_value(buf[n]) <----- ERROR HERE col = col + 1 return tuple(row) |
From: Richard H. <rho...@ho...> - 2005-08-23 13:12:13
|
Hello, we have some developers at my firm who are using the Python Sybase drivers. They like it, the drivers are working well, but it seems to grab a Giant Lock (Global Interpreter Lock) when it runs. Are there any plans to get multi-threading enabled? Thank you. |