debuggers: import openocd-0.7.0
Initial check-in of openocd-0.7.0 as it can be downloaded from http://sourceforge.net/projects/openocd/files/openocd/0.7.0/ Any modifications will follow. Change-Id: I6949beaefd589e046395ea0cb80f4e1ab1654d55
This commit is contained in:
60
debuggers/openocd/jimtcl/sqlite3/README
Normal file
60
debuggers/openocd/jimtcl/sqlite3/README
Normal file
@ -0,0 +1,60 @@
|
||||
Full sqlite3 Extension for Jim Tcl
|
||||
==================================
|
||||
|
||||
Author: Steve Bennett <steveb@workware.net.au>
|
||||
Date: Thu 24 Nov 2011
|
||||
|
||||
This directory builds a Jim Tcl extension containing a complete sqlite3 implementation and binding.
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
Ensure that you have configured and built jim in the source directory, then:
|
||||
|
||||
$ make
|
||||
|
||||
./build-ext -o sqlite3.so -I.. -L.. -DSQLITE_OMIT_LOAD_EXTENSION=1 ... jim-sqlite3.c sqlite3.c
|
||||
Building sqlite3.so from jim-sqlite3.c sqlite3.c
|
||||
|
||||
Warning: libjim is static. Dynamic module may not work on some platforms.
|
||||
|
||||
Compile: jim-sqlite3.o
|
||||
Compile: sqlite3.o
|
||||
Link: sqlite3.so
|
||||
|
||||
Success!
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
$ make test
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Copy sqlite3.so to your jim library directory, typically /usr/local/lib/jim or
|
||||
where $JIMLIB points to.
|
||||
|
||||
Using
|
||||
-----
|
||||
In your Jim Tcl code, ensure that sqlite3.so is in a directory on $auto_path.
|
||||
Then:
|
||||
|
||||
package require sqlite3
|
||||
|
||||
sqlite3 db test.db
|
||||
...etc..
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
The Jim Tcl binding is almost exactly identical to the Tcl binding.
|
||||
See http://www.sqlite.org/tclsqlite.html for documentation.
|
||||
|
||||
Differences:
|
||||
- INCRBLOB is not supported as Jim Tcl does not support channels
|
||||
- No attempt is made to change encoding between Jim Tcl and sqlite
|
||||
- Jim Tcl doesn't differentiate between binary data (bytearray) and
|
||||
string, so only the @field syntax causes a fieldsto be bound
|
||||
as a blob rather than text.
|
||||
- Jim Tcl doesn't have a boolean type
|
||||
2830
debuggers/openocd/jimtcl/sqlite3/jim-sqlite3.c
Normal file
2830
debuggers/openocd/jimtcl/sqlite3/jim-sqlite3.c
Normal file
File diff suppressed because it is too large
Load Diff
131878
debuggers/openocd/jimtcl/sqlite3/sqlite3.c
Normal file
131878
debuggers/openocd/jimtcl/sqlite3/sqlite3.c
Normal file
File diff suppressed because it is too large
Load Diff
6794
debuggers/openocd/jimtcl/sqlite3/sqlite3.h
Normal file
6794
debuggers/openocd/jimtcl/sqlite3/sqlite3.h
Normal file
File diff suppressed because it is too large
Load Diff
51
debuggers/openocd/jimtcl/sqlite3/test-sqlite3.tcl
Normal file
51
debuggers/openocd/jimtcl/sqlite3/test-sqlite3.tcl
Normal file
@ -0,0 +1,51 @@
|
||||
# A simple test of the "big" sqlite3 extension
|
||||
|
||||
lappend auto_path .
|
||||
|
||||
package require sqlite3
|
||||
|
||||
# Create an in-memory database and add some data
|
||||
sqlite3 db :memory:
|
||||
db eval {CREATE TABLE history (type, time, value)}
|
||||
foreach t [range 1 50] {
|
||||
set temp [rand 100]
|
||||
db eval {INSERT INTO history (type, time, value) VALUES ('temp', :t, :temp)}
|
||||
}
|
||||
foreach t [range 2 50 2] {
|
||||
set v $([rand 200] / 10.0 + 5)
|
||||
db eval {INSERT INTO history (type, time, value) VALUES ('voltage', :t, :v)}
|
||||
}
|
||||
|
||||
# Output some data in SVG format.
|
||||
puts "\nSVG Example\n"
|
||||
|
||||
set points {}
|
||||
db eval {SELECT time,value FROM history
|
||||
WHERE (time >= 10 and time <= 30) and type = 'voltage'
|
||||
ORDER BY time DESC} row {
|
||||
lappend points $row(time),$row(value)
|
||||
}
|
||||
puts "<polyline points=\"$points\" />"
|
||||
|
||||
# And tabular format with a self outer join
|
||||
puts "\nTabular Self Outer Join Example\n"
|
||||
|
||||
proc showrow {args} {
|
||||
puts [format "%-12s %-12s %-12s" {*}$args]
|
||||
}
|
||||
|
||||
showrow Time Temp Voltage
|
||||
showrow ---- ---- -------
|
||||
db eval {SELECT * FROM (SELECT time, value AS temp FROM history WHERE type = 'temp') AS A
|
||||
LEFT OUTER JOIN (SELECT time, value AS voltage FROM history WHERE type = 'voltage') AS B
|
||||
USING (time)
|
||||
WHERE time >= 10 AND time <= 30
|
||||
ORDER BY time} row {
|
||||
showrow $row(time) $row(temp) $row(voltage)
|
||||
}
|
||||
set maxtemp [db eval {SELECT max(value) FROM history WHERE type = 'temp'}]
|
||||
set maxvolt [db eval {SELECT max(value) AS maxvolt FROM history WHERE type = 'voltage'}]
|
||||
showrow ---- ---- -------
|
||||
showrow max $maxtemp $maxvolt
|
||||
|
||||
db close
|
||||
Reference in New Issue
Block a user