Example code please



i am currently evaluating scidb but found getting started with the software rather hard because i could not find much easily accessible documentation and example source code;

so my question: is there example/tutorial code for
(1) creating scidb arrays
(2) filling scidb arrays with data
(3) reading back and querying data from scidb arrays to native c++/python data

using the cpp and python client-apis? perhaps from a testsuite?

thanks a lot for the information in advance :wink: & kind regards ch



For C++, you could read src/utils/iquery.cpp - it is, in fact, a c++ app that connects to scidb, sends queries, receives data and outputs it.

For Python - have you taken a look the files in src/capi?
In particular:

Note: there is currently no INSERT statement. To populate arrays with data, you’d have to

  1. create a text file / pipe and then issue load() or input() or
  2. use build()


thank you for your information, i will take a look at the files;

do i understand you correctly that at the moment there is no way to extend arrays with data using the c++/python api?


No, not exactly.
What I meant was that we don’t support insert-like functionality. In Postgres, for example, you could say:

postgres=# insert into foo values(2);

But currently in scidb data has to either come from a file or from a build query. So you’d have to say something like:

iquery -aq "load(evec, '/home/apoliakov/scidb/tests/basic/data/evec.txt')"

Or something more esoteric like:

apoliakov@scalpel:~/workspace/scidb_trunk$ iquery -aq "show(evec)"
[("evec<a:double NOT NULL,empty_indicator:indicator NOT NULL> [x=0:9,10,0,y=0:0,1,0]")]
apoliakov@scalpel:~/workspace/scidb_trunk$ iquery -aq "scan(evec)"
apoliakov@scalpel:~/workspace/scidb_trunk$ iquery -aq "store(merge(evec, build_sparse(evec, iif(x=1,2,0), x=1)),evec)"
apoliakov@scalpel:~/workspace/scidb_trunk$ iquery -aq "scan(evec)"
[[(1,true)],[(2,true)],[(3,true)],[()],[(5,true)],[()],[(7,true)],[()],[(9,true)],[()]] ##value 2 now inserted at position 1

Why did I mention this? Because if you are writing a C++/Python app, the burden is on you to create a data file and then load it. That makes your job slightly harder.
Please see our AFL reference trac.scidb.org/wiki/Docs/Release … uage_11.06 for an overview of exactly how load, store, and build operators work.