summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 583c4b4)
raw | patch | inline | side by side (parent: 583c4b4)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 24 Sep 2002 01:59:28 +0000 (01:59 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 24 Sep 2002 01:59:28 +0000 (01:59 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1219 57a73879-2fb5-44c3-a270-3262357dd7e2
index a039f1598d17b0b030c7e1233cecc04846ecc25a..13487985b1edc937a7652ea9a97b7d0460b165fa 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_anydbm.py,v 1.84 2002-09-23 00:50:32 richard Exp $
+#$Id: back_anydbm.py,v 1.85 2002-09-24 01:59:28 richard Exp $
'''
This module defines a backend that saves the hyperdatabase in a database
chosen by anydbm. It is guaranteed to always be available in python
creation = None
if d.has_key('activity'):
del d['activity']
-
self.db.addjournal(self.classname, newid, 'create', d, creator,
creation)
return newid
index 1896c625bf2722438cbbdd82b2ffc489c80d4869..e14a12c6f7f5a9ba4f9367fd8138996461543411 100644 (file)
-# $Id: back_gadfly.py,v 1.25 2002-09-23 06:48:34 richard Exp $
+# $Id: back_gadfly.py,v 1.26 2002-09-24 01:59:28 richard Exp $
__doc__ = '''
About Gadfly
============
return None
raise
+ def sql_fetchall(self):
+ ''' Fetch a single row. If there's nothing to fetch, return [].
+ '''
+ try:
+ return self.cursor.fetchall()
+ except gadfly.database.error, message:
+ if message == 'no more results':
+ return []
+ raise
+
def save_dbschema(self, schema):
''' Save the schema definition that the database currently implements
'''
index e5f64b0a8598ad73d8f33bcb4b87399c69943f8c..2265db6b950781f6242de9003f5f3999e95bbe49 100644 (file)
-# $Id: back_sqlite.py,v 1.4 2002-09-23 06:48:35 richard Exp $
+# $Id: back_sqlite.py,v 1.5 2002-09-24 01:59:28 richard Exp $
__doc__ = '''
See https://pysqlite.sourceforge.net/ for pysqlite info
'''
'''
return self.cursor.fetchone()
+ def sql_fetchall(self):
+ ''' Fetch a single row. If there's nothing to fetch, return [].
+ '''
+ return self.cursor.fetchall()
+
def sql_commit(self):
''' Actually commit to the database.
index f6fe029a64304d6cbc9638dc30594999118f9578..b0eb498b0c0df99ae5fdefe13c49f18edca702d2 100644 (file)
-# $Id: rdbms_common.py,v 1.14 2002-09-23 08:24:51 richard Exp $
+# $Id: rdbms_common.py,v 1.15 2002-09-24 01:59:28 richard Exp $
# standard python modules
import sys, os, time, re, errno, weakref, copy
self.classname, prop, ','.join([a for x in values.keys()])))
sql = '\nintersect\n'.join(tables)
self.db.sql(sql, allvalues)
- try:
- l = [x[0] for x in self.db.cursor.fetchall()]
- except gadfly.database.error, message:
- if message == 'no more results':
- l = []
- raise
+ l = [x[0] for x in self.db.sql_fetchall()]
+ if __debug__:
+ print >>hyperdb.DEBUG, 'find ... ', l
+ return l
+
+ def stringFind(self, **requirements):
+ '''Locate a particular node by matching a set of its String
+ properties in a caseless search.
+
+ If the property is not a String property, a TypeError is raised.
+
+ The return is a list of the id of all nodes that match.
+ '''
+ where = []
+ args = []
+ for propname in requirements.keys():
+ prop = self.properties[propname]
+ if isinstance(not prop, String):
+ raise TypeError, "'%s' not a String property"%propname
+ where.append(propname)
+ args.append(requirements[propname].lower())
+
+ # generate the where clause
+ s = ' and '.join(['_%s=%s'%(col, self.db.arg) for col in where])
+ sql = 'select id from _%s where %s'%(self.classname, s)
+ self.db.sql(sql, tuple(args))
+ l = [x[0] for x in self.db.sql_fetchall()]
if __debug__:
print >>hyperdb.DEBUG, 'find ... ', l
return l