16 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
# |
# |
19 |
# Copyright 2000, 2001 Free Software Foundation |
# Copyright 2000-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# msado/DBdriver.py |
# msado/DBdriver.py |
42 |
try: |
try: |
43 |
import win32com.client, pywintypes |
import win32com.client, pywintypes |
44 |
except ImportError, message: |
except ImportError, message: |
45 |
raise GConnections.AdapterNotInstalled, \ |
tmsg = _("Driver not installed: ADO [win32all COMM drivers]\n\n[%s") % message |
46 |
_("Driver not installed: ADO [win32all COMM drivers]\n\n[%s") % message |
raise GConnections.AdapterNotInstalled, tmsg |
47 |
|
|
48 |
|
|
49 |
|
|
217 |
for i in range(0, len(element._children)): |
for i in range(0, len(element._children)): |
218 |
element._children[i] = self.__conditionToSQL(element._children[i]) |
element._children[i] = self.__conditionToSQL(element._children[i]) |
219 |
if len(element._children) < self.conditionElements[otype][0]: |
if len(element._children) < self.conditionElements[otype][0]: |
220 |
raise GConditions.ConditionError, \ |
tmsg = _('Condition element "%s" expects at least %s arguments; found %s') % \ |
|
_('Condition element "%s" expects at least %s arguments; found %s') % \ |
|
221 |
(otype, self.conditionElements[otype][0], len(element._children)) |
(otype, self.conditionElements[otype][0], len(element._children)) |
222 |
|
raise GConditions.ConditionError, tmsg |
223 |
if len(element._children) > self.conditionElements[otype][1]: |
if len(element._children) > self.conditionElements[otype][1]: |
224 |
raise GConditions.ConditionError, \ |
tmsg = _('Condition element "%s" expects at most %s arguments; found %s') % \ |
|
_('Condition element "%s" expects at most %s arguments; found %s') % \ |
|
225 |
(otype, self.conditionElements[otype][0], len(element._children)) |
(otype, self.conditionElements[otype][0], len(element._children)) |
226 |
|
raise GConditions.ConditionError, tmsg |
227 |
if self.conditionElements[otype][3] == None: |
if self.conditionElements[otype][3] == None: |
228 |
return self.conditionElements[otype][2] % tuple(element._children) |
return self.conditionElements[otype][2] % tuple(element._children) |
229 |
else: |
else: |
230 |
return self.conditionElements[otype][2] % \ |
return self.conditionElements[otype][2] % \ |
231 |
(string.join(element._children, self.conditionElements[otype][3])) |
(string.join(element._children, self.conditionElements[otype][3])) |
232 |
else: |
else: |
233 |
raise GConditions.ConditionNotSupported, \ |
tmsg = _('Condition clause "%s" is not supported by this db driver.') % otype |
234 |
_('Condition clause "%s" is not supported by this db driver.') % otype |
raise GConditions.ConditionNotSupported, tmsg |
235 |
|
|
236 |
# Code necessary to force the connection into transaction mode... |
# Code necessary to force the connection into transaction mode... |
237 |
# this is usually not necessary (MySQL is one of few DBs that must force) |
# this is usually not necessary (MySQL is one of few DBs that must force) |