<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > SQLite > SQLite_Select |
Description
Open a SQLite database
Syntax
n = SQLite_Select(sStatements [, lSetNumber [,sModificators]])
Returns
Number.
Returns zero if processed OK.
Parameters
Name |
Type |
Optional |
Meaning |
sStatements |
String |
No |
Will prep the passed Statement and if no errors will activate the passed SetNumber (must have been closed/inactive). The Statement should be Select or Pragma or any other that returns rows (Insert, Update, and Delete do not return rows). |
lSetNumber |
Number |
Yes |
SetNumber can be omitted or be any value from 0 to 32767. If omitted then will use zero. Since SetNumber is used as an array index, no gaps is best, which will result in a smaller array. You can have as many unique sets open/active at same time as your memory will allow. |
sModificators |
String |
Yes |
ModChars is a string with flags. Below possible options: C = Will first do a slCloseSet(rlSetNumber). This will prevent error 14 (%SQLite_InvalidSetNumber) but should be used with caution. Omitting set number or passing set number of zero will do the same thing. D = Allow duplicate column names. Not recommended if using names to return values because you will always get the first value returned. SQLite does not normally return qualified column names. SQLite will return C1 twice if you Select T1.C1, T2.C1. So the solution is to alias one of them with the As clause as follows Select T1.C1, T2.C1 as C1Again. There is a Pragma called "full_column_names" which forces SQLite to return qualified names, but does not seem to work if you Select *. Read up on it and use if you like. I like using an alias because it is less code and more clear. Em = Return errors. This will override the global return errors flag. m is the optional message display modifier and can be: 0 = No message is displayed. This is the default. 1 = Display a warning message with OK button. Error is returned when OK pressed. 2 = Display a question message with OK and Cancel buttons. If they press OK, error is returned. If they press Cancel, will exit process. e = Do not return errors, display message and exit process. This will override the global return errors flag. Fn = Set the size of the first Row Data Chunk (RDC). The value of n is in K so the actual size is * 1000. Maximum value for n is 200000. Greater values will be ignored. Will default to half the size of MaxChunkSize which is set in the Config file. Bn = Do a Begin Transaction before doing the Sel command. The type of Begin is controlled by the value of n as follows: 0 = Deferred. This is the default if n is omitted. 1 = Immediate. 2 = Exclusive. R = Release all named locks owned by this connection after doing the Sel. |
Remarks
Restrictions
See also
Examples