pybsddb with cffi

Check-in [e29f86fbe7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:passed test_associate
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:e29f86fbe7b19145d8979a463e6b05fdd6008fef
User & Date: broker-3 2013-02-07 10:13:55
Context
2013-02-07
13:34
added original test_dbshelve.py check-in: aad7dc3724 user: broker-3 tags: trunk
10:13
passed test_associate check-in: e29f86fbe7 user: broker-3 tags: trunk
2013-02-06
17:38
pass test_join check-in: 47e4a41be9 user: broker-3 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to bsddb3/db.py.

1754
1755
1756
1757
1758
1759
1760

1761


1762
1763
1764
1765
1766
1767
1768
1769
1770

1771
1772


1773
1774

1775
1776
1777
1778
1779
1780
1781
                        raise Exception("Not yet")
            else:
                raise TypeError()

        # key, data=None, flags=0, dlen= -1, doff= -1
        self._check_dbc(self.dbc)
        db = self.mydb

        key, _ = _make_key_dbt(db, key, None)


        data = _make_dbt(data)
        _add_partial_dbt(data, dlen, doff)
        err = self.dbc.get(self.dbc, key, data, flags)
        if (err == DB_NOTFOUND or err == DB_KEYEMPTY) and db._getReturnsNone:
            return
        check_error(err)
        dbtype = db.get_type()
        if dbtype == -1:
            raise Exception("wrong type")

        if dbtype == DB_RECNO or dbtype == DB_QUEUE:
            raise Exception("not yet")


        return (ffi.buffer(key.data, key.size)[:],
                ffi.buffer(data.data, data.size)[:])


    def pget(self, *args, **kwargs):
        # I hate original kwargs hell
        flags = kwargs.get('flags', 0)
        data = kwargs.get('data', None)
        dlen = kwargs.get('dlen', -1)
        doff = kwargs.get('doff', -1)







>
|
>
>









>

<
>
>
|
<
>







1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775

1776
1777
1778

1779
1780
1781
1782
1783
1784
1785
1786
                        raise Exception("Not yet")
            else:
                raise TypeError()

        # key, data=None, flags=0, dlen= -1, doff= -1
        self._check_dbc(self.dbc)
        db = self.mydb
        if key is not None:
            key, flags = _make_key_dbt(db, key, flags)
        else:
            key = ffi.new("DBT *")
        data = _make_dbt(data)
        _add_partial_dbt(data, dlen, doff)
        err = self.dbc.get(self.dbc, key, data, flags)
        if (err == DB_NOTFOUND or err == DB_KEYEMPTY) and db._getReturnsNone:
            return
        check_error(err)
        dbtype = db.get_type()
        if dbtype == -1:
            raise Exception("wrong type")
        data = ffi.buffer(data.data, data.size)[:]
        if dbtype == DB_RECNO or dbtype == DB_QUEUE:

            key = ffi.cast("int *", key.data)[0]  # db_recno_t
        else:
            key = ffi.buffer(key.data, key.size)[:]

        return key, data

    def pget(self, *args, **kwargs):
        # I hate original kwargs hell
        flags = kwargs.get('flags', 0)
        data = kwargs.get('data', None)
        dlen = kwargs.get('dlen', -1)
        doff = kwargs.get('doff', -1)