[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving symbolic variables in a database

From: diego9j
Subject: Re: Saving symbolic variables in a database
Date: Fri, 11 Mar 2016 17:55:26 -0800 (PST)

Colin Macdonald-2 wrote
> Following is undocumented: I might break it anytime...  Either
> `sym(char(x))` or `sym(x.pickle)` should both restore x.  So you can
> save the string `x.pickle` to your database, then pass it through sym it
> on load...

This is exactly what I needed, lots of thanks Colin!  This avoids using
octave's save/load commands and all the parsing problems. Also, I think that
saving a string is way more elegant than saving <binary data>.

Olaf Till-2 wrote
> I wasn't aware of the "-" feature of 'save', it seems to be a new
> addition, specific to Octave. But as I see it, there might be some
> issues:
> - Saving "-binary" into a string seems not the right thing to me,
>   e.g. it will break if the binary data contains a zero byte. Maybe
>   better if Octave would save into an uint8-array if saving binary?
> - A 'symmetric' operation -- loading from a variable -- should be
>   provided, but seemingly isn't currently available.
> I don't quite understand your item '1 - I found no function to parse
> back from 8-bit to binary' -- char() would convert from uint8 back to
> a string, but I don't see that this would help you.

I don't know if it's because of my inexperience, but Octave's file and
variable I/O is terrible. I skimmed through octave-forge packages and I
found none extending the I/O functionalities. I guess that it's something
that could be done, if someone wanted to take that project.

Furthermore, most of the "binary data parsing" that I proposed in the main
message makes no sense. I was just testing things to avoid the lack of bytea
type in octave (which makes no sense by the way, why can octave return
binary data but not in binary variable type?)

Olaf Till-2 wrote
> It's nice to see someone using the database package. But it wasn't
> designed to store _arbitrary_ Octave variables into a database. But if
> there really is such a need, maybe the database package itself should
> provide a way, as long as there is no satisfying possibility with
> Octaves save/load. Some functions like 'var2bytea' and
> 'bytea2var'. I'd guess I could add these within a few days, if really
> necessary ...

Those two functions seem appropiate additions to the package since it would
add lots of compatibility between octave forge packages. My problem is
solved but other people could use them...

Olaf Till-2 wrote
> I didn't hear anything again from you, but the functions suggested
> above are now added to 'database', see function documentation. A new
> package release still must wait a bit, tell me if you should urgently
> need this functionality but need help in accessing the code
> repository.

Are those functions 'var2bytea' and 'bytea2var'? If so, that's really nice.
I don't need them urgently, but will check the function reference from time
to time to see when the new package release is public :)

View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]