Table of contents | |
Tutorial for Database interfacing | |
This is a tutorial for working examples for WikiPluginsDb. The code has been developed by YannickMajoros. There are eight plugins that make up the functionality of the WikiPluginsDb, which can be Downloaded here. A basic knowledge of SQL is needed. |
Things to note: | |
|
Working with these examples | |
|
Examples | |
|
Display all data from a table: | |
![]() {DATATABLE()}{DATATABLE} {REQUEST()} SELECT * FROM Students {REQUEST}
|
Display data from a table with nested links | |
![]() {DATATABLE(title=>1)} __Id.__|__First name__|__Last name__|__''Links''__ *Id|*First_Name|*Last_Name|LINK:More info:StudentInfo:Id=*Id {DATATABLE} {REQUEST()} SELECT Id, First_Name, Last_Name FROM Students {REQUEST} Comments:
|
Adding new records | |
![]() {DATATABLE(title=>1)} __Id.__|__First name__|__Last name__|__''Links''__ *Id|*First_Name|*Last_Name|LINK:More info:StudentInfo:Id=*Id {DATATABLE} {FORM(update=>Create)} __First name:__ {FIELD(name=>First_Name)}{FIELD} __Last name:__ {FIELD(name=>Last_Name)}{FIELD} {FORM} {REQUEST(cursor=>1)} SELECT Id, First_Name, Last_Name FROM Students {REQUEST} {REQUEST(id=>new_student,cond=>update)} INSERT IGNORE INTO Students SET First_Name='?First_Name', Last_Name='?Last_Name' {REQUEST} Comments:
|
Counting records in a table | |
![]() There are __{FIELD(edit=>0,from=>Row_Count, src=>Record_Count)}{FIELD}__ Rows in this table {REQUEST(id=>Row_Count)} SELECT COUNT(*) Record_Count FROM Students {REQUEST} Comments:
|
Using the Navigator | |
![]() {FORM(id=>Form_Name, from=>Request_Name)} __Text Box:__ {FIELD(name=>Field_Name1,from=>Request_Name,src=>First_Name)}{FIELD} __Check Box:__{FIELD(type=>chk,src=>Last_Name,size=>150,from=> Last _Name)}{FIELD} __Comment box: __ {FIELD(type=>memo, src=>Last_Name, from=>Request_Name)}{FIELD} __Select: __ {FIELD(type=>select,src=>First_Name, from=> Request_Name,choices=>Student, ch_field=>Student.First_Name, nopos=>1)}{FIELD} {FORM} {NAVIGATOR(from=>Request_Name, key=>Id, table=>Student)}{NAVIGATOR} {REQUEST(id=Request_Name)} SELECT Id, First_Name, Last_Name from Students where Id=’?Id’ {REQUEST} Comments:
|
More | |
There is much, much more to it. You could let the plugins make backups of your updates and add history into another table automatically, simply by setting flags. A lot of the features have not yet been documented. |