[pypy-svn] r69589 - pypy/trunk/pypy/module/oracle
afa at codespeak.net
afa at codespeak.net
Tue Nov 24 16:15:58 CET 2009
Author: afa
Date: Tue Nov 24 16:15:57 2009
New Revision: 69589
Modified:
pypy/trunk/pypy/module/oracle/interp_cursor.py
pypy/trunk/pypy/module/oracle/interp_variable.py
Log:
The module translates now.
See how many casts to lltype.Signed were needed...
Modified: pypy/trunk/pypy/module/oracle/interp_cursor.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/interp_cursor.py (original)
+++ pypy/trunk/pypy/module/oracle/interp_cursor.py Tue Nov 24 16:15:57 2009
@@ -369,7 +369,7 @@
self.environment.checkForError(
status, "Cursor_GetStatementType()")
- self.statementType = attrptr[0]
+ self.statementType = rffi.cast(lltype.Signed, attrptr[0])
finally:
lltype.free(attrptr, flavor='raw')
@@ -520,29 +520,29 @@
self.environment.checkForError(
status,
"Cursor_ItemDescription(): nullable")
- nullable = attrptr[0] != 0
+ nullable = rffi.cast(lltype.Signed, attrptr[0]) != 0
finally:
lltype.free(attrptr, flavor='raw')
# set display size based on data type
- if varType == interp_variable.VT_String:
+ if varType is interp_variable.VT_String:
displaySize = internalSize
- elif varType == interp_variable.VT_NationalCharString:
+ elif varType is interp_variable.VT_NationalCharString:
displaySize = internalSize / 2
- elif varType == interp_variable.VT_Binary:
+ elif varType is interp_variable.VT_Binary:
displaySize = internalSize
- elif varType == interp_variable.VT_FixedChar:
+ elif varType is interp_variable.VT_FixedChar:
displaySize = internalSize
- elif varType == interp_variable.VT_FixedNationalChar:
+ elif varType is interp_variable.VT_FixedNationalChar:
displaySize = internalSize / 2
- elif varType == interp_variable.VT_Float:
+ elif varType is interp_variable.VT_Float:
if precision:
displaySize = precision + 1
if scale > 0:
displaySize += scale + 1
else:
displaySize = 127
- elif varType == interp_variable.VT_DateTime:
+ elif varType is interp_variable.VT_DateTime:
displaySize = 23
else:
displaySize = -1
@@ -706,7 +706,7 @@
self.environment.checkForError(
status, "Cursor_SetRowCount()")
- self.rowCount = attrptr[0]
+ self.rowCount = rffi.cast(lltype.Signed, attrptr[0])
finally:
lltype.free(attrptr, flavor='raw')
else:
@@ -850,7 +850,8 @@
self.environment.checkForError(
status, "Cursor_InternalFetch(): row count")
- self.actualRows = attrptr[0] - self.rowCount
+ self.actualRows = (rffi.cast(lltype.Signed, attrptr[0])
+ - self.rowCount)
self.rowNum = 0
finally:
lltype.free(attrptr, flavor='raw')
@@ -932,10 +933,12 @@
names_w = []
# process the bind information returned
for i in range(foundElementsPtr[0]):
- if duplicate[i]:
+ if rffi.cast(lltype.Signed, duplicate[i]):
continue
names_w.append(
- w_string(space, bindNames[i], bindNameLengths[i]))
+ w_string(space,
+ bindNames[i],
+ rffi.cast(lltype.Signed, bindNameLengths[i])))
return 0, names_w
finally:
Modified: pypy/trunk/pypy/module/oracle/interp_variable.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/interp_variable.py (original)
+++ pypy/trunk/pypy/module/oracle/interp_variable.py Tue Nov 24 16:15:57 2009
@@ -56,7 +56,7 @@
cursor.environment.checkForError(
status, "Variable_Define(): data size")
- sizeFromOracle = attrptr[0]
+ sizeFromOracle = rffi.cast(lltype.Signed, attrptr[0])
finally:
lltype.free(attrptr, flavor='raw')
@@ -293,7 +293,9 @@
lltype.free(bindHandlePtr, flavor='raw')
def isNull(self, pos):
- return self.indicator[pos] == roci.OCI_IND_NULL
+ return (rffi.cast(lltype.Signed, self.indicator[pos])
+ ==
+ rffi.cast(lltype.Signed, roci.OCI_IND_NULL))
def verifyFetch(self, space, pos):
# Verifies that truncation or other problems did not take place on
@@ -305,7 +307,8 @@
error.code = self.returnCode[pos]
error.message = space.wrap(
"column at array pos %d fetched with error: %d" %
- (pos, self.returnCode[pos]))
+ (pos,
+ rffi.cast(lltype.Signed, self.returnCode[pos])))
w_error = get(space).w_DatabaseError
raise OperationError(get(space).w_DatabaseError,
@@ -423,7 +426,7 @@
def getValueProc(self, space, pos):
offset = pos * self.bufferSize
- length = self.actualLength[pos]
+ length = rffi.cast(lltype.Signed, self.actualLength[pos])
l = []
i = 0
@@ -574,7 +577,7 @@
environment.checkForError(
status,
"NumberVar_PreDefine(): scale")
- scale = attrptr[0]
+ scale = rffi.cast(lltype.Signed, attrptr[0])
finally:
lltype.free(attrptr, flavor='raw')
@@ -590,7 +593,7 @@
environment.checkForError(
status,
"NumberVar_PreDefine(): precision")
- precision = attrptr[0]
+ precision = rffi.cast(lltype.Signed, attrptr[0])
finally:
lltype.free(attrptr, flavor='raw')
@@ -885,7 +888,7 @@
environment.checkForError(
status,
"Variable_TypeByOracleDescriptor(): data type")
- dataType = attrptr[0]
+ dataType = rffi.cast(lltype.Signed, attrptr[0])
finally:
lltype.free(attrptr, flavor='raw')
@@ -904,7 +907,7 @@
environment.checkForError(
status,
"Variable_TypeByOracleDescriptor(): charset form")
- charsetForm = attrptr[0]
+ charsetForm = rffi.cast(lltype.Signed, attrptr[0])
finally:
lltype.free(attrptr, flavor='raw')
More information about the Pypy-commit
mailing list