Page 1 of 1

Better database-support

Posted: Mon Oct 17, 2005 7:21 am
by Kukulkan
Hi,

I currently work on a mid-size commercial application that needs a MySQL database. I connect using the PB-internal ODBC-methods.

Here are my wishes:

After a call to DatabaseQuery(), the row-cursor should be on the first returned row. I allways have to call NextDatabaseRow() to get the first results. That is unusually.

I need a command to get the number of results! Something like DatabaseRowCount().

There should be more commands to move the row-cursor: DatabaseMoveFirstRow() and DatabaseMoveLastRow() would be verry good.

Something like DatabaseEOF() and DatabaseBOF(). If I use NextDatabaseRow() to verify the end of the results, the cursor moves if I'm not. I want to check this, without moving the cursor (like in other languages like VB using ADO EOF() and BOF()).

A way to filter the results again! Something like the Filter-Flag of ADO: Filterstring.s = "Value > 500": DatabaseFilter(Filterstring.s)

I need a direct way to reach values in a row. Something like GetDatabaseString("ColumnName") instead of heaving to know the column-number. If I query with SELECT * FROM... I really not know the right column in many cases.

I miss the possibility of selecting, if the cursor is server-side or client-side. Maybe this is possible in ODBC or do I have to select this in the User-DSN on windows?

Ok, this have been my wishes for using databases.

Kukulkan

Posted: Mon Oct 17, 2005 9:32 am
by Tranquil
I need a direct way to reach values in a row. Something like GetDatabaseString("ColumnName") instead of heaving to know the column-number. If I query with SELECT * FROM... I really not know the right column in many cases.
I use this small procedure:

Code: Select all

Procedure GetDatabaseColumn(name$)
  For N=0 To DatabaseColumns()
    If DatabaseColumnName(N)=name$
      ProcedureReturn N
    EndIf
  Next N
  ProcedureReturn -1
EndProcedure

Posted: Mon Oct 17, 2005 9:39 am
by Kukulkan
Hi tranquil,

Thank you, but I created a routine for myself that does nearly exactly the same than yours. But this needs time and slows down the program. A good programming-language should offer something like this.

Kukulkan

Posted: Mon Oct 17, 2005 9:59 am
by Tranquil
I agree!

Posted: Mon Oct 17, 2005 11:11 am
by GedB
Kukulkan,

PBs database is extremely lightweight for speed and efficiency.

For readable code create constants for the column names. All of the readability but with no runtime overhead.

VB doesn't have any database support at all. It uses Microsoft's ADODB components. Purebasic can use exactly the same library.

The comlib user library includes examples of how to use ADODB.
http://www.purearea.net/pb/download/use ... B_demo.zip

Posted: Mon Oct 17, 2005 11:22 am
by Kukulkan
Thank you GedB,

This are good hints, but this is not changing my wishes. If those wishes where realized, I really can forget ADO and the other bullshit of MS. This will result in small and fast PB-executables without the need of any additional MS-components. This is the vision...

Kukulkan

Posted: Wed Oct 19, 2005 8:01 pm
by the.weavster
REALbasic Pro has a MySQL plugin that enables you to very easily create an app that works with MySQL and you end up with a cross-platform self contained *.exe which doesn't require any external resources.

You do have to set the server to use the old password algorithm as the plugin needs updating but it's easy to do.

Don't expect the *.exe to be of the tiny dimensions created by PureBasic though.