|
From: James R. <jcr...@ya...> - 2003-09-28 20:43:03
|
--- Ian Bicking <ia...@co...> wrote:
> I sent this to James, but then I though Ian or
> someone else might want
> to look at these.
I got it, thanks.
> Currently these are the known issues. James may
> have fixes for some of
> these that I lost.
>
> * kinterbasdb seems to rollback if you don't
> explicitly commit. I
> don't think there's any autocommit mode, which is
> how a lot of the
> tests are meant to be run. I've had this problem
> with SQLite as well,
> I think.
I haven't run the test suite in the "mostly live"
version within the last two weeks. But, when I
changed the supportTransaction attribute in
FirebirdConnection to true, but set the
SQLObjectTest.supportTransaction to false, many of the
test failures went away. Go figure.
FB wants to put everything in a transaction (even a
select).
> Anyway, I think if _runWithConnection does a
> begin/commit, that should
> simulate autocommit, but I was getting problems with
> that. So now it
> tries to begin/commit but ignores errors. It's
> dumb. Maybe you have a
> better idea.
Because it's so transactional, my idea (which I don't
even like) is to add (some sort of) a
requiresTransaction logic to SO.
> * NamesTest doesn't create the table correctly. Is
> "names" a reserved
> word?
Yes.
> * DeleteSelectTest gives an odd error, "Cursor
> unknown". Not sure
> what's up with that.
That particular error is new to the cvs version (it
worked fine in .4). I think when the _iterSelect
added the 'yield' call, things went wierd.
>
> * ValidationText, I get a bunch of 'conversion error
> from string
> "BLOB".'
That error (while cryptic) is caused by FB not doing a
implicit convert for an int value sent (by the
Validator). If you change the 'default' value (kw arg
in test.py to '100' instead of just 100) that one
should go away also.
> * SliceTest -- I think you had some changes with
> this which I may have
> missed in the files you sent me.
The changes were in DBConnection.py. Since FB puts
the limit clause directly after the 'select'
statement, I had to change a couple of your calls (see
below):
def queryForSelect(self, select):
ops = select.ops
cls = select.sourceClass
if ops.get('lazyColumns', 0):
q = "SELECT %s.%s FROM %s WHERE " % \
(cls._table, cls._idName,
", ".join(select.tables))
else:
q = "SELECT %s.%s, %s FROM %s WHERE " % \
(cls._table, cls._idName,
", ".join(["%s.%s" % (cls._table,
col.dbName)
for col in
cls._SO_columns]),
", ".join(select.tables))
########### changes start###################
select.selectBegin = q
return self.whereClauseForSelect(select)
############changes end######################
def whereClauseForSelect(self, select, limit=1,
order=1):
q = str(select.clause)
ops = select.ops
def clauseList(lst, desc=False):
if type(lst) not in (type([]), type(())):
lst = [lst]
lst = [clauseQuote(i) for i in lst]
if desc:
lst = [SQLBuilder.DESC(i) for i in
lst]
return ', '.join([SQLBuilder.sqlRepr(i)
for i in lst])
def clauseQuote(s):
if type(s) is type(""):
if s.startswith('-'):
desc = True
s = s[1:]
else:
desc = False
assert SQLBuilder.sqlIdentifier(s),
"Strings in clauses are expected to be column
identifiers. I got: %r" % s
if
select.sourceClass._SO_columnDict.has_key(s):
s =
select.sourceClass._SO_columnDict[s].dbName
if desc:
return
SQLBuilder.DESC(SQLBuilder.SQLConstant(s))
else:
return SQLBuilder.SQLConstant(s)
else:
return s
if order and ops.get('groupBy'):
q = "%s GROUP BY %s" % (q,
clauseList(ops['groupBy']))
if order and ops.get('dbOrderBy'):
q = "%s ORDER BY %s" % (q,
clauseList(ops['dbOrderBy'], ops.get('reversed',
False)))
start = ops.get('start', 0)
end = ops.get('end', None)
#####################changes start#############
if hasattr(select, 'selectBegin'):
q = ' '.join([select.selectBegin, q])
#####################changes end ##############
if limit and (start or end):
# @@: Raising an error might be an
annoyance, but some warning is
# in order.
#assert ops.get('orderBy'), "Getting a
slice of an unordered set is unpredictable!"
q = self._queryAddLimitOffset(q, start,
end)
return q
I will double check all of this against the latest
version.
James
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
|