Closed myfirmapp closed 7 years ago
So after following the discussion from the link above i managed to make it work by using
let savedData = try! conn.execute("INSERT INTO files (filename,file) VALUES ($1,$2)",[fileName.makeNode(in: nil),StructuredData.bytes(bytesfroms)])
Hello
I am trying to save data (formed from an NSAttributedString) to a bytea field.
As a test i try to save a string and retrieve it.
Here is my code:
`
let s = "Une string".data(using: .utf8)!
Sa far as i test i can see that my string is transformet into Data and i can retrieve it before saving.
I save it in the database (the bytea field says BINARY (39 bytes).
When i tried to retrieve my string from the database i do:
`let results = try! conn.execute("SELECT filename,file FROM files ORDER BY id")
` The result is:
I expect to see String: Optional("Une string")
What i am doing wrong with the Node ?