SQL Server module for Blitzmax - Announcement

BlitzMax Forums/BlitzMax Programming/SQL Server module for Blitzmax - Announcement

byo(Posted 2009) [#1]
Hi, guys.

This is my first module for Blitzmax.
It's an SQL Server module for Windows only.

Hope you enjoy it.

Go here:
http://byomods.googlecode.com
Read more here:
http://www.microsoft.com/SQL/default.mspx

Please tell me what you think of it. Hope it can be useful to anyone.

Cheers!

Andre Guerreiro Neto (byo)


xlsior(Posted 2009) [#2]
Since it doesn't appear to come with any documentation at this point:

How 'complete' is this module?
Doyou support things like date/time fields, binary blobs, etc, or just the basics?


byo(Posted 2009) [#3]
Hi, xlsior.

It's very basic right now and not complete.
But you can use it almost the same as a TADoConnection and a TADOQuery in Delphi. There is an example included.

[EDIT]
I know the documentation is poor but time is not on my side right now. For ever method you have a bbdoc explanation of what it does.

Basically it's just two small classes:
TSQLServer - a connection object.
TCursor - a resultset object that can be used from the TSQLServer's 'query' method. You can have as many TCursors as you want per connection. Then, with the TCursor, you navigate through the records with 'nextRow', 'lastRow', etc. and retrieve the values with 'getString', 'getInt', 'getFloat', etc.

I'll try adding more features. The reason I made it is that I was needing it for a project.

Cheers!


Brucey(Posted 2009) [#4]
Cool. Always nice to have native drivers for databases :-)

I currently use my ODBC database module to connect to Microsoft servers. (also works on Linux using the freetds library)


byo(Posted 2009) [#5]
Thanks, Brucey.
I was in need of a native driver for a project instead of ODBC. :)


byo(Posted 2009) [#6]
New version - v040

Some new additions:

getStringByFieldName
getIntByFieldName
getFloatByFieldName
getDoubleByFieldName
copy (method - see docs)
getColumnName
getColumnType

Changes:

- TCursor now changed to TSQLCursor
- You can now create a cursor with a specific type (dynamic, forwardonly, etc.)
- Constants for these cursor types were added
- Method name "execFile" changed to "executeFile"
- Documentation added

Some things still need to be optimized. :)

Cheers!

Andre


Jim Teeuwen(Posted 2009) [#7]
Nice work! :)


DreamLoader(Posted 2009) [#8]
good one!


byo(Posted 2009) [#9]
Thanks for the kind words, guys.

New version v045

New small bugfix version is out. Unfortunately the SQLCursor navigation methods were somewhat broken in the couple last builds. My bad. They're now fixed and appear to be working fine.

New methods (TSQLCursor):
- countRows
- goToRow
- getRowIndex

The intention is to make it easier to understand and with less code to type like this:

Import byo.sqlserver

Local conn:TSQLServer = New TSQLServer

If conn.open(".\SQLEXPRESS", "master", "sa", "123") Then
	Local rs:TSQLCursor
	
	rs = conn.query("SELECT * FROM SYSDATABASES", CURSORTYPE_DYNAMIC)
	
	If rs Then
		Print "CountRows = " + rs.countRows()
		
		While rs.nextRow()
			Print rs.getString(0)
			Print rs.getRowIndex()
		Wend
		
		conn.close()
		rs.close()
	End If
	
	End
End If


:)