1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| ' program test001 test shell appel sqlite3 sous Linux
dim sa as string
cls
print "Affichage du résultat d'une requête sqlite3"
print "programmé en Freebasic"
print
open "code.sql" for output as #1
print #1,".mode column"
print #1,".head on"
print #1,".width 40 30"
print #1,"select artists.name as 'artiste' , albums.title as 'titre' from albums,artists"
print #1,"where albums.albumid=artists.artistid"
print #1,"and albums.title like '%wor%'"
print #1,"order by artists.name"
close #1
shell "sqlite3 chinook.db < code.sql > result.txt"
open "result.txt" for input as #2
color (14)
input #2,sa
print sa
input #2,sa
print sa
color (12)
while not eof(2)
input #2,sa
print sa
wend
close(2)
print
color(13)
input "enter : quitter",sa |
Partager