[DB-SIG] DbiDate testing for None

js@ac-copy.com js@ac-copy.com
Wed, 4 Mar 1998 17:31:46 +0100


|> 
|> This also happens on linux with adabas using mxODBC.
|> 
|
|Ouchh. This nb_nonzero-slot of the numeric protocol is not NULL
|checked when doing a PyObject_IsTrue()-call with a DateTime
|instance: that's what causes it to fail for mxODBC.
|
|I'll provide that slot in the next release of mxDateTime.
|Since you only wanted to check for None, this method might
|help:
|
|value,date = c.fetchone()
|if date is None:
|	print 'Now what... ?'
|else:
|	print 'OK'
|
|It avoids the 'is true' check (it only checks for identity
|which works in this case since None is a singleton).
|
|PS: Could it be that the odbc DbiDate has the same problem ?
|
There seem to be some serious memory problems with mxODBC and DbiDate.
unfortunately I can't include an example cause it's part of a large program,
but here is the code fragment:

         self.cursor.execute(queryst,tuple(data))
	 self.db.commit()
	 print self.table,str(self.addmes)
	 self.dialog = Pmw.MessageDialog(self.parent, title = 'Add Info',
	               text = "Record in " + self.table + " hinzugefügt",
		       bitmap = 'info',
		       command = self.addmes,
		       buttons = (AddMode_c,BrowseMode))  

This works with the printstatement uncommented, when I comment it out, I get
an error message from the Pmw.MessageDialog-call. 

Here is the querystring:

insert into ImmoAuftrag(
KundenNr,
Verkaeufer,
Auftrag_Nr,
Angebot_Datum,
Angebot_Betrag,
Text_aus,
Anz_Fotos,
Auftrag_Datum,
Auftrag_Betrag,
Rechnung_Datum,
Rechnung_Betrag,
von,
bis,
Laufzeit,
Bundesland,
Rubrik_1,
Rubrik_2,  
Rubrik_3,
Region,
PLZ,
Ort,
Text,
Kontakt_Text,
Kontakt_Telefon,
Kontakt_Fax,
Grafiken)
 values (
 ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

and here the data:

,Data:  [31867, 'FA', '2082', '1998-03-04', 0.0, '', 0, None, 0.0, None, 0.0,
 None, None, 0, '', '', '', '', '', '', '', '', '', '', '', '']   




Mit freundlichen Grüßen

    Joachim Schmitz

+------------------------------------------------------------------------+
| AC COPY IfD GmbH                             Telefon: 49-2404-908390   |
| Joseph-von-Fraunhofer-Straße 3d              FAX:     49-2404-908399   |
| D-52477 Alsdorf                              e-Mail:  js@ac-copy.com   |
| http://www.ac-copy.com                       ftp://ftp.ac-copy.com     |
+------------------------------------------------------------------------+


-- 
|-- 
|Marc-Andre Lemburg
|

_______________
DB-SIG  - SIG on Tabular Databases in Python

send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org
_______________