[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-db-sig
Subject:    [DB-SIG] Insert Problem solved, one question please reply
From:       mal () egenix ! com (M ! -A !  Lemburg)
Date:       2004-10-21 11:30:30
Message-ID: 417781B4.4030204 () egenix ! com
[Download RAW message or body]

Marcos S?nchez Provencio wrote:
> I suppose mx.ODBC will deal very well with mx.DateTime parameters...

Indeed it does :-)

mxODBC will take mxDateTime objects, tuples, floats and strings
as input for date/time fields.

If you choose strings you have to be aware that the database will
have to parse the date/time representation your are using. This
will often fail in one way or another, even if you stick to
ISO date/time formats, so using one of the other possibilities
is usually the safer way to go.

> Khawaja Shahzad Sadiq escribi?:
> 
>> Hi ,
>>                       I configured out the problem with sql insert
>> with mxODBC.
>> I use this statement.
>> areaI = "INSERT INTO rss_feed_items
>> (item_title,item_author,item_permalink,item_description) VALUES
>> (?,?,?,?)"
>>   c2 = db.cursor()
>>   c2.execute(areaI, (feed_item_title , item_author, feed_item_link,
>> feed_item_feeddescription_utf8))
>>   db.commit()
>>
>> The problem was date and time variable for which i used ? SQL  gave 
>> error of:
>> item_dmodified
>> if use it in above query. I get this error:
>>
>> DataError: ('22005', 0, '[Microsoft][ODBC SQL Server Driver]Invalid
>> character value for cast specification', 4579)
>>
>> Since i am getting the date and time in raw format from rss file and
>> converting it into string like this:
>>
>> s=item_dmodified
>> zs=email.Utils.mktime_tz(email.Utils.parsedate_tz(s))
>> item_dmodified = time.strftime('%m-%d-%Y  %H:%M', time.localtime(zs));
>> Tue, 19 Oct 2004 19:27:33 GMT -> 10/19/2004 6:00:00 AM
>>
>> the targe filed item_date in MS SQL server is small date and time.
>>
>> If i do separate query string for item_date it works but it goes into
>> next row not with and i want to insert it 1 single query. I have both
>> mxODBC base and commercial.
>>
>> Please tell me what should i do? Thanks for your help and suggestion.
>> I hope you would help.
>>
>>  
>>
> 
> _______________________________________________
> DB-SIG maillist  -  DB-SIG@python.org
> http://mail.python.org/mailman/listinfo/db-sig

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Oct 21 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic