Post
Topic
Board Electrum
Re: Electrum server discussion thread
by
ajze
on 23/06/2012, 02:00:36 UTC
I already updated Abe yesterday. Will give it a try though.

Edit: No dice, seems this commit might have something to do with it since it errors on this column.

indeed. I removed the call to new_id() because it was creating a new id.
however, the request might not work on all databases. (I use postgresql)

There is no last_value on MySQL as far as I am aware. Would it be possible to replace:

Code:
       current_id = self.safe_sql("""SELECT last_value FROM tx_seq""")
        current_id = current_id[0][0]

With

Code:
        current_id = self.safe_sql("""SELECT * FROM tx_seq ORDER BY id DESC LIMIT 1""")
        current_id = current_id[0][0]

Since my server crashes I can't be sure what current_id is returning on Postgre.

This is the same bug I'm getting.  I didn't even realize that PostgreSQL was an option.  If you're trying to support several different databases, you might want to consider a database abstraction layer, such as ADOdb.  It will make things much easier for you.

As a temporary solution something like this should be compatible with both:

Code:
        current_id = self.safe_sql("""SELECT max(id) FROM tx_seq""");

If the table is indexed properly, it should be just as fast, too.  I'll try it on my node later and let you know how it works.