Page 1 of 1
DatabaseInsert()
Posted: Tue May 08, 2007 3:57 am
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.
Posted: Tue May 08, 2007 6:41 am
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.