2012-02-28 20 views
1

おそらくサポートされていないタイプの私はsqlite3のPythonモジュールを使用していますし、コードを以下の目、私はすでに、通常の(非ユニコード)文字列で試してみましたし、結果はエラーsqliteのInterfaceError:エラーがパラメータ0バインディング -

InterfaceError: Error binding parameter 0 - probably unsupported type

注意を返します。同じ

# get database cursor 
cur = dbConnection.cursor() 

# create table for prices 
cur.execute(""" 
    create table if not exists 
    prices(time text,      
      mid integer, 
      exid text, 
      selid integer,      
      priceone real, 
      sometext text, 
      price2 real, 
      primary key (time, mid, exid, selid, priceone) 
      foreign key (time, mid, exid, selid) references selection(time, mid, exid,selid))""") 

#insert price 
tuple = (u'20120228153239788135', 104982590, 1, 4764315, 1.99, u'B', 0.07) 
cur.execute("insert into prices values (?,?,?,?,?,?,?)", tuple) 
+0

あなたの投稿されたコードはうまく動作します。副注釈:変数名として組み込みの名前を使用しないようにしてください。 – bernie

答えて

2

このコードはうまく動作します。

ただし、テーブルスキーマを変更しましたか?

create if not exists 

これを追加したので、変更した可能性がありますが、DB(ファイル)はこれ以降更新されていません。

また、タイプがテキストであっても、exidのintを渡しています。それは自動的に変換されますが、それでもやらないでください。

関連する問題