Mercurial > hg > audiodb
comparison bindings/python/pyadb.py @ 719:e3f1cf653c30
wooo! direct insert works! at least for the rather limited cases I've tests.
Bad news is that I seem to have found a rather nasty bug in the query code I wrote back in september.
(segfaults around line 471 if the query returns no results...)
author | map01bf |
---|---|
date | Fri, 25 Jun 2010 09:08:56 +0000 |
parents | 159becb0701e |
children | 2fad8cfdb2d8 |
comparison
equal
deleted
inserted
replaced
718:14568e432e73 | 719:e3f1cf653c30 |
---|---|
76 pass | 76 pass |
77 if key: | 77 if key: |
78 args["key"]=str(key) | 78 args["key"]=str(key) |
79 if featFile: | 79 if featFile: |
80 if not _pyadb._pyadb_insertFromFile(**args): | 80 if not _pyadb._pyadb_insertFromFile(**args): |
81 raise(RuntimeError, "Insertion from file failed for an unknown reason.") | 81 raise RuntimeError("Insertion from file failed for an unknown reason.") |
82 else: | 82 else: |
83 self._updateDBAttributes() | 83 self._updateDBAttributes() |
84 return | 84 return |
85 elif (featData != None): | 85 elif (featData != None): |
86 if (len(args["features"].shape) == 1) : args["features"] = args["features"].reshape((args["features"].shape[0],1)) | 86 if (len(args["features"].shape) == 1) : args["features"] = args["features"].reshape((args["features"].shape[0],1)) |
87 args["nDim"], args["nVect"] = args["features"].shape | 87 args["nDim"], args["nVect"] = args["features"].shape |
88 args["features"] = args["features"].flatten() | 88 args["features"] = args["features"].flatten() |
89 print "args: " + str(args) | 89 print "args: " + str(args) |
90 if not _pyadb._pyadb_insertFromArray(**args): | 90 ok = _pyadb._pyadb_insertFromArray(**args) |
91 raise(RuntimeError, "Direct data insertion failed for an unknown reason.") | 91 if not (ok==0): |
92 raise RuntimeError("Direct data insertion failed for an unknown reason. err code = %i"%ok) | |
92 else: | 93 else: |
93 self._updateDBAttributes() | 94 self._updateDBAttributes() |
94 return | 95 return |
95 | 96 |
96 def configCheck(self, scrub=False): | 97 def configCheck(self, scrub=False): |