BlitzData 1.1 R7
Community Forums/Showcase/BlitzData 1.1 R7
| ||
Because Wayne demanded it..... User Creations has now become the BlitzData forum. Entirely. No other topics will be allowed. Thank you, move along. 1.1 RC7 fixes a small bug and adds the commands mentioned in one of the other hundreds of BD threads. http://www.outergods.com/blitz/blitzdatar7.zip Commands Added: BD_RecordSetBOF() BD_RecordSetEOF() BD_ColumnCount() BD_ColumnName() BD_ColumnDataType() Other metadata commands will be added soon. But probably not before the weekend. :) Kanati |
| ||
oh gawd forgot this one: BD_SetQueryTimeOut |
| ||
First, I think these commands: BD_RecordSetBOF() BD_RecordSetEOF() Should be: BD_RecordBOF() BD_RecordEOF() Both would return the record status true or false. In my case I'd use it following BD_NextRecord(). I thought you added the commands, but decls is not updated. I really like the quality work, Sample code using big connect string. Hard coded to display 20 records. |
| ||
Graphics 800,600,32,2 SetBuffer BackBuffer() BD_SetDebugMode(1) t% = BD_OpenDatabase("Driver=Client Access ODBC Driver (32-bit);system=PHOENIX;DefaultLibraries=,*usrlibl;ForceTranslation=0;ExtendedDynamic=0;Naming=1;Prompt=2","","","",4) If t = -1 Then Text 20,20,"Could not open database." Flip key = WaitKey() End Else Text 20,20,"Opened TEST database Successfully." Flip ;While Not GetKey():Wend EndIf ; Get Record Count t = BD_SQLQuery("select count(*) COUNT from pmp") If t = 0 Then count=BD_GetColumn("COUNT") Text 20,60, "Record Count=" + count Flip ;WaitKey() EndIf BD_CloseQuery() t = BD_SQLQuery("SELECT * FROM PMP") If t = 0 Then Text 20,80, "Opened recordset successfully" Text 20,100, "Record Count=" + BD_RecordCount() Flip ;WaitKey() EndIf For t = 1 To 20 Text 20, 100 + (t * 20), BD_GetColumn("PMPART") + ", " + BD_GetColumn("PMDESC") BD_NextRecord() Flip Next WaitKey() BD_CloseQuery() BD_CloseDatabase() While Not GetKey():Wend |
| ||
Nice work, gratz to the author ! Regards, |
| ||
BD_GetColumn(ColName$) doesn't like nulls. I guess for now I can write the query to prevent null related errors using something like this: case when cf.H is null then '' else char(cf.h) end H -or- Coalesce(cf.H,'') H |
| ||
hrm... now see... this is the kinda betatesting I'd like to have seen when I wanted beta testers. :) I'll address everything you've stated tomorrow and have RC8 out. And I'll look into that timeout as well. Kanati |
| ||
Nulls.... I'm going to change it so that if the return is null, it will return a string of "*NULL*". It appears blitz + dll doesn't much care for null anything. I'm also changing the BD_SetStringColumn so that if you pass "*NULL*" it will set the column to null. I'm debating now changing the BD_SetIntegerColumn and BD_SetFloatColumn commands to something similar. Setting a constant at the negative extent of the variable type and if that is sent to (or returned) from the column then it will be set to null. Does this sound acceptable? Here's the latest decls file so you don't have to download an entirely new build just for the few new commands... ;Declarations file for blitzdata.dll .lib "BlitzData.dll" BD_OpenDatabase%(Server$,Database$,UserName$,Password$,dbtype%):BD_OpenDatabase BD_CloseDatabase():BD_CloseDatabase BD_GetDatabaseState%():BD_GetDatabaseState BD_GetTableState%():BD_GetTableState BD_FirstRecord():BD_FirstRecord BD_NextRecord():BD_NextRecord BD_PreviousRecord():BD_PreviousRecord BD_LastRecord():BD_LastRecord BD_RecordCount%():BD_RecordCount BD_SQLQuery%(query$):BD_SQLQuery BD_CloseQuery():BD_CloseQuery BD_GetColumn$(colname$):BD_GetColumn BD_AddRecord():BD_AddRecord BD_UpdateRecord():BD_UpdateRecord BD_SetStringColumn(col$, val$):BD_SetStringColumn BD_SetIntegerColumn(col$, val%):BD_SetIntegerColumn BD_SetFloatColumn(col$, val#):BD_SetFloadColumn BD_BeginTransaction():BD_BeginTransaction BD_RollbackTransaction():BD_RollbackTransaction BD_CommitTransaction():BD_CommitTransaction BD_CreateJetDatabase(fname$,typ%):BD_CreateJetDatabase BD_CreateJetTable(fname$,table$):BD_CreateJetTable BD_AddJetColumn(fname$,table$,col$,typ%,siz%):BD_AddJetColumn BD_SendSQLCommand(sql$):BD_SendSQLCommand BD_SetDebugMode(mode%):BD_SetDebugMode BD_DeleteRecord():BD_DeleteRecord BD_RecordSetBOF%():BD_RecordSetBOF BD_RecordSetEOF%():BD_RecordSetEOF BD_ColumnName$(ord%):BD_ColumnName BD_ColumnCount%():BD_ColumnCount BD_ColumnDataType%(colname$):BD_ColumnDataType Kanati |
| ||
Yes, *Null* will work as you suggest. |
| ||
checking the new commands out now. |
| ||
I need the blitzdata.dll to support the new decls file. RC7 has blitzdata.dll ver 1.0.0.96 and doesnt support above. 8) |
| ||
I'm gonna have to watch installshield 9 a bit better. I tell it to update the build and recompile and it doesn't seem to do it all the time. http://www.outergods.com/blitz/blitzdataupd.zip DLL and DECLS file only. 19k file. Kanati |
| ||
Looking at the decls, I find: BD_RecordSetBOF%():BD_RecordSetBOF BD_RecordSetEOF%():BD_RecordSetEOF Whats with the word 'SET', were not setting anything here. This is what we need: BD_RecordBOF%():BD_RecordBOF BD_RecordEOF%():BD_RecordEOF http://www.dwam.net/iishelp/ado/docs/adopro01_5.htm BOF, EOF Properties - ADO BOF indicates that the current record position is before the first record in a Recordset object. EOF indicates that the current record position is after the last record in a Recordset object. Applies To Recordset Return Values The BOF and EOF properties return Boolean values. Remarks Use the BOF and EOF properties to determine whether a Recordset object contains records or whether you've gone beyond the limits of a Recordset object when you move from record to record. The BOF property returns True (-1) if the current record position is before the first record and False (0) if the current record position is on or after the first record. The EOF property returns True if the current record position is after the last record and False if the current record position is on or before the last record. If either the BOF or EOF property is True, there is no current record. If you open a Recordset object containing no records, the BOF and EOF properties are set to True, and the Recordset object's RecordCount property setting is zero. When you open a Recordset object that contains at least one record, the first record is the current record and the BOF and EOF properties are False. If you delete the last remaining record in the Recordset object, the BOF and EOF properties may remain False until you attempt to reposition the current record. This table shows which Move methods are allowed with different combinations of the BOF and EOF properties. MoveFirst, MoveLast MovePrevious, Move < 0 Move 0 MoveNext, Move > 0 BOF=True, EOF=False Allowed Error Error Allowed BOF=False, EOF=True Allowed Allowed Error Error Both True Error Error Error Error Both False Allowed Allowed Allowed Allowed Allowing a Move method doesn't guarantee that the method will successfully locate a record; it only means that calling the specified Move method won't generate an error. The following table shows what happens to the BOF and EOF property settings when you call various Move methods but are unable to successfully locate a record. BOF EOF MoveFirst, MoveLast Set to True Set to True Move 0 No change No change MovePrevious, Move < 0 Set to True No change MoveNext, Move > 0 No change Set to True |
| ||
Kanati, just want to say I appreciate your time, and I'm putting your efforts to good work! It's also making me rethink sharing some of my BIG beautiful terrain mesh code. 8) I think we're getting real close to wrapping this baby up. Thank you. |
| ||
Maybe I should just change the capital S to lowercase. Because we aren't grabbing a record eof and bof. We're grabbing the Recordset eof bof... But for some reason my warped brain decided to type RecordSet as if it were two words. As for the way it works, that's exactly what I'm doing... Excepting that I'm returning 1 for true and 0 for false instead of -1. But in truth any non-zero number is "true". I think I'll add two more commands that mirror BD_RecordsetBOF() and EOF() and make them BD_BOF() and BD_EOF(). That way either will work. Kanati |
| ||
OK, makes sense now that you put it that way. Right on, off to test it. |
| ||
I used EOF and it works great! On the other hand I observed BOF to always return false. I expected BOF to be true after the query initially ran, and then go false after moving off first record. I don't use BOF in practice so it's possible I'm missing something. BD_ColumnCount%() works primo. I'm off to test BD_ColumnName$(ord%) 8) While Not BD_RecordSetEOF%() j=j+1 Text 20, 130 + (j * 10), BD_GetColumn("O6ORD#")+", " + BD_GetColumn("ODPN") + ", "+ BD_GetColumn("H") + ", " + BD_GetColumn("W")+", " + BD_GetColumn("D")+", " + BD_GetColumn("SCOUNT") If j=40 Then j=0 BD_NextRecord() Flip Wend |
| ||
BD_ColumnName$(ord%) Works great, ordinal postions begin at one. |
| ||
Yeah. Normally they begin at zero, but I just didn't much care for that. Never have. I like all my arrays and such to begin at one. I just added BD_EOF() and BD_BOF() to mirror the now lower cased 's' BD_RecordsetEOF() and BD_RecordsetBOF(). I'll take a look at the BOF() functions to make sure I'm returning the right info but I'm pretty sure I am. It might be something with ADO that I'm not aware of. Kanati |
| ||
Just added the following commands... BD_EOF%() BD_BOF%() BD_ColumnSize%() BD_GetCacheSize%() BD_SetCacheSize(csize%) BD_SetBookmark(ord%) BD_ReturnToBookmark(ord%) BD_SetMaxRecords(maxrec%) BD_GetMaxRecords%() I'll have a new build ready later... Kanati |
| ||
I found this usefull after executing a query before fetching column values: While BD_GetTableState%()<>1 Wend Also, GetDataBaseState%() doesnt work, not in dll I believe. |
| ||
as in it's not in the dll??? I suppose it's possible it got deselected and not "exported". I'll make sure the next build had everything straight. I know Databasestate() works because that was the first thing I tested after the Open command was made. Too late now, but expect a new build tomorrow sometime (full build). And I'll also put up just the dll and decls file for you as well. Kanati |
| ||
awesome, performance has been great, professional quality. I used it today to display a physical inventory in 3d. Really nice to have SQL available in Blitz when one needs it. Keep the goodies flowing Kanati 8) |
| ||
Thanks. I've always balked at working on a game in blitz because the kind that I like are 4X games... sometimes referred to as spreadsheet games. Lotta data flying around and flatfiles just don't do it for me. Took a while to realize it but I finally got around to making this. And now I can finally continue working on my game the way I wanted to. :) The new build will be done later today. I'm still at work and have some errands to run when I get off. So after that. Kanati |
| ||
Today I tested with Win 98 and fresh install of Office 95 including Access 95. Goal was to test with Access 95 Database. Installed: vbrun60, Mdac2.7. and Jet40SP7_9xNT in that order. Then installed: blitzdatar7.zip Created Table1 in Access 95, Read the table I created from blitz3d without problems. Summary: To date I've tested it with Access 95, Access 97 and DB400. I expect no problems with SQLBASE, SQL Server, or Access 2000. Heck, I should be able to read Excel Data too. 8) |
| ||
Anything there's an ADO driver for. That's why I love ADO. :) When I release the final product so-to-speak I'll make sure you get credit for beta testing for me in the docs... And in BD_About() :) |
| ||
Sorry, Double post IPete2. |
| ||
Guys, Just to let you know, that although there may appear to be a lot of silence generally from the forum, I think what you are doing here is awesome - and very much needed. I will be able to find good use for this once it is ready for release - however I cannot get distracted at the moment, hence my silence thus far. This will be an immensely powerful addition to B3d once complete, I for one am excited about it - please keep up the excellent work. IPete2. |
| ||
Hello, I have one question. Is it possible to get access to DBF Files with this library?? |
| ||
Wot IPete2 sed. Twice. |
| ||
Reading DBF files using BlitzData Exported one table from Access to create the DBF file. Created a table named: Db5.dbf To get my connect string I went here: http://www.able-consulting.com/ADO_Conn.htm Table of contents, ODBC DSN-Less, ODBC Driver for dBASE and got the following: oConn.Open "Driver={Microsoft dBASE Driver (*.dbf)};" & _ "DriverID=277;" & _ "Dbq=c:\somepath" I dropped connection syntax on left and converted to single string: "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\Program Files\Blitz3D\BlitzData 1.0;Exclusive=No" The Following code worked great: Graphics 800,600,32,2 SetBuffer BackBuffer() t% = BD_OpenDatabase("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\Program Files\Blitz3D\BlitzData 1.0;Exclusive=No","","","",4) If t = -1 Then Text 20,20,"Could not open database." Flip key = WaitKey() End Else Text 20,20,"Opened TEST database Successfully." Flip While Not GetKey():Wend EndIf t = BD_SQLQuery("SELECT * FROM Db5 ") If t = 0 Then Text 20,40, "Opened recordset successfully" Flip EndIf reccount = BD_ColumnCount() Text 20,60, "Columns in table Db5: " + Str(reccount) BD_CloseQuery() t = BD_SQLQuery("SELECT * FROM DB5 ORDER BY NAME") If t = 0 Then Text 20,80, "Opened recordset successfully" Flip EndIf For t = 1 To BD_RecordCount() Text 20, 80 + (t * 20), BD_GetColumn("NAME") BD_NextRecord() Flip WaitKey() Next BD_CloseQuery() BD_CloseDatabase() While Not GetKey():Wend |
| ||
Reading Excel files using BlitzData Excel 95 used for this test. Created spreadsheet with two columns, and three rows. Looks like this: Name Account Stacy 123 Don 456 Defining the range will define the table name used in SQL. Highlited the entire range, Insert, Name, Define, and specifiy the range name. I used 'DemoRange'. Once this is done 'DemoRange' defines your table to ODBC. This will enable your SQL statement to work. Example: Select * from DemoRange Saved the spreadsheet as Book1.xls Used the following Blitzdata sample source to read the poor mans database. Some of you maybe thinking.. why not just read from a CSV, and you'd be right. I present, reading Excel files, because it's there. 8) Special note: www.connectionstrings.com This site offers a connection string to process Excel data without range name definition. "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""" "HDR=Yes;" indicates that the first row contains columnnames, not data "IMEX=1;" tells the driver to always read "intermixed" data columns as text TIP! SQL syntax: "SELECT * FROM [sheet1$]" - i.e. worksheet name followed by a "$" and wrapped in "[" "]" brackets. Graphics 800,600,32,2 SetBuffer BackBuffer() t% = BD_OpenDatabase("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=d:\ExcelData\Book1.xls;DefaultDir=d:\ExcelData","","","",4) If t = -1 Then Text 20,20,"Could not open database." Flip key = WaitKey() End Else Text 20,20,"Opened TEST database Successfully." Flip While Not GetKey():Wend EndIf t = BD_SQLQuery("SELECT * FROM DemoRange ") If t = 0 Then Text 20,40, "Opened recordset successfully" Flip EndIf Text 20,60, "Columns in DemoRange: " + BD_ColumnCount() Text 20,70, "Rows in DemoRange: " + BD_RecordCount() BD_CloseQuery() t = BD_SQLQuery("SELECT Name, Account FROM DemoRange") If t = 0 Then Text 20,90, "Opened recordset successfully" Flip EndIf For t = 1 To BD_RecordCount() Text 20, 80 + (t * 20), BD_GetColumn("Name")+", "+ BD_GetColumn("Account") BD_NextRecord() Flip WaitKey() Next BD_CloseQuery() BD_CloseDatabase() While Not GetKey():Wend |
| ||
Hello again, thanks for the DBF support. The only problem now is that I get a 'User lib function not found' error. I installed Blitzdata 1.0, and copy the decls and dll to the Blitz3d userlibs. I also try the test files but I got the same error. |
| ||
Sounds like you need new blitzdata.dll Latest Kanati build here, grab this DLL. www.outergods.com/blitz/blitzdataupd.zip |
| ||
Didn't help, still same problem. Blitzdata commands get highlighted, I copy the dll to userlibs too. |
| ||
Paste your decls file here, we can sort this quickly. |
| ||
;Declarations file for blitzdata.dll .lib "BlitzData.dll" BD_OpenDatabase%(Server$,Database$,UserName$,Password$,dbtype%):BD_OpenDatabase BD_CloseDatabase():BD_CloseDatabase BD_GetDatabaseState%():BD_GetDatabaseState BD_GetTableState%():BD_GetTableState BD_FirstRecord():BD_FirstRecord BD_NextRecord():BD_NextRecord BD_PreviousRecord():BD_PreviousRecord BD_LastRecord():BD_LastRecord BD_RecordCount%():BD_RecordCount BD_SQLQuery%(query$):BD_SQLQuery BD_CloseQuery():BD_CloseQuery BD_GetColumn$(colname$):BD_GetColumn BD_AddRecord():BD_AddRecord BD_UpdateRecord():BD_UpdateRecord BD_SetStringColumn(col$, val$):BD_SetStringColumn BD_SetIntegerColumn(col$, val%):BD_SetIntegerColumn BD_SetFloatColumn(col$, val#):BD_SetFloadColumn BD_BeginTransaction():BD_BeginTransaction BD_RollbackTransaction():BD_RollbackTransaction BD_CommitTransaction():BD_CommitTransaction BD_CreateJetDatabase(fname$,typ%):BD_CreateJetDatabase BD_CreateJetTable(fname$,table$):BD_CreateJetTable BD_AddJetColumn(fname$,table$,col$,typ%,siz%):BD_AddJetColumn BD_SendSQLCommand(sql$):BD_SendSQLCommand BD_SetDebugMode(mode%):BD_SetDebugMode BD_DeleteRecord():BD_DeleteRecord BD_RecordSetBOF%():BD_RecordSetBOF BD_RecordSetEOF%():BD_RecordSetEOF BD_ColumnName$(ord%):BD_ColumnName BD_ColumnCount%():BD_ColumnCount BD_ColumnDataType%(colname$):BD_ColumnDataType |
| ||
Navigate to your userlibs folder, hilite blitzdata.dll, and view the properties, and specifically the version number. I'm using Blitzdata.dll version 1.0.0.103 |
| ||
8) |
| ||
Also, In the control panel, check odbc data sources, drivers, and you should see the following in the list: Microsoft dBase Driver (*.dbf) |
| ||
Same version here, what can this be?? I'm using Windows Xp Swedish version. |
| ||
I wasn't clear if it's failing at compile time, or runtime ? |
| ||
Run Time. I have Microsoft dBase Driver (*.dbf) where it should be. |
| ||
Couple of things to check. First, make sure you only have one blitzdata.dll on your machine. Second, do you have all these installed: vbrun60, Mdac2.7. and Jet40SP7_9xNT |
| ||
I installed Mdac2.7 today, where can I found the others?? I will check this later tomorrow, have no time now. Thanks for trying to help me. |
| ||
Kanati will provide us with nice install. 8) |
| ||
Indeed. I'm just making sure this build has everything needed this time. That's why the holdup. Tonight sometime most likely. |