So, if you decide to use ODBC, this package might be interesting for you if you are familiar with SQl but not with ODBC, and you just want to connect to a database and execute query statements, without caring about odbc handles, data types, and API calls.
On the other hand, if you need to access the raw odbc api you can still use the classes to hide away bulk operations:
SqlResult r = (new OdbcConnection).connect("someserver").execDirect("select something from somewhere"); HSTMT hstmt = r.handle();
import std.stdio; import sdbo.odbc; void main() { /* Hello world example */ try { (new OdbcEnvironment).connect("foo").execDirect("bar"); } catch(SqlException e) { fwritefln(stderr, "Hello world!"); e.print(); } }
More Examples ...
Version Linux
All Versions
Actually I had to do some modifications in the odbc headers for sdbo.lib and libsdbo.a to compile, and MKoD's declaration files are not finished yet, so I bundled a copy of them that works with this project. If the samples won´t compile, use -version=bundled_headers which causes the std.c.windows.* modules to be ignored and the bundled headers to be used. The bundled headers are going to disappear as soon as the MKoD headers are in a stable release.
The linux version always compiles with the bundled headers.
Version Windows
Version Linux
ECHO import sdbo.odbc; void main() { (new OdbcEnvironment).connect("foobar"); } > odbc_test.d dmd odbc_test.d sdbo.lib odbc_test
dmd -version=bundled_headers odbc_test.d sdbo.lib odbc_test
Version Linux
echo "import sdbo.odbc; void main() { (new OdbcEnvironment).connect(\"foobar\"); }" > odbc_test.d dmd -c odbc_test.d [-I/path/to/simple] gcc -o odbc_test odbc_test.o -lsdbo -lphobos -lpthread -lm -lodbc
dmd -c odbc_test.d [-I/path/to/simple] gcc -o odbc_test odbc_test.o /path/to/libodbc.a -lphobos -lpthread -lm -lodbc
0.1 just means it is not finished yet. The package release is a zip file in the project's svn at dsource.org. The zip is called "sdbo-0.1.*.zip, being * an incremental number idicating changes to the 0.1 package. I am trying to maintain the zip file synchronized with the trunk. Compare the last digit of the file you downloaded and the file available here: http://svn.dsource.org/svn/projects/sdbo/downloads/ If they differ, your package is not up to date.
Starting from 0.1.6, there is now a package sdbo-0.1.*.tar.gz. The content is identical.