*
The fields in the database, apart from the bytea, are being correctly
inserted. The []byte array is being populated and passed but the bytea
field remains empty. The db log file records no error. There are signs that
insert is being carried out twice, once with the correct payload and a
second time with an empty []byte. I have as yet been unable to isolate this
second call if it exists.
// type Attachment
type MsgAttachment struct{
Mattachmentnr sql.NullInt64
Messagefk sql.NullInt64
Aname sql.NullString
Mblob []byte
}
// DML vom db
CREATE TABLE msgattachment
(
mattachnr serial NOT NULL,
messagefk int,
aname text,
ablob bytea
)
//call after declaration and population
msga.InsertAttachment()
func (a MsgAttachment) InsertAttachment() error {
rhediledb, err := sql.Open("postgres", connectString)
if err != nil {
fmt.Println("in InsertAttachment sql.Open failed",
err)
}
defer rhediledb.Close()
stmt, err := rhediledb.Prepare("INSERT INTO msgattachment (
messagefk, aname, ablob) Values($1,$2,$3)")
if err != nil {
fmt.Println("in InsertAttachment prepare error:", err)
}
res, err := stmt.Exec(a.Messagefk, a.Aname, a.Mblob)
if err != nil {
fmt.Println("in InsertAttachment exec error:", res, err)
}
return err
}
*
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.