[Gambas-user] Hot to load and savbe to DB a binary file (not image either archive strings) (PICCORO McKAY Lenz) (Tobias Boege)

Tobias Boege taboege at ...626...
Mon Jul 15 22:11:14 CEST 2013


On Mon, 15 Jul 2013, PICCORO McKAY Lenz wrote:
> hello tobias, are u a devel of gambas? i could help with documentation
> lacks, i see the pending tasks ...

If you want to help with the documentation - and more importantly: if you
have time to do so -, you should contact Benoit Minisini who'll grant you
write access to the gambasdoc.org site.

> From: Tobias Boege <taboege at ...626...>
> 
> > > but in open line said "file not exits" .. i wish to create the file from
> > > stream.. not open for write
> > So you want to write to it and to create it if it doesn't exist (and it
> > will
> > never exist because of the three lines above):
> > myFinger = Open User.Home &/ ".fprint/0002/00000000/1" For Write Create
> > Note the "Create" keyword at the end of the line. "For Write Create" will
> > also truncate the file to a size of 0 if it exists while opening so the If
> > clause before the Open statement is effectively useless.
> >
> ok its hard to explain but must sure to previous data dont exists and then
> put new data (in this example are same by casuality)
> the binary blob are a unkown file created by finger readers, and my app are
> fault tolerant, i emulated by hand putting the file where app spect to find
> and works prefectly, but i need do that from db, i made the if/kill
> statements for see by step the app work..
> 

I don't really understand your paragraph. Let me make a statement:

---
Dim sPath As String
Dim hFile As Stream

sPath = User.Home &/ ".fprint/0002/00000000/1"
If Exist(sPath) Then
  Kill sPath
Endif
hFile = Open sPath For Write Create
---

This code snippet deletes the file if it exists and then creates a new file
of the same name.

---
Dim sPath As String
Dim hFile As Stream

sPath = User.Home &/ ".fprint/0002/00000000/1"
hFile = Open sPath For Write Create
---

Truncates the file to a size of 0 and opens it - because that's what Create
does if the file already exists.

Effectively you have an empty file in both cases. The second variant just
happens to need less code. That's all I wanted to say.

> 
> > You can find my explanation above in the documentation[0], too.
> >
> yeah.. i see that .. thanks
> 
> > It seems that you are right with the first point, though. I couldn't find
> > any example of how to use files. I'll put that on my schedule...
> >
> i wish to help.. but for now i must finish my app for my job.. i'll explain
> in next lines:
> 
> >
> > > i wish to help and made good apps for business into free
> > > soft, but seems its to hard.. free soft only work in nerd-like and
> > freakers
> > > computers ? please let probe theres not such
> > Wait... You know that this is the gambas-user mailing list, no? By far most
> > attendees here can program in Gambas very well. Do you realise that you
> > asked for help and at the same time called us freaks? (Well you conditioned
> > that "freaks" by whether we can help you or not - which is IMHO even
> > worse.)
> >
> my boss provide me many resources for linux-related support and migration..
> but its hard due time to made that are very little and windo-related docs
> are very often.. i'm the only linux devel in my section and the boss
> dessire migrate but this king of problem are always
> 
> i really need retrieve binary file from db ....
> 
> a question, the store must be also by stream process too?
> 
> *please nee a example to store and retrieve binary files NOT picture files.*

Picture files _are_ binary files. But anyways, to get this thread done, I
have attached a sample project which lets you import and export binary
files of any kind to a local SQLite3 database.

You should look carefully at the export functionality in btnExport_Click()
which selects a record in the database table and saves the corresponding
blob field to a file.

Everything else in the project is just there for you to play around with it.

Regards,
Tobi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: db-blob-0.0.1.tar.gz
Type: application/octet-stream
Size: 6113 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130715/263027a5/attachment.obj>


More information about the User mailing list