[sqlite] issue on blob
Hi all. Can you determine in the blob's data what is buffered file type and what was its original length? Obviously the solution to store the blob on a files would be too easy and I do not like it. Workaround? -- Fabio Spadaro www.fabiospadaro.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] issue on blob
Fabio Spadaro fabiolinos...@gmail.com wrote: Can you determine in the blob's data what is buffered file type and what was its original length? You retrieve the size of the BLOB field with sqlite3_column_bytes function, or with length() function in SQL. I'm not familiar with the term buffered file type. SQLite certainly doesn't store any such thing in the BLOB column. If you need to track some kind of metadata about your BLOB, store it yourself in additional columns in the same row. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] issue on blob
HI, 2010/9/9 Igor Tandetnik itandet...@mvps.org Fabio Spadaro fabiolinos...@gmail.com wrote: Can you determine in the blob's data what is buffered file type and what was its original length? You retrieve the size of the BLOB field with sqlite3_column_bytes function, or with length() function in SQL. I'm not familiar with the term buffered file type. SQLite certainly doesn't store any such thing in the BLOB column. If you need to track some kind of metadata about your BLOB, store it yourself in additional columns in the same row. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users I use DB-API 2.0 interface for SQLite databases for python and seems that there is not a function equivalent or wrong? -- Fabio Spadaro www.fabiospadaro.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] issue on blob
Fabio Spadaro fabiolinos...@gmail.com wrote: 2010/9/9 Igor Tandetnik itandet...@mvps.org Fabio Spadaro fabiolinos...@gmail.com wrote: Can you determine in the blob's data what is buffered file type and what was its original length? You retrieve the size of the BLOB field with sqlite3_column_bytes function, or with length() function in SQL. I use DB-API 2.0 interface for SQLite databases for python and seems that there is not a function equivalent or wrong? A quick glance at the documentation indeed suggests that there's no way to obtain the length of the BLOB without completely reading the BLOB itself. A .fetchone() method would give you a tuple with column values, including BLOBs, and you can use Python's built-in len() function to determine the length of the BLOB. If this is undesirable, e.g. for performance reasons, you can run a query like this: select length(MyBlobColumn); -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users