Lateef Jackson - 2004-05-28

Schema is only a guess what might be a problem I really have no idea. But the code that is being called is:

q = "INSERT INTO core.sequence (name, value) VALUES('" + self._name + "',1)"
self._con.execute(q)

where self._con is a connection and self._name holds a value.

lateef@linux:~/cvs/web/python> python convert.py
Traceback (most recent call last):
  File "convert.py", line 14, in ?
    cust.create()
  File "/home/lateef/cvs/web/python/cit/core.py", line 73, in create
    self._id = s.getNextValue()
  File "/home/lateef/cvs/web/python/cit/core.py", line 25, in getNextValue
    self.createNewSequence()
  File "/home/lateef/cvs/web/python/cit/core.py", line 39, in createNewSequence
    self._con.execute(q)
  File "/usr/lib/python2.3/site-packages/pdo.py", line 214, in execute
    self.se = SimpleExecute(self, sql_statement)
  File "/usr/lib/python2.3/site-packages/pdo.py", line 412, in __init__
    raise pdo_simple_execute_error, "Simple Execute Error: Database specific Error:" + str(sys.exc_type) + "\n" + str(sys.exc_value)
pdo.pdo_simple_execute_error: "Simple Execute Error: Database specific Error:exceptions.AttributeError\npgdbCursor instance has no attribute 'lastrowid'"

Now if I use params I get a different error:
this code:
q = "INSERT INTO core.sequence (name, value) VALUES('?',?)"
params = []
params.append(self._name)
params.append(1)
self._con.execute(q, params)

I looked at my postgresql log and the query send was
query: INSERT INTO core.sequence (name, value) VALUES('core.Customer',1)

the stack dump:
Traceback (most recent call last):
  File "convert.py", line 14, in ?
    cust.create()
  File "/home/lateef/cvs/web/python/cit/core.py", line 73, in create
    self._id = s.getNextValue()
  File "/home/lateef/cvs/web/python/cit/core.py", line 25, in getNextValue
    self.createNewSequence()
  File "/home/lateef/cvs/web/python/cit/core.py", line 39, in createNewSequence
    self._con.execute(q, params)
  File "/usr/lib/python2.3/site-packages/pdo.py", line 216, in execute
    self.se = ParamExecute(self, sql_statement, paramlist)
  File "/usr/lib/python2.3/site-packages/pdo.py", line 392, in __init__
    raise pdo_param_execute_error, "Paramater-enabled Execute Error: Database specific Error:" + str(sys.exc_type) + "\n" + str(sys.exc_value)
pdo.pdo_param_execute_error: "Paramater-enabled Execute Error: Database specific Error:pgdb.OperationalError\ninternal error in 'INIT'"

This code did not send a query to the database thus I am guessing the "INIT" part of the error. Line 412 and 392 to see if anything is jumping out at me.

Thanks
lhj