Hi guys.
I have to insert in a table an integer, one binary file
(*.wav) and another text file (*.txt) (3 fields)
This code insert the user "id" but in the "vector" and
"voicefile" fields jut insert the variable name
$vector" and "$voicefile", not the content of this
variables.
What's the problem?.
-------------------------
set fvector [open "tmpwave.mfcc"]
set fvoicefile [open "tmpwave.wav"]
set vector [read $fvector]
set voicefile [read $fvoicefile]
set table "FEATURES"
set lste [list "ID_USERS" "VECTOR" "VOICEFILE"]
SqlInsert fdb "idstmt" $table $lste
idstmt $iduser $vector $voicefile
proc SqlParams {columns {separator { AND }} {assign yes}} {
foreach i $columns {
if {$assign} {
lappend marks ${i}=?
} else {
lappend marks ?
}
}
return [join $marks $separator]
}
proc ColTypes {db table cols}
set coldefs [$db columns $table]
foreach i $coldefs {
set colname [string tolower [lindex $i 3]]
set coltype($colname) [list [lindex $i 4]
[lindex $i 6]]
# precision may be empty for certain datatypes
if {[lindex $i 8] != {}} {
lappend coltype($colname) [lindex $i 8]
}
}
foreach i $cols {
lappend coltypes $coltype([string tolower $i])
}
return $coltypes
}
proc SqlInsert {db stmt table columns {mode eval}} {
set sql "INSERT INTO $table ([join $cols ,]) VALUES
([SqlParams $cols , no])"
set coltypes [ColTypes $db $table $cols]
$mode "$db statement $stmt \{$sql\} \{$coltypes\}"
}
Thank's in advanced.