kytschBASIC

Put down that phone!
Please view me on real computer.

DATA

Used to connect to a database to run queries and pull data back for use.

Example

DATA menu&
	REM Open the database connection from the config file labelled kytschBASIC.
	DOPEN "kytschBASIC"

	REM Read from the menu table in the database.
	DREAD "menu"

	REM Select all entries from the menu table.
	DSELECT "*"

	REM Condition the select to those that aren't deleted.
	DWHERE "deleted_at != NULL"

	REM Sort the results by their name alphabetically.
	DSORT "name ASC"
DATA CLOSE

REM Loop through the results stored in menu& variable.
FOR item& IN menu&
	SWRITE
		PRINT item&["id"]
		LINE BREAK
		PRINT item&["name"]
	SWRITE CLOSE
END FOR

Output

7
Database

3
Heading

1
Home

4
Media

5
Tables

2
Text

6
Variables

See also