[Zope-CVS] CVS: Products/AdaptableStorage/gateway_sql - SQLClassification.py:1.7 SQLFolderItems.py:1.7 SQLItemId.py:1.6 SQLKeychainGenerator.py:1.5 SQLObjectData.py:1.4 SQLProperties.py:1.3 SQLSecurityAttributes.py:1.2 SQLUserList.py:1.5
Shane Hathaway
shane@zope.com
Tue, 4 Mar 2003 23:06:15 -0500
Update of /cvs-repository/Products/AdaptableStorage/gateway_sql
In directory cvs.zope.org:/tmp/cvs-serv22482
Modified Files:
SQLClassification.py SQLFolderItems.py SQLItemId.py
SQLKeychainGenerator.py SQLObjectData.py SQLProperties.py
SQLSecurityAttributes.py SQLUserList.py
Log Message:
Updated the SQL gateways to consistently use longs for OIDs. There was a
lurking bug that gave objects different OIDs in different ZODB connections
because sometimes the key was an integer and sometimes it was a long.
Fixed.
=== Products/AdaptableStorage/gateway_sql/SQLClassification.py 1.6 => 1.7 ===
--- Products/AdaptableStorage/gateway_sql/SQLClassification.py:1.6 Fri Jan 10 11:08:20 2003
+++ Products/AdaptableStorage/gateway_sql/SQLClassification.py Tue Mar 4 23:06:06 2003
@@ -53,7 +53,7 @@
return self.schema
def load(self, event):
- key = int(event.getKeychain()[-1])
+ key = long(event.getKey())
items = self.execute(self.read_sql, 1, key=key)
classification = {}
if items:
@@ -67,7 +67,7 @@
return classification, rec
def store(self, event, classification):
- key = int(event.getKeychain()[-1])
+ key = long(event.getKey())
items = self.execute(self.read_sql, 1, key=key)
mt = classification.get('meta_type', '')
cn = classification.get('class_name', '')
=== Products/AdaptableStorage/gateway_sql/SQLFolderItems.py 1.6 => 1.7 ===
--- Products/AdaptableStorage/gateway_sql/SQLFolderItems.py:1.6 Fri Jan 10 11:08:20 2003
+++ Products/AdaptableStorage/gateway_sql/SQLFolderItems.py Tue Mar 4 23:06:06 2003
@@ -58,17 +58,17 @@
def load(self, event):
keychain = event.getKeychain()
- key = int(keychain[-1])
+ key = long(keychain[-1])
prefix = keychain[:-1]
rows = self.execute(self.read_sql, 1, key=key)
rows.sort()
- res = [(row[0], prefix + (row[1],)) for row in rows]
+ res = [(row[0], prefix + (long(row[1]),)) for row in rows]
return res, tuple(res)
def store(self, event, state):
keychain = event.getKeychain()
keychain1 = keychain[:-1]
- key = int(keychain[-1])
+ key = long(keychain[-1])
state_dict = {}
for name, child_keychain in state:
state_dict[name] = 1
@@ -88,11 +88,11 @@
if child_keychain[:-1] != keychain1:
raise RuntimeError(
"SQLFolderItems cannot store cross-domain references")
- child_key = int(child_keychain[-1])
+ child_key = long(child_keychain[-1])
kw = {'key': key, 'name': name, 'child_key': child_key}
if db_dict.has_key(name):
if db_dict[name] != child_key:
- # Change the OID of this item.
+ # Change this item to point to a different OID.
self.execute(self.update_sql, **kw)
else:
# Add this item to the database.
=== Products/AdaptableStorage/gateway_sql/SQLItemId.py 1.5 => 1.6 ===
--- Products/AdaptableStorage/gateway_sql/SQLItemId.py:1.5 Tue Dec 31 16:47:45 2002
+++ Products/AdaptableStorage/gateway_sql/SQLItemId.py Tue Mar 4 23:06:06 2003
@@ -40,7 +40,7 @@
return self.schema
def load(self, event):
- key = int(event.getKeychain()[-1])
+ key = long(event.getKey())
rows = self.execute(self.read_sql, 1, child_key=key)
assert len(rows) >= 1
name = rows[0][0] # Other names will be ignored
=== Products/AdaptableStorage/gateway_sql/SQLKeychainGenerator.py 1.4 => 1.5 ===
--- Products/AdaptableStorage/gateway_sql/SQLKeychainGenerator.py:1.4 Tue Dec 31 16:47:45 2002
+++ Products/AdaptableStorage/gateway_sql/SQLKeychainGenerator.py Tue Mar 4 23:06:06 2003
@@ -45,5 +45,5 @@
n = event.getKeyedObjectSystem().newKey()
else:
n = self.execute(self.read_sql, 1)[0][0]
- return event.getKeychain()[:-1] + (n,)
+ return event.getKeychain()[:-1] + (long(n),)
=== Products/AdaptableStorage/gateway_sql/SQLObjectData.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/gateway_sql/SQLObjectData.py:1.3 Fri Jan 10 11:08:20 2003
+++ Products/AdaptableStorage/gateway_sql/SQLObjectData.py Tue Mar 4 23:06:06 2003
@@ -52,7 +52,7 @@
return self.schema
def load(self, event):
- key = int(event.getKeychain()[-1])
+ key = long(event.getKey())
items = self.execute(self.read_sql, 1, key=key)
if items:
state = items[0][0]
@@ -61,7 +61,7 @@
return state, state
def store(self, event, state):
- key = int(event.getKeychain()[-1])
+ key = long(event.getKey())
items = self.execute(self.read_sql, 1, key=key)
kw = {'key': key, 'data': self.conn.asBinary(state)}
if items:
=== Products/AdaptableStorage/gateway_sql/SQLProperties.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/gateway_sql/SQLProperties.py:1.2 Fri Jan 10 11:08:20 2003
+++ Products/AdaptableStorage/gateway_sql/SQLProperties.py Tue Mar 4 23:06:06 2003
@@ -60,13 +60,13 @@
return self.schema
def load(self, event):
- key = int(event.getKeychain()[-1])
+ key = long(event.getKey())
items = self.execute(self.read_sql, 1, key=key)
items.sort()
return items, tuple(items)
def store(self, event, state):
- key = int(event.getKeychain()[-1])
+ key = long(event.getKey())
items = self.execute(self.read_sql, 1, key=key)
state_dict = {}
for row in state:
=== Products/AdaptableStorage/gateway_sql/SQLSecurityAttributes.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/gateway_sql/SQLSecurityAttributes.py:1.1 Sat Mar 1 15:43:00 2003
+++ Products/AdaptableStorage/gateway_sql/SQLSecurityAttributes.py Tue Mar 4 23:06:06 2003
@@ -59,13 +59,13 @@
return self.schema
def load(self, event):
- key = int(event.getKey())
+ key = long(event.getKey())
items = self.execute(self.read_sql, 1, key=key)
items.sort()
return items, tuple(items)
def store(self, event, state):
- key = int(event.getKey())
+ key = long(event.getKey())
items = self.execute(self.read_sql, 1, key=key)
items.sort()
state = list(state)
=== Products/AdaptableStorage/gateway_sql/SQLUserList.py 1.4 => 1.5 ===
--- Products/AdaptableStorage/gateway_sql/SQLUserList.py:1.4 Fri Jan 10 11:08:20 2003
+++ Products/AdaptableStorage/gateway_sql/SQLUserList.py Tue Mar 4 23:06:06 2003
@@ -149,7 +149,7 @@
def store(self, event, state):
keychain = event.getKeychain()
keychain1 = keychain[:-1]
- key = int(keychain[-1])
+ key = long(keychain[-1])
old_rows, old_serial = self.load(event)
new_dict = {}
for rec in state: