help-octave
[Top][All Lists]
Advanced

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

Re: SQLITE with Octave


From: Przemek Klosowski
Subject: Re: SQLITE with Octave
Date: Wed, 10 May 2017 14:53:26 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0

On 05/10/2017 11:50 AM, FMourad wrote:
Hello everybody, 

I have browsed all the topics related to the use of sqlite on octave without
finding a clear solution to my situlation. 
According to the following octave wiki :
http://wiki.octave.org/Database_package , two github repositories can be
exploited as sqlite wrappers on octave, but my attemps to use these projects
were unsuccessful. 
These are the links to the repositories : 
•https://github.com/rmartinjak/mex-sqlite3https://github.com/Andy1978/octave-sqlite
Well, git log shows that the first one was last worked on in 2014 and the second one in 2016. Neither seems to compile at the moment, but the second one seems a better bet, just because it IS a little more recent, and it currently has a silly fail on a test code:

cl_sqlite3_handler.cc: In member function ‘void sqlite3_handler::testme()’:
cl_sqlite3_handler.cc:198:24: error: no matching function for call to ‘Matrix::assign(int, int, int, int)’
   a.assign (5,5,123,666)

I just commented this line out and the code seems to compile and work on its own tests, but crashes on my simple database.

So, two issues:

1) compilation: in the a.assign() code above, how should the assigned params be passed? The most promising match seems to be :

usr/include/octave-4.0.3/octave/../octave/Array.h:545:8: note: candidate: void Array<T>::assign(const idx_vector&, const idx_vector&, const Array<T>&, const T&) [with T = double]
   void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rhs,
        ^~~~~~
/usr/include/octave-4.0.3/octave/../octave/Array.h:545:8: note:   no known conversion for argument 3 from ‘int’ to ‘const Array<double>&’

2) I get a runtime crash on a simple database whose schema is  CREATE TABLE t (time,tempc);

octave:2> a = sqlite3 ("temp.db");
sqlite3_handler::open temp.db create=0
sqlite3_handler C'Tor
sqlite3_handler C'Tor
octave:3> exec_sql (a, "SELECT * from t;")

sqlite3_handler::exec_sql sql=SELECT * from t;
numel per bind param = 0
sqlite3_prepare_v2 returned SQLITE_OK
SQLITE_ROW sqlite3_column_count()=2
SQLITE_ROW sqlite3_data_count()=2
column 0 has type code 3
column 1 has type code 1
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
panic: Aborted -- stopping myself...
attempting to save variables to 'octave-workspace'...
error: octave_base_value::save_binary(): wrong type argument 'sqlite3_handler'
save to 'octave-workspace' complete
Aborted (core dumped)


reply via email to

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