Usage of int types

31 views
Skip to first unread message

Pavel Nevezhin

unread,
Sep 7, 2016, 10:43:09 AM9/7/16
to Sophia database
Hi, I have some scheme based on several int keys, like that.
 
sp_setstring(env, "db.test.scheme", "key1", 0);
sp_setstring
(env, "db.test.scheme.key1", "u64,key(0)", 0);
sp_setstring
(env, "db.test.scheme", "key2", 0);
sp_setstring
(env, "db.test.scheme.key2", "u64,key(1)", 0);

Documentation says that I can use it in such way. But when I try to set it.

void *o = sp_document(db);
sp_setint(o, "key1", 42);
sp_setint(o, "key2", 73);

I get an error, sp_setint(document): unsupported operation. Is there another way to do it? 

And i have one more question. Is there way to create autoincrement value? Something like this.

sp_setstring(env, "db.test.scheme", "key", 0);
sp_setstring
(env, "db.test.scheme.key", "string,key(0)", 0);
sp_setstring
(env, "db.test.scheme", "value", 0);
sp_setstring
(env, "db.test.scheme.value", "u64", 0);

Thanks.

Pavel Nevezhin

unread,
Sep 8, 2016, 2:25:24 AM9/8/16
to Sophia database
Sorry, i found my mistake in first case, i should use sp_setstring instead of sp_setint.

среда, 7 сентября 2016 г., 17:43:09 UTC+3 пользователь Pavel Nevezhin написал:

Dmitry Simonenko

unread,
Sep 8, 2016, 11:33:03 AM9/8/16
to Sophia database

Yes, sorry it is confusing. sp_setint(document) is not yet implemented to set numeric fields.
Yet it would be definitely handful to have it.

Autoincrement is also planned, right now it's behavior can be simulated as instructed in: https://groups.google.com/forum/#!topic/sophia-database/DxoufAayHtA 

Dmitry Simonenko

unread,
Sep 10, 2016, 12:43:19 PM9/10/16
to Sophia database

Just for your information, sp_setint(document) and sp_getint(document) methods are ready to use:
https://github.com/pmwkaa/sophia/commit/73f5bc64a5239d6ea70e550e166674cb1b38a678
Reply all
Reply to author
Forward
0 new messages