electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 10cfda8465cc63fb06b59b659732cc3d28640253
parent 439bc61a2c0102f28010a203fb60888908e4eba7
Author: ThomasV <thomasv@gitorious>
Date:   Wed, 23 Nov 2011 17:15:10 +0300

sql fix

Diffstat:
Mserver/server.py | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/server/server.py b/server/server.py @@ -60,10 +60,10 @@ peer_list = {} class MyStore(Datastore_class): - def safe_sql(self,sql): + def safe_sql(self,sql, params=()): try: dblock.acquire() - ret = self.selectall(sql) + ret = self.selectall(sql,params) dblock.release() return ret except: @@ -123,8 +123,8 @@ class MyStore(Datastore_class): JOIN txin ON (txin.tx_id = tx.tx_id) JOIN txout prevout ON (txin.txout_id = prevout.txout_id) JOIN pubkey ON (pubkey.pubkey_id = prevout.pubkey_id) - WHERE pubkey.pubkey_hash = '%s' - AND cc.in_longest = 1"""%dbhash) + WHERE pubkey.pubkey_hash = ? + AND cc.in_longest = 1""", (dbhash,)) def get_address_out_rows_memorypool(self, dbhash): return self.safe_sql(""" SELECT @@ -137,7 +137,7 @@ class MyStore(Datastore_class): JOIN txin ON (txin.tx_id = tx.tx_id) JOIN txout prevout ON (txin.txout_id = prevout.txout_id) JOIN pubkey ON (pubkey.pubkey_id = prevout.pubkey_id) - WHERE pubkey.pubkey_hash ='%s' """%(dbhash)) + WHERE pubkey.pubkey_hash = ? """, (dbhash,)) def get_address_in_rows(self, dbhash): return self.safe_sql(""" SELECT @@ -156,8 +156,8 @@ class MyStore(Datastore_class): JOIN tx ON (tx.tx_id = block_tx.tx_id) JOIN txout ON (txout.tx_id = tx.tx_id) JOIN pubkey ON (pubkey.pubkey_id = txout.pubkey_id) - WHERE pubkey.pubkey_hash = '%s' - AND cc.in_longest = 1"""%(dbhash)) + WHERE pubkey.pubkey_hash = ? + AND cc.in_longest = 1""", (dbhash,)) def get_address_in_rows_memorypool(self, dbhash): return self.safe_sql( """ SELECT @@ -169,7 +169,7 @@ class MyStore(Datastore_class): FROM tx JOIN txout ON (txout.tx_id = tx.tx_id) JOIN pubkey ON (pubkey.pubkey_id = txout.pubkey_id) - WHERE pubkey.pubkey_hash = '%s' """%(dbhash)) + WHERE pubkey.pubkey_hash = ? """, (dbhash,)) def get_txpoints(self, addr): version, binaddr = decode_check_address(addr)