forum-msg-id-132780-edit

Original date:2018-07-03 09:50:29 Edited by: begin Subject: Re: sqlite interface ?

please exchange in the top code:

-- Return a pointer to the text value (NULL terminated string) of the column specified by its index starting at 0 
public function SQGetText(DbStatement stmt, integer index) 
    atom message_addr = c_func(_sqlite3_column_text, {stmt, index} ) 
    if message_addr then 
      atom len = c_func(_sqlite3_column_bytes, {stmt, index} ) 
      if len= 0 then   -- added 
        return "" 
      end if 
      return peek({message_addr, len}) 
    else 
      return "" 
    end if 
end function 
 
-- Return a pointer to the blob value (*not* NULL terminated) of the column specified by its index starting at 0 
public function SQGetBlob(DbStatement stmt, integer index) 
    atom len = c_func(_sqlite3_column_bytes, {stmt, index}) 
    if len= 0 then   -- added 
        return {} 
    end if 
    atom blobdata = c_func(_sqlite3_column_blob, {stmt, index}) 
    return peek({blobdata, len}) 
end function 
 
-- Return a pointer to the blob value (*not* NULL terminated) of the column specified by its index starting at 0 
public function SQGetPhixBlob(DbStatement stmt, integer index) 
    sequence s0 = {} 
    atom len = c_func(_sqlite3_column_bytes, {stmt, index}) 
    if len= 0 then   -- added 
        return {} 
    end if 
    atom blobdata = c_func(_sqlite3_column_blob, {stmt, index}) 
    if blobdata then 
       sequence s = peek({blobdata, len}) 
       s0 = deserialize(s) 
    end if 
    return s0 
end function 
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu