Compare commits
No commits in common. "master" and "0.01" have entirely different histories.
10 changed files with 60060 additions and 60594 deletions
34
Build.PL
34
Build.PL
|
@ -12,6 +12,8 @@ use utf8;
|
||||||
use Module::Build;
|
use Module::Build;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use File::Spec;
|
use File::Spec;
|
||||||
|
use CPAN::Meta;
|
||||||
|
use CPAN::Meta::Prereqs;
|
||||||
|
|
||||||
my %args = (
|
my %args = (
|
||||||
license => 'perl',
|
license => 'perl',
|
||||||
|
@ -27,12 +29,9 @@ my %args = (
|
||||||
|
|
||||||
script_files => [glob('script/*'), glob('bin/*')],
|
script_files => [glob('script/*'), glob('bin/*')],
|
||||||
c_source => [qw(unqlite)],
|
c_source => [qw(unqlite)],
|
||||||
PL_files => {},
|
|
||||||
|
|
||||||
test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
|
test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
|
||||||
recursive_test_files => 1,
|
recursive_test_files => 1,
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
if (-d 'share') {
|
if (-d 'share') {
|
||||||
$args{share_dir} = 'share';
|
$args{share_dir} = 'share';
|
||||||
|
@ -51,15 +50,20 @@ my $builder = Module::Build->subclass(
|
||||||
)->new(%args);
|
)->new(%args);
|
||||||
$builder->create_build_script();
|
$builder->create_build_script();
|
||||||
|
|
||||||
use File::Copy;
|
my $mbmeta = CPAN::Meta->load_file('MYMETA.json');
|
||||||
|
my $meta = CPAN::Meta->load_file('META.json');
|
||||||
print "cp META.json MYMETA.json\n";
|
my $prereqs_hash = CPAN::Meta::Prereqs->new(
|
||||||
copy("META.json","MYMETA.json") or die "Copy failed(META.json): $!";
|
$meta->prereqs
|
||||||
|
)->with_merged_prereqs(
|
||||||
if (-f 'META.yml') {
|
CPAN::Meta::Prereqs->new($mbmeta->prereqs)
|
||||||
print "cp META.yml MYMETA.yml\n";
|
)->as_string_hash;
|
||||||
copy("META.yml","MYMETA.yml") or die "Copy failed(META.yml): $!";
|
my $mymeta = CPAN::Meta->new(
|
||||||
} else {
|
{
|
||||||
print "There is no META.yml... You may install this module from the repository...\n";
|
%{$meta->as_struct},
|
||||||
}
|
prereqs => $prereqs_hash
|
||||||
|
}
|
||||||
|
);
|
||||||
|
print "Merging cpanfile prereqs to MYMETA.yml\n";
|
||||||
|
$mymeta->save('MYMETA.yml', { version => 1.4 });
|
||||||
|
print "Merging cpanfile prereqs to MYMETA.json\n";
|
||||||
|
$mymeta->save('MYMETA.json', { version => 2 });
|
||||||
|
|
21
Changes
21
Changes
|
@ -2,27 +2,6 @@ Revision history for Perl extension Unqlite
|
||||||
|
|
||||||
{{$NEXT}}
|
{{$NEXT}}
|
||||||
|
|
||||||
0.05 2014-12-23T22:55:15Z
|
|
||||||
|
|
||||||
- Doc fix
|
|
||||||
|
|
||||||
0.04 2014-08-30T09:33:52Z
|
|
||||||
|
|
||||||
- Fixed packaging issue.
|
|
||||||
|
|
||||||
0.03 2013-07-18T03:14:07Z
|
|
||||||
|
|
||||||
- more OPEN consts as mode argument
|
|
||||||
we do not only want to create databases
|
|
||||||
(Reini Urban)
|
|
||||||
|
|
||||||
0.02 2013-07-05T06:42:59Z
|
|
||||||
|
|
||||||
- Store RC to magic to fix race condition
|
|
||||||
(charsbar)
|
|
||||||
- Added `tie` interface.
|
|
||||||
(charsbar)
|
|
||||||
|
|
||||||
0.01 2013-07-03T19:02:44Z
|
0.01 2013-07-03T19:02:44Z
|
||||||
|
|
||||||
- original version
|
- original version
|
||||||
|
|
16
META.json
16
META.json
|
@ -4,7 +4,7 @@
|
||||||
"tokuhirom <tokuhirom@gmail.com>"
|
"tokuhirom <tokuhirom@gmail.com>"
|
||||||
],
|
],
|
||||||
"dynamic_config" : 0,
|
"dynamic_config" : 0,
|
||||||
"generated_by" : "Minilla/v2.2.0, CPAN::Meta::Converter version 2.141520",
|
"generated_by" : "Minilla/v0.5.5, CPAN::Meta::Converter version 2.130880",
|
||||||
"license" : [
|
"license" : [
|
||||||
"perl_5"
|
"perl_5"
|
||||||
],
|
],
|
||||||
|
@ -21,21 +21,21 @@
|
||||||
"share",
|
"share",
|
||||||
"eg",
|
"eg",
|
||||||
"examples",
|
"examples",
|
||||||
"author",
|
"author"
|
||||||
"builder"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"prereqs" : {
|
"prereqs" : {
|
||||||
"configure" : {
|
"configure" : {
|
||||||
"requires" : {
|
"requires" : {
|
||||||
|
"CPAN::Meta" : "0",
|
||||||
|
"CPAN::Meta::Prereqs" : "0",
|
||||||
"Module::Build" : "0.38"
|
"Module::Build" : "0.38"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"develop" : {
|
"develop" : {
|
||||||
"requires" : {
|
"requires" : {
|
||||||
"Test::CPAN::Meta" : "0",
|
"Test::CPAN::Meta" : "0",
|
||||||
"Test::MinimumVersion::Fast" : "0.04",
|
"Test::MinimumVersion" : "0.10108",
|
||||||
"Test::PAUSE::Permissions" : "0.04",
|
|
||||||
"Test::Pod" : "1.41",
|
"Test::Pod" : "1.41",
|
||||||
"Test::Spellunker" : "v0.2.7"
|
"Test::Spellunker" : "v0.2.7"
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,5 @@
|
||||||
"web" : "https://github.com/tokuhirom/UnQLite"
|
"web" : "https://github.com/tokuhirom/UnQLite"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version" : "0.05",
|
"version" : "0.01"
|
||||||
"x_contributors" : [
|
|
||||||
"Kenichi Ishigaki <ishigaki@cpan.org>",
|
|
||||||
"Reini Urban <rurban@cpanel.net>"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
26
README.md
26
README.md
|
@ -6,28 +6,23 @@ UnQLite - Perl bindings for UnQLite
|
||||||
|
|
||||||
use UnQLite;
|
use UnQLite;
|
||||||
|
|
||||||
my $db = UnQLite->open('foo.db', UnQLite::UNQLITE_OPEN_READWRITE|UnQLite::UNQLITE_OPEN_CREATE);
|
my $db = UnQLite->open('foo.db');
|
||||||
$db->kv_store('foo', 'bar');
|
$db->kv_store('foo', 'bar');
|
||||||
say $db->kv_fetch('foo'); # => bar
|
say $db->kv_fetch('foo'); # => bar
|
||||||
$db->kv_delete('foo');
|
$db->kv_delete('foo');
|
||||||
undef $db; # close database
|
undef $db; # close database
|
||||||
|
|
||||||
# tie interface
|
|
||||||
tie my %hash, 'UnQLite', 'foo.db', UnQLite::UNQLITE_OPEN_READWRITE;
|
|
||||||
$hash{foo} = 'bar';
|
|
||||||
say $hash{foo}; # => bar
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
UnQLite is a in-process software library which implements a self-contained, serverless, zero-configuration, transactional NoSQL database engine. UnQLite is a document store database similar to MongoDB, Redis, CouchDB etc. as well a standard Key/Value store similar to BerkeleyDB, LevelDB, etc.
|
UnQLite is a in-process software library which implements a self-contained, serverless, zero-configuration, transactional NoSQL database engine. UnQLite is a document store database similar to MongoDB, Redis, CouchDB etc. as well a standard Key/Value store similar to BerkeleyDB, LevelDB, etc.
|
||||||
|
|
||||||
This module is Perl5 binding for UnQLite.
|
This module is Perl5 binding for UnQLite.
|
||||||
|
|
||||||
If you want to know more information about UnQLite, see [https://unqlite.symisc.net/](https://unqlite.symisc.net/).
|
If you want to know more information about UnQLite, see [http://unqlite.org/](http://unqlite.org/).
|
||||||
|
|
||||||
This version of UnQLite.pm does not provides document store feature. Patches welcome.
|
This version of UnQLite.pm does not provides document store feature. Patches welcome.
|
||||||
|
|
||||||
**You can use UnQLite.pm as DBM**.
|
__You can use UnQLite.pm as DBM__.
|
||||||
|
|
||||||
# METHODS
|
# METHODS
|
||||||
|
|
||||||
|
@ -35,17 +30,6 @@ This version of UnQLite.pm does not provides document store feature. Patches wel
|
||||||
|
|
||||||
Open the database.
|
Open the database.
|
||||||
|
|
||||||
Modes:
|
|
||||||
|
|
||||||
UnQLite::UNQLITE_OPEN_CREATE (Default)
|
|
||||||
UnQLite::UNQLITE_OPEN_READONLY
|
|
||||||
UnQLite::UNQLITE_OPEN_READWRITE
|
|
||||||
UnQLite::UNQLITE_OPEN_EXCLUSIVE
|
|
||||||
UnQLite::UNQLITE_OPEN_TEMP_DB
|
|
||||||
UnQLite::UNQLITE_OPEN_OMIT_JOURNALING
|
|
||||||
UnQLite::UNQLITE_OPEN_IN_MEMORY
|
|
||||||
UnQLite::UNQLITE_OPEN_MMAP
|
|
||||||
|
|
||||||
- `$db->kv_store($key, $value);`
|
- `$db->kv_store($key, $value);`
|
||||||
|
|
||||||
Store the entry to database.
|
Store the entry to database.
|
||||||
|
@ -118,11 +102,11 @@ Here is example code:
|
||||||
|
|
||||||
Return true if succeeded, false otherwise.
|
Return true if succeeded, false otherwise.
|
||||||
|
|
||||||
- `$cursor->seek($key, $opt=UnQLite::UNQLITE_CURSOR_MATCH_EXACT)`
|
- `$cursor->seek($key, $opt=UNQLITE_CURSOR_MATCH_EXACT)`
|
||||||
|
|
||||||
Seek cursor to ` $key `.
|
Seek cursor to ` $key `.
|
||||||
|
|
||||||
You can specify the option as ` $opt `. Please see [http://unqlite.org/c\_api/unqlite\_kv\_cursor.html](http://unqlite.org/c_api/unqlite_kv_cursor.html) for more details.
|
You can specify the option as ` $opt `. Please see [http://unqlite.org/c\_api/unqlite\_kv\_cursor.html](http://unqlite.org/c\_api/unqlite\_kv\_cursor.html) for more details.
|
||||||
|
|
||||||
Return true if succeeded, false otherwise.
|
Return true if succeeded, false otherwise.
|
||||||
|
|
||||||
|
|
|
@ -2,29 +2,17 @@ package UnQLite;
|
||||||
use 5.008005;
|
use 5.008005;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Carp ();
|
|
||||||
|
|
||||||
our $VERSION = "0.05";
|
our $VERSION = "0.01";
|
||||||
our $rc = 0;
|
our $rc = 0;
|
||||||
|
|
||||||
use XSLoader;
|
use XSLoader;
|
||||||
XSLoader::load(__PACKAGE__, $VERSION);
|
XSLoader::load(__PACKAGE__, $VERSION);
|
||||||
|
|
||||||
sub TIEHASH {
|
sub rc { $UnQLite::rc }
|
||||||
my $class = shift;
|
|
||||||
my $self = $class->open(@_) or Carp::croak $class->errstr;
|
|
||||||
$self->cursor_init;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub rc {
|
|
||||||
my $self = shift;
|
|
||||||
my $_rc = _rc($self);
|
|
||||||
defined $_rc ? $rc = $_rc : $rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub errstr {
|
sub errstr {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $rc = $self->rc;
|
|
||||||
if ($rc==UnQLite::UNQLITE_OK()) { return "UNQLITE_OK" }
|
if ($rc==UnQLite::UNQLITE_OK()) { return "UNQLITE_OK" }
|
||||||
if ($rc==UNQLITE_NOMEM()) { return "UNQLITE_NOMEM" }
|
if ($rc==UNQLITE_NOMEM()) { return "UNQLITE_NOMEM" }
|
||||||
if ($rc==UNQLITE_ABORT()) { return "UNQLITE_ABORT" }
|
if ($rc==UNQLITE_ABORT()) { return "UNQLITE_ABORT" }
|
||||||
|
@ -58,12 +46,6 @@ sub cursor_init {
|
||||||
|
|
||||||
package UnQLite::Cursor;
|
package UnQLite::Cursor;
|
||||||
|
|
||||||
sub rc {
|
|
||||||
my $self = shift;
|
|
||||||
my $_rc = _rc($self->[0]);
|
|
||||||
defined $_rc ? $UnQLite::rc = $_rc : $UnQLite::rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub first_entry {
|
sub first_entry {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
_first_entry($self->[0]);
|
_first_entry($self->[0]);
|
||||||
|
@ -114,62 +96,6 @@ sub DESTROY {
|
||||||
_release($self->[0], $self->[1]);
|
_release($self->[0], $self->[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
# tie interface
|
|
||||||
|
|
||||||
sub FETCH {
|
|
||||||
my ($self, $key) = @_;
|
|
||||||
$self->[1]->kv_fetch($key);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub STORE {
|
|
||||||
my ($self, $key, $value) = @_;
|
|
||||||
$self->[1]->kv_store($key, $value) or Carp::croak $self->[1]->errstr;
|
|
||||||
$value;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub DELETE {
|
|
||||||
my ($self, $key) = @_;
|
|
||||||
my $prev = $self->[1]->kv_fetch($key);
|
|
||||||
my $errstr = $self->[1]->errstr;
|
|
||||||
return unless $errstr && $errstr eq 'UNQLITE_OK';
|
|
||||||
$self->[1]->kv_delete($key) or Carp::croak $self->[1]->errstr;
|
|
||||||
$prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub FIRSTKEY {
|
|
||||||
my $self = shift;
|
|
||||||
$self->first_entry or return;
|
|
||||||
$self->key;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub NEXTKEY {
|
|
||||||
my $self = shift;
|
|
||||||
$self->next_entry or return;
|
|
||||||
$self->key;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub EXISTS {
|
|
||||||
my ($self, $key) = @_;
|
|
||||||
$self->[1]->kv_fetch($key) and return 1;
|
|
||||||
my $errstr = $self->[1]->errstr;
|
|
||||||
return $errstr && $errstr eq 'UNQLITE_OK' ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub CLEAR {
|
|
||||||
my $self = shift;
|
|
||||||
$self->first_entry or return;
|
|
||||||
$self->delete_entry while $self->valid_entry;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub SCALAR {
|
|
||||||
my $self = shift;
|
|
||||||
$self->first_entry or return;
|
|
||||||
my $ct = 1;
|
|
||||||
$ct++ while $self->next_entry && $self->valid_entry;
|
|
||||||
return $ct;
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
|
@ -185,17 +111,12 @@ UnQLite - Perl bindings for UnQLite
|
||||||
|
|
||||||
use UnQLite;
|
use UnQLite;
|
||||||
|
|
||||||
my $db = UnQLite->open('foo.db', UnQLite::UNQLITE_OPEN_READWRITE|UnQLite::UNQLITE_OPEN_CREATE);
|
my $db = UnQLite->open('foo.db');
|
||||||
$db->kv_store('foo', 'bar');
|
$db->kv_store('foo', 'bar');
|
||||||
say $db->kv_fetch('foo'); # => bar
|
say $db->kv_fetch('foo'); # => bar
|
||||||
$db->kv_delete('foo');
|
$db->kv_delete('foo');
|
||||||
undef $db; # close database
|
undef $db; # close database
|
||||||
|
|
||||||
# tie interface
|
|
||||||
tie my %hash, 'UnQLite', 'foo.db', UnQLite::UNQLITE_OPEN_READWRITE;
|
|
||||||
$hash{foo} = 'bar';
|
|
||||||
say $hash{foo}; # => bar
|
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
UnQLite is a in-process software library which implements a self-contained, serverless, zero-configuration, transactional NoSQL database engine. UnQLite is a document store database similar to MongoDB, Redis, CouchDB etc. as well a standard Key/Value store similar to BerkeleyDB, LevelDB, etc.
|
UnQLite is a in-process software library which implements a self-contained, serverless, zero-configuration, transactional NoSQL database engine. UnQLite is a document store database similar to MongoDB, Redis, CouchDB etc. as well a standard Key/Value store similar to BerkeleyDB, LevelDB, etc.
|
||||||
|
@ -216,17 +137,6 @@ B<You can use UnQLite.pm as DBM>.
|
||||||
|
|
||||||
Open the database.
|
Open the database.
|
||||||
|
|
||||||
Modes:
|
|
||||||
|
|
||||||
UnQLite::UNQLITE_OPEN_CREATE (Default)
|
|
||||||
UnQLite::UNQLITE_OPEN_READONLY
|
|
||||||
UnQLite::UNQLITE_OPEN_READWRITE
|
|
||||||
UnQLite::UNQLITE_OPEN_EXCLUSIVE
|
|
||||||
UnQLite::UNQLITE_OPEN_TEMP_DB
|
|
||||||
UnQLite::UNQLITE_OPEN_OMIT_JOURNALING
|
|
||||||
UnQLite::UNQLITE_OPEN_IN_MEMORY
|
|
||||||
UnQLite::UNQLITE_OPEN_MMAP
|
|
||||||
|
|
||||||
=item C<< $db->kv_store($key, $value); >>
|
=item C<< $db->kv_store($key, $value); >>
|
||||||
|
|
||||||
Store the entry to database.
|
Store the entry to database.
|
||||||
|
@ -303,7 +213,7 @@ Seek cursor to previous entry.
|
||||||
|
|
||||||
Return true if succeeded, false otherwise.
|
Return true if succeeded, false otherwise.
|
||||||
|
|
||||||
=item C<< $cursor->seek($key, $opt=UnQLite::UNQLITE_CURSOR_MATCH_EXACT) >>
|
=item C<< $cursor->seek($key, $opt=UNQLITE_CURSOR_MATCH_EXACT) >>
|
||||||
|
|
||||||
Seek cursor to C< $key >.
|
Seek cursor to C< $key >.
|
||||||
|
|
||||||
|
|
149
lib/UnQLite.xs
149
lib/UnQLite.xs
|
@ -19,21 +19,14 @@ extern "C" {
|
||||||
|
|
||||||
#define XS_STRUCT2OBJ(sv, class, obj) \
|
#define XS_STRUCT2OBJ(sv, class, obj) \
|
||||||
sv = newSViv(PTR2IV(obj)); \
|
sv = newSViv(PTR2IV(obj)); \
|
||||||
sv_magic(sv, sv_2mortal(newSViv(UNQLITE_OK)), PERL_MAGIC_ext, NULL, 0); \
|
|
||||||
sv = newRV_noinc(sv); \
|
sv = newRV_noinc(sv); \
|
||||||
sv_bless(sv, gv_stashpv(class, 1)); \
|
sv_bless(sv, gv_stashpv(class, 1)); \
|
||||||
SvREADONLY_on(sv);
|
SvREADONLY_on(sv);
|
||||||
|
|
||||||
#define SETRC(rc, self) \
|
#define SETRC(rc) \
|
||||||
{ \
|
{ \
|
||||||
SV * i = get_sv("UnQLite::rc", GV_ADD); \
|
SV * i = get_sv("UnQLite::rc", GV_ADD); \
|
||||||
SvIV_set(i, rc); \
|
SvIV_set(i, rc); \
|
||||||
if (SvROK(self)) { \
|
|
||||||
MAGIC *_mg = mg_find(SvRV(self), PERL_MAGIC_ext); \
|
|
||||||
if (_mg) { \
|
|
||||||
SvIV_set(_mg->mg_obj, rc); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE = UnQLite PACKAGE = UnQLite
|
MODULE = UnQLite PACKAGE = UnQLite
|
||||||
|
@ -42,44 +35,34 @@ PROTOTYPES: DISABLE
|
||||||
|
|
||||||
BOOT:
|
BOOT:
|
||||||
HV* stash = gv_stashpvn("UnQLite", strlen("UnQLite"), TRUE);
|
HV* stash = gv_stashpvn("UnQLite", strlen("UnQLite"), TRUE);
|
||||||
#define _XSTR(s) _STR(s)
|
newCONSTSUB(stash, "UNQLITE_OK", newSViv(UNQLITE_OK));
|
||||||
#define _STR(s) #s
|
newCONSTSUB(stash, "UNQLITE_NOMEM", newSViv(UNQLITE_NOMEM));
|
||||||
#define UnConst(c) newCONSTSUB(stash, "UNQ"_XSTR(c), newSViv(UNQ##c))
|
newCONSTSUB(stash, "UNQLITE_ABORT", newSViv(UNQLITE_ABORT));
|
||||||
UnConst(LITE_OK);
|
newCONSTSUB(stash, "UNQLITE_IOERR", newSViv(UNQLITE_IOERR));
|
||||||
UnConst(LITE_NOMEM);
|
newCONSTSUB(stash, "UNQLITE_CORRUPT", newSViv(UNQLITE_CORRUPT));
|
||||||
UnConst(LITE_ABORT);
|
newCONSTSUB(stash, "UNQLITE_LOCKED", newSViv(UNQLITE_LOCKED));
|
||||||
UnConst(LITE_IOERR);
|
newCONSTSUB(stash, "UNQLITE_BUSY", newSViv(UNQLITE_BUSY));
|
||||||
UnConst(LITE_CORRUPT);
|
newCONSTSUB(stash, "UNQLITE_DONE", newSViv(UNQLITE_DONE));
|
||||||
UnConst(LITE_LOCKED);
|
newCONSTSUB(stash, "UNQLITE_PERM", newSViv(UNQLITE_PERM));
|
||||||
UnConst(LITE_BUSY);
|
newCONSTSUB(stash, "UNQLITE_NOTIMPLEMENTED", newSViv(UNQLITE_NOTIMPLEMENTED));
|
||||||
UnConst(LITE_DONE);
|
newCONSTSUB(stash, "UNQLITE_NOTFOUND", newSViv(UNQLITE_NOTFOUND));
|
||||||
UnConst(LITE_PERM);
|
newCONSTSUB(stash, "UNQLITE_NOOP", newSViv(UNQLITE_NOOP));
|
||||||
UnConst(LITE_NOTIMPLEMENTED);
|
newCONSTSUB(stash, "UNQLITE_INVALID", newSViv(UNQLITE_INVALID));
|
||||||
UnConst(LITE_NOTFOUND);
|
newCONSTSUB(stash, "UNQLITE_EOF", newSViv(UNQLITE_EOF));
|
||||||
UnConst(LITE_NOOP);
|
newCONSTSUB(stash, "UNQLITE_UNKNOWN", newSViv(UNQLITE_UNKNOWN));
|
||||||
UnConst(LITE_INVALID);
|
newCONSTSUB(stash, "UNQLITE_LIMIT", newSViv(UNQLITE_LIMIT));
|
||||||
UnConst(LITE_EOF);
|
newCONSTSUB(stash, "UNQLITE_EXISTS", newSViv(UNQLITE_EXISTS));
|
||||||
UnConst(LITE_UNKNOWN);
|
newCONSTSUB(stash, "UNQLITE_EMPTY", newSViv(UNQLITE_EMPTY));
|
||||||
UnConst(LITE_LIMIT);
|
newCONSTSUB(stash, "UNQLITE_COMPILE_ERR", newSViv(UNQLITE_COMPILE_ERR));
|
||||||
UnConst(LITE_EXISTS);
|
newCONSTSUB(stash, "UNQLITE_VM_ERR", newSViv(UNQLITE_VM_ERR));
|
||||||
UnConst(LITE_EMPTY);
|
newCONSTSUB(stash, "UNQLITE_FULL", newSViv(UNQLITE_FULL));
|
||||||
UnConst(LITE_COMPILE_ERR);
|
newCONSTSUB(stash, "UNQLITE_CANTOPEN", newSViv(UNQLITE_CANTOPEN));
|
||||||
UnConst(LITE_VM_ERR);
|
newCONSTSUB(stash, "UNQLITE_READ_ONLY", newSViv(UNQLITE_READ_ONLY));
|
||||||
UnConst(LITE_FULL);
|
newCONSTSUB(stash, "UNQLITE_LOCKERR", newSViv(UNQLITE_LOCKERR));
|
||||||
UnConst(LITE_CANTOPEN);
|
|
||||||
UnConst(LITE_READ_ONLY);
|
newCONSTSUB(stash, "UNQLITE_CURSOR_MATCH_EXACT", newSViv(UNQLITE_CURSOR_MATCH_EXACT));
|
||||||
UnConst(LITE_LOCKERR);
|
newCONSTSUB(stash, "UNQLITE_CURSOR_MATCH_LE", newSViv(UNQLITE_CURSOR_MATCH_LE));
|
||||||
UnConst(LITE_OPEN_READONLY);
|
newCONSTSUB(stash, "UNQLITE_CURSOR_MATCH_GE", newSViv(UNQLITE_CURSOR_MATCH_GE));
|
||||||
UnConst(LITE_OPEN_READWRITE);
|
|
||||||
UnConst(LITE_OPEN_CREATE);
|
|
||||||
UnConst(LITE_OPEN_EXCLUSIVE);
|
|
||||||
UnConst(LITE_OPEN_TEMP_DB);
|
|
||||||
UnConst(LITE_OPEN_OMIT_JOURNALING);
|
|
||||||
UnConst(LITE_OPEN_IN_MEMORY);
|
|
||||||
UnConst(LITE_OPEN_MMAP);
|
|
||||||
UnConst(LITE_CURSOR_MATCH_EXACT);
|
|
||||||
UnConst(LITE_CURSOR_MATCH_LE);
|
|
||||||
UnConst(LITE_CURSOR_MATCH_GE);
|
|
||||||
|
|
||||||
SV*
|
SV*
|
||||||
open(klass, filename, mode=UNQLITE_OPEN_CREATE)
|
open(klass, filename, mode=UNQLITE_OPEN_CREATE)
|
||||||
|
@ -92,29 +75,10 @@ PREINIT:
|
||||||
int rc;
|
int rc;
|
||||||
CODE:
|
CODE:
|
||||||
rc = unqlite_open(&pdb, filename, mode);
|
rc = unqlite_open(&pdb, filename, mode);
|
||||||
|
SETRC(rc);
|
||||||
if (rc == UNQLITE_OK) {
|
if (rc == UNQLITE_OK) {
|
||||||
XS_STRUCT2OBJ(sv, klass, pdb);
|
XS_STRUCT2OBJ(sv, klass, pdb);
|
||||||
SETRC(rc, sv);
|
|
||||||
RETVAL = sv;
|
RETVAL = sv;
|
||||||
} else {
|
|
||||||
SETRC(rc, &PL_sv_undef);
|
|
||||||
RETVAL = &PL_sv_undef;
|
|
||||||
}
|
|
||||||
OUTPUT:
|
|
||||||
RETVAL
|
|
||||||
|
|
||||||
SV* _rc(self)
|
|
||||||
SV *self
|
|
||||||
PREINIT:
|
|
||||||
MAGIC *mg;
|
|
||||||
CODE:
|
|
||||||
if (SvROK(self)) {
|
|
||||||
mg = mg_find(SvRV(self), PERL_MAGIC_ext);
|
|
||||||
if (mg) {
|
|
||||||
RETVAL = newSVsv(mg->mg_obj);
|
|
||||||
} else {
|
|
||||||
RETVAL = &PL_sv_undef;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
RETVAL = &PL_sv_undef;
|
RETVAL = &PL_sv_undef;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +101,7 @@ CODE:
|
||||||
key_c = SvPV(key_sv, key_l);
|
key_c = SvPV(key_sv, key_l);
|
||||||
data_c = SvPV(data_sv, data_l);
|
data_c = SvPV(data_sv, data_l);
|
||||||
rc = unqlite_kv_store(pdb, key_c, key_l, data_c, data_l);
|
rc = unqlite_kv_store(pdb, key_c, key_l, data_c, data_l);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc==UNQLITE_OK) {
|
if (rc==UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_yes;
|
RETVAL = &PL_sv_yes;
|
||||||
} else {
|
} else {
|
||||||
|
@ -162,7 +126,7 @@ CODE:
|
||||||
key_c = SvPV(key_sv, key_l);
|
key_c = SvPV(key_sv, key_l);
|
||||||
data_c = SvPV(data_sv, data_l);
|
data_c = SvPV(data_sv, data_l);
|
||||||
rc = unqlite_kv_append(pdb, key_c, key_l, data_c, data_l);
|
rc = unqlite_kv_append(pdb, key_c, key_l, data_c, data_l);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc==UNQLITE_OK) {
|
if (rc==UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_yes;
|
RETVAL = &PL_sv_yes;
|
||||||
} else {
|
} else {
|
||||||
|
@ -183,7 +147,7 @@ CODE:
|
||||||
unqlite *pdb = XS_STATE(unqlite*, self);
|
unqlite *pdb = XS_STATE(unqlite*, self);
|
||||||
key_c = SvPV(key_sv, key_l);
|
key_c = SvPV(key_sv, key_l);
|
||||||
rc = unqlite_kv_delete(pdb, key_c, key_l);
|
rc = unqlite_kv_delete(pdb, key_c, key_l);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc==UNQLITE_OK) {
|
if (rc==UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_yes;
|
RETVAL = &PL_sv_yes;
|
||||||
} else {
|
} else {
|
||||||
|
@ -209,14 +173,14 @@ CODE:
|
||||||
|
|
||||||
/* Allocate a buffer big enough to hold the record content */
|
/* Allocate a buffer big enough to hold the record content */
|
||||||
rc = unqlite_kv_fetch(pdb, key_c, key_l, NULL, &nbytes);
|
rc = unqlite_kv_fetch(pdb, key_c, key_l, NULL, &nbytes);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc!=UNQLITE_OK) {
|
if (rc!=UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_undef;
|
RETVAL = &PL_sv_undef;
|
||||||
goto last;
|
goto last;
|
||||||
}
|
}
|
||||||
Newxz(buf, nbytes, char);
|
Newxz(buf, nbytes, char);
|
||||||
rc = unqlite_kv_fetch(pdb, key_c, key_l, buf, &nbytes);
|
rc = unqlite_kv_fetch(pdb, key_c, key_l, buf, &nbytes);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
sv = newSVpv(buf, nbytes);
|
sv = newSVpv(buf, nbytes);
|
||||||
Safefree(buf);
|
Safefree(buf);
|
||||||
RETVAL = sv;
|
RETVAL = sv;
|
||||||
|
@ -232,7 +196,7 @@ PREINIT:
|
||||||
CODE:
|
CODE:
|
||||||
unqlite *pdb = XS_STATE(unqlite*, self);
|
unqlite *pdb = XS_STATE(unqlite*, self);
|
||||||
rc = unqlite_close(pdb);
|
rc = unqlite_close(pdb);
|
||||||
SETRC(rc, &PL_sv_undef);
|
SETRC(rc);
|
||||||
|
|
||||||
SV*
|
SV*
|
||||||
_cursor_init(self)
|
_cursor_init(self)
|
||||||
|
@ -244,10 +208,9 @@ PREINIT:
|
||||||
CODE:
|
CODE:
|
||||||
unqlite *pdb = XS_STATE(unqlite*, self);
|
unqlite *pdb = XS_STATE(unqlite*, self);
|
||||||
rc = unqlite_kv_cursor_init(pdb, &cursor);
|
rc = unqlite_kv_cursor_init(pdb, &cursor);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc == UNQLITE_OK) {
|
if (rc == UNQLITE_OK) {
|
||||||
sv = newSViv(PTR2IV(cursor));
|
sv = newSViv(PTR2IV(cursor));
|
||||||
sv_magic(sv, sv_2mortal(newSViv(UNQLITE_OK)), PERL_MAGIC_ext, NULL, 0);
|
|
||||||
sv = newRV_noinc(sv);
|
sv = newRV_noinc(sv);
|
||||||
SvREADONLY_on(sv);
|
SvREADONLY_on(sv);
|
||||||
RETVAL = sv;
|
RETVAL = sv;
|
||||||
|
@ -260,24 +223,6 @@ OUTPUT:
|
||||||
|
|
||||||
MODULE = UnQLite PACKAGE = UnQLite::Cursor
|
MODULE = UnQLite PACKAGE = UnQLite::Cursor
|
||||||
|
|
||||||
SV* _rc(self)
|
|
||||||
SV *self
|
|
||||||
PREINIT:
|
|
||||||
MAGIC *mg;
|
|
||||||
CODE:
|
|
||||||
if (SvROK(self)) {
|
|
||||||
mg = mg_find(SvRV(self), PERL_MAGIC_ext);
|
|
||||||
if (mg) {
|
|
||||||
RETVAL = newSVsv(mg->mg_obj);
|
|
||||||
} else {
|
|
||||||
RETVAL = &PL_sv_undef;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
RETVAL = &PL_sv_undef;
|
|
||||||
}
|
|
||||||
OUTPUT:
|
|
||||||
RETVAL
|
|
||||||
|
|
||||||
SV*
|
SV*
|
||||||
_first_entry(self)
|
_first_entry(self)
|
||||||
SV * self;
|
SV * self;
|
||||||
|
@ -287,7 +232,7 @@ PREINIT:
|
||||||
CODE:
|
CODE:
|
||||||
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
||||||
rc = unqlite_kv_cursor_first_entry(cursor);
|
rc = unqlite_kv_cursor_first_entry(cursor);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc == UNQLITE_OK) {
|
if (rc == UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_yes;
|
RETVAL = &PL_sv_yes;
|
||||||
} else {
|
} else {
|
||||||
|
@ -319,7 +264,7 @@ PREINIT:
|
||||||
CODE:
|
CODE:
|
||||||
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
||||||
rc = unqlite_kv_cursor_next_entry(cursor);
|
rc = unqlite_kv_cursor_next_entry(cursor);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc == UNQLITE_OK) {
|
if (rc == UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_yes;
|
RETVAL = &PL_sv_yes;
|
||||||
} else {
|
} else {
|
||||||
|
@ -337,7 +282,7 @@ PREINIT:
|
||||||
CODE:
|
CODE:
|
||||||
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
||||||
rc = unqlite_kv_cursor_last_entry(cursor);
|
rc = unqlite_kv_cursor_last_entry(cursor);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc == UNQLITE_OK) {
|
if (rc == UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_yes;
|
RETVAL = &PL_sv_yes;
|
||||||
} else {
|
} else {
|
||||||
|
@ -355,7 +300,7 @@ PREINIT:
|
||||||
CODE:
|
CODE:
|
||||||
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
||||||
rc = unqlite_kv_cursor_prev_entry(cursor);
|
rc = unqlite_kv_cursor_prev_entry(cursor);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc == UNQLITE_OK) {
|
if (rc == UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_yes;
|
RETVAL = &PL_sv_yes;
|
||||||
} else {
|
} else {
|
||||||
|
@ -375,14 +320,14 @@ PREINIT:
|
||||||
CODE:
|
CODE:
|
||||||
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
||||||
rc = unqlite_kv_cursor_key(cursor, NULL, &nbytes);
|
rc = unqlite_kv_cursor_key(cursor, NULL, &nbytes);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc!=UNQLITE_OK) {
|
if (rc!=UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_undef;
|
RETVAL = &PL_sv_undef;
|
||||||
goto last;
|
goto last;
|
||||||
}
|
}
|
||||||
Newxz(buf, nbytes, char);
|
Newxz(buf, nbytes, char);
|
||||||
rc = unqlite_kv_cursor_key(cursor, buf, &nbytes);
|
rc = unqlite_kv_cursor_key(cursor, buf, &nbytes);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
sv = newSVpv(buf, nbytes);
|
sv = newSVpv(buf, nbytes);
|
||||||
Safefree(buf);
|
Safefree(buf);
|
||||||
RETVAL = sv;
|
RETVAL = sv;
|
||||||
|
@ -401,14 +346,14 @@ PREINIT:
|
||||||
CODE:
|
CODE:
|
||||||
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
||||||
rc = unqlite_kv_cursor_data(cursor, NULL, &nbytes);
|
rc = unqlite_kv_cursor_data(cursor, NULL, &nbytes);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc!=UNQLITE_OK) {
|
if (rc!=UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_undef;
|
RETVAL = &PL_sv_undef;
|
||||||
goto last;
|
goto last;
|
||||||
}
|
}
|
||||||
Newxz(buf, nbytes, char);
|
Newxz(buf, nbytes, char);
|
||||||
rc = unqlite_kv_cursor_data(cursor, buf, &nbytes);
|
rc = unqlite_kv_cursor_data(cursor, buf, &nbytes);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
sv = newSVpv(buf, nbytes);
|
sv = newSVpv(buf, nbytes);
|
||||||
Safefree(buf);
|
Safefree(buf);
|
||||||
RETVAL = sv;
|
RETVAL = sv;
|
||||||
|
@ -438,7 +383,7 @@ CODE:
|
||||||
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
||||||
key = SvPV(key_s, len);
|
key = SvPV(key_s, len);
|
||||||
rc = unqlite_kv_cursor_seek(cursor, key, len, opt);
|
rc = unqlite_kv_cursor_seek(cursor, key, len, opt);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc == UNQLITE_OK) {
|
if (rc == UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_yes;
|
RETVAL = &PL_sv_yes;
|
||||||
} else {
|
} else {
|
||||||
|
@ -455,7 +400,7 @@ PREINIT:
|
||||||
CODE:
|
CODE:
|
||||||
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
unqlite_kv_cursor *cursor = XS_STATE(unqlite_kv_cursor*, self);
|
||||||
rc = unqlite_kv_cursor_delete_entry(cursor);
|
rc = unqlite_kv_cursor_delete_entry(cursor);
|
||||||
SETRC(rc, self);
|
SETRC(rc);
|
||||||
if (rc == UNQLITE_OK) {
|
if (rc == UNQLITE_OK) {
|
||||||
RETVAL = &PL_sv_yes;
|
RETVAL = &PL_sv_yes;
|
||||||
} else {
|
} else {
|
||||||
|
|
46
t/03_tie.t
46
t/03_tie.t
|
@ -1,46 +0,0 @@
|
||||||
use strict;
|
|
||||||
use Test::More;
|
|
||||||
|
|
||||||
use File::Temp qw(tempdir);
|
|
||||||
use UnQLite;
|
|
||||||
|
|
||||||
my $tmp = tempdir( CLEANUP => 1 );
|
|
||||||
|
|
||||||
{
|
|
||||||
my $db = UnQLite->open("$tmp/foo.db");
|
|
||||||
isa_ok($db, 'UnQLite');
|
|
||||||
|
|
||||||
ok($db->kv_store("foo", "bar"));
|
|
||||||
is($db->kv_fetch('foo'), 'bar');
|
|
||||||
ok($db->kv_delete('foo'));
|
|
||||||
is($db->kv_fetch('foo'), undef);
|
|
||||||
$db->kv_store('yay', 'yap');
|
|
||||||
$db->kv_append('yay', 'po');
|
|
||||||
is($db->kv_fetch('yay'), 'yappo');
|
|
||||||
is($db->rc,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ok -e "$tmp/foo.db", "foo.db exists";
|
|
||||||
tie my %hash, 'UnQLite', "$tmp/foo.db";
|
|
||||||
|
|
||||||
# stored data can be retrieved again?
|
|
||||||
is($hash{yay}, 'yappo');
|
|
||||||
$hash{foo} = 'baz';
|
|
||||||
is($hash{foo}, 'baz');
|
|
||||||
$hash{delete} = 'delete';
|
|
||||||
is(delete $hash{delete}, 'delete');
|
|
||||||
is(delete $hash{delete}, undef);
|
|
||||||
ok(exists $hash{foo});
|
|
||||||
ok(!exists $hash{delete});
|
|
||||||
|
|
||||||
is(join(" ", sort keys %hash), "foo yay");
|
|
||||||
is(join(" ", sort values %hash), "baz yappo");
|
|
||||||
is(scalar %hash, 2);
|
|
||||||
%hash = ();
|
|
||||||
is(join(" ", sort keys %hash), "");
|
|
||||||
is(join(" ", sort values %hash), "");
|
|
||||||
is(scalar %hash, undef);
|
|
||||||
}
|
|
||||||
|
|
||||||
done_testing;
|
|
|
@ -1,4 +1,5 @@
|
||||||
* Copyright (C) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Symisc Systems, S.U.A.R.L [M.I.A.G Mrad Chems Eddine <chm@symisc.net>].
|
/*
|
||||||
|
* Copyright (C) 2012, 2013 Symisc Systems, S.U.A.R.L [M.I.A.G Mrad Chems Eddine <chm@symisc.net>].
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -21,3 +22,4 @@
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,14 +1,10 @@
|
||||||
/* This file was automatically generated. Do not edit (Except for compile time directives)! */
|
/* This file was automatically generated. Do not edit (Except for compile time directives)! */
|
||||||
#ifndef _UNQLITE_H_
|
#ifndef _UNQLITE_H_
|
||||||
#define _UNQLITE_H_
|
#define _UNQLITE_H_
|
||||||
/* Make sure we can call this stuff from C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* Symisc UnQLite: An Embeddable NoSQL (Post Modern) Database Engine.
|
* Symisc UnQLite: An Embeddable NoSQL (Post Modern) Database Engine.
|
||||||
* Copyright (C) 2012-2019, Symisc Systems http://unqlite.org/
|
* Copyright (C) 2012-2013, Symisc Systems http://unqlite.org/
|
||||||
* Version 1.1.9
|
* Version 1.1.6
|
||||||
* For information on licensing, redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES
|
* For information on licensing, redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES
|
||||||
* please contact Symisc Systems via:
|
* please contact Symisc Systems via:
|
||||||
* legal@symisc.net
|
* legal@symisc.net
|
||||||
|
@ -18,7 +14,7 @@
|
||||||
* http://unqlite.org/licensing.html
|
* http://unqlite.org/licensing.html
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2012, 2019 Symisc Systems, S.U.A.R.L [M.I.A.G Mrad Chems Eddine <chm@symisc.net>].
|
* Copyright (C) 2012, 2013 Symisc Systems, S.U.A.R.L [M.I.A.G Mrad Chems Eddine <chm@symisc.net>].
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -42,7 +38,7 @@
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/* $SymiscID: unqlite.h v1.3 Win10 2108-04-27 02:35:11 stable <chm@symisc.net> $ */
|
/* $SymiscID: unqlite.h v1.1 UNIX|WIN32/64 2012-11-02 02:10 stable <chm@symisc.net> $ */
|
||||||
#include <stdarg.h> /* needed for the definition of va_list */
|
#include <stdarg.h> /* needed for the definition of va_list */
|
||||||
/*
|
/*
|
||||||
* Compile time engine version, signature, identification in the symisc source tree
|
* Compile time engine version, signature, identification in the symisc source tree
|
||||||
|
@ -53,18 +49,18 @@
|
||||||
* [unqlite_lib_copyright()] for more information.
|
* [unqlite_lib_copyright()] for more information.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* The UNQLITE_VERSION C preprocessor macro evaluates to a string literal
|
* The UNQLITE_VERSION C preprocessor macroevaluates to a string literal
|
||||||
* that is the unqlite version in the format "X.Y.Z" where X is the major
|
* that is the unqlite version in the format "X.Y.Z" where X is the major
|
||||||
* version number and Y is the minor version number and Z is the release
|
* version number and Y is the minor version number and Z is the release
|
||||||
* number.
|
* number.
|
||||||
*/
|
*/
|
||||||
#define UNQLITE_VERSION "1.1.9"
|
#define UNQLITE_VERSION "1.1.6"
|
||||||
/*
|
/*
|
||||||
* The UNQLITE_VERSION_NUMBER C preprocessor macro resolves to an integer
|
* The UNQLITE_VERSION_NUMBER C preprocessor macro resolves to an integer
|
||||||
* with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
|
* with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
|
||||||
* numbers used in [UNQLITE_VERSION].
|
* numbers used in [UNQLITE_VERSION].
|
||||||
*/
|
*/
|
||||||
#define UNQLITE_VERSION_NUMBER 1001009
|
#define UNQLITE_VERSION_NUMBER 1001006
|
||||||
/*
|
/*
|
||||||
* The UNQLITE_SIG C preprocessor macro evaluates to a string
|
* The UNQLITE_SIG C preprocessor macro evaluates to a string
|
||||||
* literal which is the public signature of the unqlite engine.
|
* literal which is the public signature of the unqlite engine.
|
||||||
|
@ -72,14 +68,14 @@
|
||||||
* generated Server MIME header as follows:
|
* generated Server MIME header as follows:
|
||||||
* Server: YourWebServer/x.x unqlite/x.x.x \r\n
|
* Server: YourWebServer/x.x unqlite/x.x.x \r\n
|
||||||
*/
|
*/
|
||||||
#define UNQLITE_SIG "unqlite/1.1.9"
|
#define UNQLITE_SIG "unqlite/1.1.6"
|
||||||
/*
|
/*
|
||||||
* UnQLite identification in the Symisc source tree:
|
* UnQLite identification in the Symisc source tree:
|
||||||
* Each particular check-in of a particular software released
|
* Each particular check-in of a particular software released
|
||||||
* by symisc systems have an unique identifier associated with it.
|
* by symisc systems have an unique identifier associated with it.
|
||||||
* This macro hold the one associated with unqlite.
|
* This macro hold the one associated with unqlite.
|
||||||
*/
|
*/
|
||||||
#define UNQLITE_IDENT "unqlite:29c173b1-ac2c-4b49-93ba-e600619e304e"
|
#define UNQLITE_IDENT "unqlite:b172a1e2c3f62fb35c8e1fb2795121f82356cad6"
|
||||||
/*
|
/*
|
||||||
* Copyright notice.
|
* Copyright notice.
|
||||||
* If you have any questions about the licensing situation, please
|
* If you have any questions about the licensing situation, please
|
||||||
|
@ -89,7 +85,7 @@
|
||||||
* licensing@symisc.net
|
* licensing@symisc.net
|
||||||
* contact@symisc.net
|
* contact@symisc.net
|
||||||
*/
|
*/
|
||||||
#define UNQLITE_COPYRIGHT "Copyright (C) Symisc Systems, S.U.A.R.L [Mrad Chems Eddine <chm@symisc.net>] 2012-2019, http://unqlite.org/"
|
#define UNQLITE_COPYRIGHT "Copyright (C) Symisc Systems, S.U.A.R.L [Mrad Chems Eddine <chm@symisc.net>] 2012-2013, http://unqlite.org/"
|
||||||
|
|
||||||
/* Forward declaration to public objects */
|
/* Forward declaration to public objects */
|
||||||
typedef struct unqlite_io_methods unqlite_io_methods;
|
typedef struct unqlite_io_methods unqlite_io_methods;
|
||||||
|
@ -403,7 +399,7 @@ typedef sxi64 unqlite_int64;
|
||||||
* Each options require a variable number of arguments.
|
* Each options require a variable number of arguments.
|
||||||
* The [unqlite_vm_config()] interface will return UNQLITE_OK on success, any other return
|
* The [unqlite_vm_config()] interface will return UNQLITE_OK on success, any other return
|
||||||
* value indicates failure.
|
* value indicates failure.
|
||||||
* There are many options but the most important are: UNQLITE_VM_CONFIG_OUTPUT which install
|
* There are many options but the most importants are: UNQLITE_VM_CONFIG_OUTPUT which install
|
||||||
* a VM output consumer callback, UNQLITE_VM_CONFIG_HTTP_REQUEST which parse and register
|
* a VM output consumer callback, UNQLITE_VM_CONFIG_HTTP_REQUEST which parse and register
|
||||||
* a HTTP request and UNQLITE_VM_CONFIG_ARGV_ENTRY which populate the $argv array.
|
* a HTTP request and UNQLITE_VM_CONFIG_ARGV_ENTRY which populate the $argv array.
|
||||||
* For a full discussion on the configuration verbs and their expected parameters, please
|
* For a full discussion on the configuration verbs and their expected parameters, please
|
||||||
|
@ -655,14 +651,14 @@ struct unqlite_vfs {
|
||||||
typedef sxu64 pgno;
|
typedef sxu64 pgno;
|
||||||
/*
|
/*
|
||||||
* A database disk page is represented by an instance
|
* A database disk page is represented by an instance
|
||||||
* of the following structure.
|
* of the follwoing structure.
|
||||||
*/
|
*/
|
||||||
typedef struct unqlite_page unqlite_page;
|
typedef struct unqlite_page unqlite_page;
|
||||||
struct unqlite_page
|
struct unqlite_page
|
||||||
{
|
{
|
||||||
unsigned char *zData; /* Content of this page */
|
unsigned char *zData; /* Content of this page */
|
||||||
void *pUserData; /* Extra content */
|
void *pUserData; /* Extra content */
|
||||||
pgno iPage; /* Page number for this page */
|
pgno pgno; /* Page number for this page */
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
* UnQLite handle to the underlying Key/Value Storage Engine (See below).
|
* UnQLite handle to the underlying Key/Value Storage Engine (See below).
|
||||||
|
@ -787,9 +783,9 @@ struct unqlite_kv_methods
|
||||||
#define UNQLITE_JOURNAL_FILE_SUFFIX "_unqlite_journal"
|
#define UNQLITE_JOURNAL_FILE_SUFFIX "_unqlite_journal"
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Call Context - Error Message Severity Level.
|
* Call Context - Error Message Serverity Level.
|
||||||
*
|
*
|
||||||
* The following constants are the allowed severity level that can
|
* The following constans are the allowed severity level that can
|
||||||
* passed as the second argument to the [unqlite_context_throw_error()] or
|
* passed as the second argument to the [unqlite_context_throw_error()] or
|
||||||
* [unqlite_context_throw_error_format()] interfaces.
|
* [unqlite_context_throw_error_format()] interfaces.
|
||||||
* Refer to the official documentation for additional information.
|
* Refer to the official documentation for additional information.
|
||||||
|
@ -807,7 +803,6 @@ UNQLITE_APIEXPORT int unqlite_open(unqlite **ppDB,const char *zFilename,unsigned
|
||||||
UNQLITE_APIEXPORT int unqlite_config(unqlite *pDb,int nOp,...);
|
UNQLITE_APIEXPORT int unqlite_config(unqlite *pDb,int nOp,...);
|
||||||
UNQLITE_APIEXPORT int unqlite_close(unqlite *pDb);
|
UNQLITE_APIEXPORT int unqlite_close(unqlite *pDb);
|
||||||
|
|
||||||
|
|
||||||
/* Key/Value (KV) Store Interfaces */
|
/* Key/Value (KV) Store Interfaces */
|
||||||
UNQLITE_APIEXPORT int unqlite_kv_store(unqlite *pDb,const void *pKey,int nKeyLen,const void *pData,unqlite_int64 nDataLen);
|
UNQLITE_APIEXPORT int unqlite_kv_store(unqlite *pDb,const void *pKey,int nKeyLen,const void *pData,unqlite_int64 nDataLen);
|
||||||
UNQLITE_APIEXPORT int unqlite_kv_append(unqlite *pDb,const void *pKey,int nKeyLen,const void *pData,unqlite_int64 nDataLen);
|
UNQLITE_APIEXPORT int unqlite_kv_append(unqlite *pDb,const void *pKey,int nKeyLen,const void *pData,unqlite_int64 nDataLen);
|
||||||
|
@ -950,7 +945,5 @@ UNQLITE_APIEXPORT const char * unqlite_lib_version(void);
|
||||||
UNQLITE_APIEXPORT const char * unqlite_lib_signature(void);
|
UNQLITE_APIEXPORT const char * unqlite_lib_signature(void);
|
||||||
UNQLITE_APIEXPORT const char * unqlite_lib_ident(void);
|
UNQLITE_APIEXPORT const char * unqlite_lib_ident(void);
|
||||||
UNQLITE_APIEXPORT const char * unqlite_lib_copyright(void);
|
UNQLITE_APIEXPORT const char * unqlite_lib_copyright(void);
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* _UNQLITE_H_ */
|
#endif /* _UNQLITE_H_ */
|
Loading…
Add table
Reference in a new issue