[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Relational Database Connectivity
webmaster@zope.org
webmaster@zope.org
Fri, 15 Nov 2002 23:04:58 -0500
A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/RelationalDatabases.stx#3-26
---------------
The items in the sequence of results returned by a Z SQL Method
are called *Result objects*. Result objects can be thought of
as rows from the database table turned into Zope objects. These
objects have attributes that match the schema of the database
results.
% Anonymous User - Aug. 14, 2002 1:24 pm:
A useful tip is that you can access the column headings of your database table by calling <results
object>.names()
% Anonymous User - Sep. 28, 2002 6:10 am:
what a zsql method really returns (the Result object) is a mystery;
for use in python read
http://www.zope.org/Members/spinwing/ZSQL_Results
for dtml, zsql method automatically returns this dictionary,
which is a pythonized table,
namely a list of dictionarys, one for each row,
each row dictionary w columnnames as keys like {colname1:val1, colname2:val2,...}
% Anonymous User - Sep. 28, 2002 6:19 am:
/The items in the sequence of results returned by a Z SQL Method are called Result objects/
No.
A ZSQL Method returns a *Result object*, which has methods names(), data_dictionary() and dictionaries(), the
last having above described structure.
blf
% Anonymous User - Nov. 15, 2002 11:03 pm:
Another piece of information missing is that if you have a filed in your database (I used mysql) of type
datetime then the returned object for this particular filed is of type DateTime and not a string.
% Anonymous User - Nov. 15, 2002 11:04 pm:
Another piece of information missing is that if you have a field in your database (I used mysql) of type
datetime then the returned object for this particular field is of type DateTime and not a string.