DatabaseInsert()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

DatabaseInsert()

Post by Rook Zimbabwe »

I would like to have a better method to insert new data into a database. Using the instruction:

Code: Select all

DatabaseUpdate(#Database, "INSERT INTO Table1 (DAYNUMB, SECS VALUES ('"+dayo1$+"','"+jan1$+"');")
Does not work 100% of the time and sometimes generates false errors.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

I don't think this is necessary.

The Update part of the DatabaseUpdate doesn't mean "Update" in the SQL sense. It just happens to coincide with the SQL command "UPDATE". (Whereas the command DatabaseQuery doesn't happen to coincide with the SQL "SELECT" and so we don't necessarily associate it with SELECT. :))

The command DatabaseUpdate (to the best of my knowledge) means anything that changes the database. Deletes, inserts, updates, etc.

Also to the best of my knowledge the command just gives the sql string to the database engine. If that fails it is outside of PureBasic's control as the engine is not part of PureBasic. PureBasic has no control over that.

In fact PureBasic cannot even attempt to validate sql strings as (a) it doesn't "know" the database (tables, etc) and (b) the DB could be any database from Oracle to Access and every database has little non-standard quirks in their implementation of the SQL standard.
Dare2 cut down to size
Post Reply