rogerbinns / apsw Goto Github PK
View Code? Open in Web Editor NEWAnother Python SQLite wrapper
Home Page: https://rogerbinns.github.io/apsw/
License: Other
Another Python SQLite wrapper
Home Page: https://rogerbinns.github.io/apsw/
License: Other
From rogerbinns on December 25, 2008 01:33:18
The DlSym callback prototype changed and causes a compile warning. Fix this.
Original issue: http://code.google.com/p/apsw/issues/detail?id=39
From rogerbinns on March 03, 2009 22:54:57
It should be possible to make derived cursors by passing the class to the
Connection.cursor() method. Check interaction with weakrefs and close
calls. fetchall may also need to use virtual step.
Example code:
class foo: pass
con=apsw.Connection("...")
cur=con.cursor(foo)
Original issue: http://code.google.com/p/apsw/issues/detail?id=43
From rogerbinns on April 11, 2009 11:18:10
C:\builds\apsw-3.6.11- r1 >python setup.py build
SQLite: Using amalgamation C:\builds\apsw-3.6.11- r1 \sqlite3.c
running build
running build_ext
building 'apsw' extension
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox
/MD /W
3 /GS- /DNDEBUG -DSQLITE_THREADSAFE=1 -DEXPERIMENTAL=1 -DNDEBUG=1
-DAPSW_USE_SQL
ITE_AMALGAMATION="C:\builds\apsw-3.6.11- r1 \sqlite3.c" -Isrc
-IC:\builds\apsw-3
.6.11- r1 -IC:\Python26\include -IC:\Python26\PC /Tcsrc/apsw.c
/Fobuild\temp.win3
2-2.6\Release\src/apsw.obj
apsw.c
c:\builds\apsw-3.6.11- r1 \src\exceptions.c(173) : error C2143: syntax error
: mis
sing ';' before ''
c:\builds\apsw-3.6.11- r1 \src\exceptions.c(173) : error C2143: syntax error
: mis
sing ';' before 'const'
c:\builds\apsw-3.6.11- r1 \src\exceptions.c(174) : warning C4047:
'initializing' :
'int' differs in levels of indirection from 'PyObject **'
c:\builds\apsw-3.6.11- r1 \src\exceptions.c(174) : error C2078: too many
initializ
ers
etc etc
Original issue: http://code.google.com/p/apsw/issues/detail?id=47
From rogerbinns on September 25, 2008 15:52:02
An example use case is for the filesource from the example to work in the
SQLite command line interpreter.
There are a number of parts needed to get this to work:
Original issue: http://code.google.com/p/apsw/issues/detail?id=28
From rogerbinns on October 02, 2008 18:18:36
See http://www.python.org/dev/peps/pep-0370/ available in Python 2.6 and
presumably Python 3.0
Original issue: http://code.google.com/p/apsw/issues/detail?id=29
From rogerbinns on November 24, 2008 21:53:18
There are crashes in ntdll.dll on Vista
Original issue: http://code.google.com/p/apsw/issues/detail?id=36
From rogerbinns on April 05, 2008 03:37:25
See last paragraph of http://www.sqlite.org/faq.html#q6 Currently I can't find any way of catching interpretter forks. The
PyOS_AfterFork method is called but doesn't provide any way to hook into it.
A possible solution is to check the pid in calls and if different from when
the object was allocated, mark it and all related cursors/blobs as closed
(which will leak memory but can't be avoided).
Update the doc for Connection.close() to mention it would be a good idea to
call it before forking.
Original issue: http://code.google.com/p/apsw/issues/detail?id=10
From rogerbinns on June 12, 2009 12:03:34
Need to ensure the code and documentation match the builtin file type
especially in the case of end of file being reached.
Original issue: http://code.google.com/p/apsw/issues/detail?id=50
From qwavel on March 14, 2009 09:21:45
Look at the project's main page on Google code.
The list of releases contains dates that don't make sense. It makes it
look like the latest release is Feb 2008, but upon closer inspection this
appears to be incorrect.
Original issue: http://code.google.com/p/apsw/issues/detail?id=46
From rogerbinns on April 05, 2008 03:30:00
This is to match the parameters in sqlite_openv2, flags and vfs args.
statementcache size would also be useful
Original issue: http://code.google.com/p/apsw/issues/detail?id=5
From dawmster on February 24, 2009 05:41:11
What steps will reproduce the problem? 1. Just open the CHM file and click on a topic in contents tab What is the expected output? What do you see instead? 1. There should documentation apear about clicked topic
2. But in contents windows there is only : Incorrect Address What version of the product are you using? On what operating system? APSW v3.6.11- r1 documentation Please provide any additional information below. Windows XP Pro SP3, IE 7 installed.
Cheers
Original issue: http://code.google.com/p/apsw/issues/detail?id=42
From rogerbinns on April 05, 2008 03:32:20
Allow use of enter and exit in Python 2.5+
Original issue: http://code.google.com/p/apsw/issues/detail?id=8
From rogerbinns on September 09, 2008 20:31:27
for row in cur.execute("select 3"): pass
print row
(3L,)
Prior to apsw-3.5.9- r2 this would have been returned as int.
Original issue: http://code.google.com/p/apsw/issues/detail?id=24
From rogerbinns on April 05, 2008 03:34:26
This is a minor performance issue.
Original issue: http://code.google.com/p/apsw/issues/detail?id=9
From [email protected] on July 18, 2008 09:27:29
(from the sqlite mailinglist):
From: Nikolaus Rath [email protected]
Subject: Re: Does changing the db change result sets?
Newsgroups: gmane.comp.db.sqlite.general
To: [email protected]
Date: the 18th of July 2008 at 12:09
Reply-To: General Discussion of SQLite Database
[email protected]
"Igor Tandetnik" [email protected] writes:
"Nikolaus Rath" [email protected] wrote in
message news:[email protected]What happens if
- I prepare and execute a select statement
- I retrieve a couple of rows
- I execute a new query that would change the result of the
query in 1On the same connection, I assume.
Yes.
- I continue to retrieve the results of 1)
Will I get the results as if step 3 hasn't happened, is the result
undefined, or will my result set somehow be updated?You may or may not see the changes introduced by step 3. E.g. if
step 3 updates a record that you've already visited, you naturally
won't visit it again and thus won't see the changes. But if it
updates a record you haven't visited yet, when you get to it you
will see the new data.
This doesn't seem right when I test it. "numbers" is a table with one
column containing the numbers 1 to 10. When using the python
interface:
import apsw
conn=apsw.Connection("data")
cursor = conn.cursor()
res = cursor.execute("select * from numbers")
res.next()
(1,)
res.next()
(2,)
res.next()
(3,)
cursor.execute("delete from numbers where no=5")
res.next()
Traceback (most recent call last):
File "", line 1, in
StopIteration
So as soon as I make a change in the database, I do not get any more
results. If I understood you correctly, I should have gotten (4,)
instead.
Is this a bug?
rom: Dennis Cote [email protected]
Subject: Re: Does changing the db change result sets?
Newsgroups: gmane.comp.db.sqlite.general
To: General Discussion of SQLite Database
[email protected]
Date: the 18th of July 2008 at 16:00
Reply-To: General Discussion of SQLite Database
[email protected]
Nikolaus Rath wrote:
So as soon as I make a change in the database, I do not get any more
results. If I understood you correctly, I should have gotten (4,)
instead.Is this a bug?
It is probably a bug (or a design decision) in the apsw wrapper. The
following program produces the expected output using the C API functions.
using namespace std;
int main(int argc, char argv[])
{
sqlite3 db;
sqlite3_open("test.db3", &db);
sqlite3_exec(db, "create table numbers (n integer)", 0, 0, 0);
char sql[100];
for (int i = 1; i <=10; ++i) {
sprintf(sql, "insert into numbers values(%d)", i);
sqlite3_exec(db, sql, 0, 0, 0);
}
sqlite3_stmt* s;
sqlite3_prepare(db, "select * from numbers", -1, &s, 0);
sqlite3_step(s);
printf("%d\n", sqlite3_column_int(s, 0));
sqlite3_step(s);
printf("%d\n", sqlite3_column_int(s, 0));
sqlite3_step(s);
printf("%d\n", sqlite3_column_int(s, 0));
sqlite3_exec(db, "delete from numbers where n = 5", 0, 0, 0);
sqlite3_step(s);
printf("%d\n", sqlite3_column_int(s, 0));
sqlite3_step(s);
printf("%d\n", sqlite3_column_int(s, 0));
sqlite3_step(s);
printf("%d\n", sqlite3_column_int(s, 0));
sqlite3_finalize(s);
sqlite3_close(db);
system("PAUSE");
return EXIT_SUCCESS;
}
This produces:
1
2
3
4
6
7
Press any key to continue . . .
Original issue: http://code.google.com/p/apsw/issues/detail?id=19
From rogerbinns on July 27, 2008 22:56:02
The following functions are not wrapped:
Original issue: http://code.google.com/p/apsw/issues/detail?id=20
From pavlos.casa on November 26, 2008 05:30:27
Would be a good idea to allow customization of the standard cursor object.
Perhaps apsw.Connection can be extended to receive a custom cursor class as
a parameter and if provided, the cursor return is an instance of the custom
class. for that to work well the cursor object should allow subclassing in
python.
here is a typical use case:
class MyCursor(apsw.Cursor):
def fetchall(self):
return [i for in in self]
con = apsw.Connection(custom_cursor = MyCursor)
Original issue: http://code.google.com/p/apsw/issues/detail?id=37
From rogerbinns on December 25, 2008 01:33:59
The time formatting is supposed to always display milliseconds but instead
starts doing centiseconds or even less precision.
Original issue: http://code.google.com/p/apsw/issues/detail?id=40
From rogerbinns on November 22, 2008 19:58:08
You should be able to set exec/row tracers on the Connection. These should
be used by the cursors unless they explicitly have one set (or None to
disable).
Original issue: http://code.google.com/p/apsw/issues/detail?id=34
From nirvana117 on March 22, 2008 03:38:18
What steps will reproduce the problem? 1. import apsw
2. apsw.Connection(":memory:") What version of the product are you using? On what operating system? apsw-3.3.13- r1 , Stackless_Python_2.5.2, on windows_xp_sp2 or 2003_sp2. Please provide any additional information below. I have tested pysqlite and apsw, but only apsw would crash stackless
python, not pysqlite. So I thought there may be some problem in apsw.
Original issue: http://code.google.com/p/apsw/issues/detail?id=3
From rogerbinns on November 12, 2008 13:50:59
Implement a method that outputs something like the shell's .dump. The use
case is someone having a memory database and wanting to attach and then
copy the contents to a disk database, or vice versa.
Original issue: http://code.google.com/p/apsw/issues/detail?id=32
From rogerbinns on March 10, 2008 02:06:22
(pysqlite #221)
Rather than a hard coded default
Original issue: http://code.google.com/p/apsw/issues/detail?id=2
From rogerbinns on May 06, 2008 10:48:32
http://itsystementwicklung.de/pipermail/list-pysqlite/2008-May/000048.html
Original issue: http://code.google.com/p/apsw/issues/detail?id=15
From rogerbinns on September 14, 2008 20:17:37
See thread http://itsystementwicklung.de/pipermail/list-pysqlite/2008-September/000149.html
Original issue: http://code.google.com/p/apsw/issues/detail?id=26
From rogerbinns on September 21, 2008 03:10:13
Python 2.5 accepts unicode objects for buffers which is usually not what I
intended. Each usage should be checked to make sure that unicode is not
accepted if what I really wanted was bytes only
Original issue: http://code.google.com/p/apsw/issues/detail?id=27
From rogerbinns on April 08, 2008 15:39:31
This mainly involves:
Original issue: http://code.google.com/p/apsw/issues/detail?id=11
From rogerbinns on April 05, 2008 03:31:42
The code to load an extension isn't forcing the filename to utf8 first
Original issue: http://code.google.com/p/apsw/issues/detail?id=7
From rogerbinns on August 05, 2008 22:52:17
http://sqlite.org/cvstrac/chngview?cn=5539
Original issue: http://code.google.com/p/apsw/issues/detail?id=21
From rogerbinns on September 12, 2008 14:55:49
Update setup.py to look for --download-sqlite in sys.argv and then
automatically grab the amalgamation from http://sqlite.org/download.html parse the html to find sqlite-amalgamation-3_[0-9]+_[0-9]+.zip and grab it.
Original issue: http://code.google.com/p/apsw/issues/detail?id=25
From rogerbinns on November 23, 2008 03:52:33
Add/document a tracing module so that this works:
python -m mylogger /path/to/program.py arg1 arg2 arg3
Original issue: http://code.google.com/p/apsw/issues/detail?id=35
From rogerbinns on May 09, 2008 22:01:30
SQLite has now been fixed so we can clear bindings immediately after use http://www.sqlite.org/cvstrac/tktview?tn=3063
Original issue: http://code.google.com/p/apsw/issues/detail?id=16
From rogerbinns on December 27, 2008 02:27:39
leading comments should also be stripped otherwise the output is verbose
and horrible
Original issue: http://code.google.com/p/apsw/issues/detail?id=41
From rogerbinns on March 10, 2009 20:26:51
In particular sdist (make a source distro) and bdist_rpm should work.
Original issue: http://code.google.com/p/apsw/issues/detail?id=44
From [email protected] on June 09, 2009 16:13:32
I have a testcase (which is still too long to attach it here) which fails
with the following output:
Traceback (most recent call last):
File "./tests/02_fs_api.py", line 43, in tearDown
self.server.close()
File "/home/nikratio/lib/EclipseWorkspace/s3ql/s3ql/fs.py", line 597, in
close
cur.cursor.execute("VACUUM")
File "apsw.c", line 4238, in resetcursor
BusyError: BusyError: database is locked
However, line 597 in fs.py actually looks like this:
cur.cursor.getconnection().setbusytimeout(50000)
cur.cursor.execute("VACUUM")
so it seems to me that the tests should take at least 50 seconds to run.
But it aborts in a fraction of a second.
I know that this behaviour is probably not the cause of my real bug
(because manually adding a sleep(50) doesn't fix it), but I wonder if it
may somehow be possible that apsw thinks the database is locked (and
therefore returns the exception) while it actually isn't (which is why it
doesn't wait).
Original issue: http://code.google.com/p/apsw/issues/detail?id=49
From [email protected] on June 08, 2009 11:20:52
In http://apsw.googlecode.com/svn/publish/cursor.html it says that the
preferred way to do changes to a database is this one:
| You can also get all the rows immediately by filling in a list:
|
| rows=list( cursor.execute("select * from example") )
| for row in rows:
| cursor.execute("insert ...")
|
| This last approach is recommended since you don’t have to worry
| about the database changing while doing the select.
From this I understand that changing the database (even if using a
different cursor) may mess with the result set of the running query.
However, when I tried to test this behaviour (try attached testcase) it
seems that the result set is not affected.
Unfortunately I also could not find any information about the expected
behavior in this situation on the SQLite website.
Do you have any information on which behaviour I can rely on? I would
rather avoid having te fetch the entire result set into a list, both for
performance and style reasons.
Attachment: 05_apsw.py
Original issue: http://code.google.com/p/apsw/issues/detail?id=48
From rogerbinns on June 30, 2008 14:40:43
See http://www.sqlite.org/cvstrac/tktview?tn=3195 They should either be removed or made conditional #ifdef
Original issue: http://code.google.com/p/apsw/issues/detail?id=17
From rogerbinns on April 16, 2008 15:55:08
http://sqlite.org/c3ref/limit.html
Original issue: http://code.google.com/p/apsw/issues/detail?id=13
From rogerbinns on November 22, 2008 19:57:12
The Connection object should have some attributes with useful information.
This could include:
Original issue: http://code.google.com/p/apsw/issues/detail?id=33
From basti1302 on April 02, 2008 03:10:38
The method Cursor.executes seems to behaves differently when used with the
optional bindings argument compared to using it without the bindings
argument. More specifically, the error message when trying to insert a
NULL value into an PRIMARY KEY NOT NULL column (without autoincrement in
place) is different. The error message in the first case (with bindings)
is less helpful than it could be. I'm not sure if this is intended
behaviour, IMHO it's a bit confusing.
The following program demonstrates the difference:
import apsw
print "apsw.apswversion(): " + apsw.apswversion()
print "apsw.sqlitelibversion(): " + apsw.sqlitelibversion()
connection = apsw.Connection("dbfile")
cursor = connection.cursor()
try:
print "test 1"
try:
cursor.execute("DROP TABLE A_TABLE")
cursor.execute("CREATE TABLE A_TABLE (ID ABC PRIMARY KEY NOT NULL,
SOME_VALUE TEXT)")
cursor.execute("INSERT INTO A_TABLE VALUES (NULL, 'Foobar')")
except Exception, e:
print e
print "test 2"
try:
cursor.execute("DROP TABLE A_TABLE")
cursor.execute("CREATE TABLE A_TABLE (ID ABC PRIMARY KEY NOT NULL,
SOME_VALUE TEXT)")
cursor.execute("INSERT INTO A_TABLE VALUES (NULL, ?)", ("Foobar",))
except Exception, e:
print e
finally:
connection.close()
The output of this program is:
apsw.apswversion(): 3.3.13- r1 apsw.sqlitelibversion(): 3.3.13
test 1
ConstraintError: A_TABLE.ID may not be NULL
test 2
ConstraintError: not an error
In both tests, a table is created with an ID column and a value column.
The column affinity of ID is set to ABC (which is a nonsense value), so it
defaults to NUMERIC, afaik. The point is that it the column is not INTEGER
PRIMARY KEY NOT NULL, so we have no autoincrement, as specified in the
sqlite docs. Because of that, inserting NULL should be illegal.
In test 1, the exception raised is "ConstraintError: A_TABLE.ID may not be
NULL", as expected. However, in test 2, the exception is "ConstraintError:
not an error" which sounds a bit paradox to me.
Note 1: This is on Windows 2000, Python 2.5
Note 2: This may or may not be related to this bug report: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=456500 but I don't really know how this Debian package bug reports relate to apsw
bug reports.
Regards
Bastian Krol
Original issue: http://code.google.com/p/apsw/issues/detail?id=4
From rogerbinns on September 01, 2008 16:28:09
Google chokes on individual files larget than 200kb. It is also harder to
find code or potentially disable it. So split the C code into several
files (eg connection.c, cursor.c, vtable.c, vfs.c) and then have apsw.c
Also investigate using sphinx for doc and folding the various API doc into
comments above the corresponding C implementation.
Original issue: http://code.google.com/p/apsw/issues/detail?id=23
From rogerbinns on March 10, 2009 20:29:47
genfkey was moved into the sqlite shell but isn't available in any other
way. The relevant snippet of code can be extracted and then made available
in apsw too.
It seems unlikely that the SQLite team will put the code in an accessible
place even though it was requested in http://www.sqlite.org/cvstrac/tktview?tn=3687
Original issue: http://code.google.com/p/apsw/issues/detail?id=45
From rogerbinns on April 09, 2008 01:11:45
The C api reference has moved to http://sqlite.org/c3ref from http://sqlite.org/capi3ref.html so all the links in the HTML need to be
changed.
Original issue: http://code.google.com/p/apsw/issues/detail?id=12
From [email protected] on July 17, 2008 08:34:37
I want to store short binary strings in a table. Therefore I do not want to
use the stream interface, but simply say, e.g.
cursor.execute("INSERT INTO foo VALUES(?)", ("\xCF\xDE",))
but this produces a conversion error, even if the column affinity is BLOB:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcf in position 4:
ordinal not in range(128)
Original issue: http://code.google.com/p/apsw/issues/detail?id=18
From amicitas on October 24, 2008 13:05:39
What steps will reproduce the problem? 1. Attempt to simultaneously use the same connection in two threads. What is the expected output? What do you see instead? It would be very nice if an error was raised if this is attempted. At this
point the application just hangs with no error output. What version of the product are you using? On what operating system? apsw 3.5.9- r2 , python 2.5 & 2.6, windows xp sp3 Please provide any additional information below. The documentation does clearly state that a connection cannot be used in
more than one thread. If it is attempted the application just hangs. Both
threads stop as well as the main program. I would be nice if an error was
thrown as it is if the cursor is used in two threads.
-- amicitas
Original issue: http://code.google.com/p/apsw/issues/detail?id=31
From rogerbinns on April 05, 2008 03:30:44
It should be possible to create your own vfs in python
Original issue: http://code.google.com/p/apsw/issues/detail?id=6
From rogerbinns on October 02, 2008 18:22:10
The tpflag allows Python 2.6+ to have an attribute cache but causes issues
if direct manipulation of the object dict happens from C. I don't do that
so it should be safe to add. See also http://bugs.python.org/issue1878
Original issue: http://code.google.com/p/apsw/issues/detail?id=30
From rogerbinns on November 27, 2008 05:17:25
speedtest should also be able to use the sqlite module builtin to python
Original issue: http://code.google.com/p/apsw/issues/detail?id=38
From rogerbinns on August 09, 2008 03:43:57
Diff of header files suggests these
sqlite3_db_config
SQLITE_CONFIG_CHUNKALLOC
SQLITE_CONFIG_LOOKASIDE
SQLITE_DBCONFIG_LOOKASIDE
SQLITE_STATUS_MALLOC_SIZE (read comment changes in detail)
SQLITE_STATUS_PARSER+STACK
SQLITE_STATUS_PAGECACHE_SIZE
SQLITE_STATUS_SCRATCH_SIZE
sqlite3_db_status
SQLITE_DBSTATUS_LOOKASIDE_USED
Original issue: http://code.google.com/p/apsw/issues/detail?id=22
From rogerbinns on March 10, 2008 01:58:18
(pysqlite ticket 192)
apsw Example on http://initd.org/pub/software/pysqlite/apsw/3.3.13-r1/apsw.html Has a bug when run under Windows. This bug is caused by the conflict
between Windows use of backslash () as the path separator and Python's use
of forwardslash (/) as the path separator.
with line: sysdirs=",".join(["'%s'" % (x,) for x in sys.path[1:] if len(x)
and os.path.isdir(x)]) The execution error terminates with the tail of its
output as follows:
no commits out of hours commit was not allowed
Traceback (most recent call last):
File "D:\Python\00 Projects\IRR\apswTest.py", line 342, in -toplevel-
cursor.execute("create virtual table sysfiles using
filesource("+sysdirs+")")
File "apsw.c", line 3518, in resetcursor File "apsw.c", line 2460, in
VirtualTable?.xCreate File "D:\Python\00 Projects\IRR\apswTest.py", line
291, in Create
columns,data=getfiledata([eval(a) for a in args]) # eval strips off
layer of quotes
File "D:\Python\00 Projects\IRR\apswTest.py", line 278, in getfiledata
for f in os.listdir(directory):
WindowsError?: [Errno 123] The filename, directory name, or volume label
syntax is incorrect: 'C:\x08in\Python24\Lib\idlelib/.'
with line: sysdirs=",".join(["'%s'" % (x.replace('','/'),) for x in
sys.path[1:] if len(x) and os.path.isdir(x)]) The execution terminates
normally without error.
Original issue: http://code.google.com/p/apsw/issues/detail?id=1
From rogerbinns on April 21, 2008 03:09:38
Several version 2 functions have appeared and should be used.
Original issue: http://code.google.com/p/apsw/issues/detail?id=14
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.