[Cancelled] Sqlite Open Pipe question

New to FreeBASIC? Post your questions here.
Posts: 25
Joined: Jun 24, 2017 8:10
Location: France, centre

[Cancelled] Sqlite Open Pipe question

Postby ptitjoz » Apr 11, 2018 12:49

With this code I get the good results. But what else can we do? and especially using OPEN PIPE for the output file?
Thank you for your remarks.
Best regards

Code: Select all

' Executer une requête sql depuis FreeBasic et Linux"
' On prend Sqlite3 à qui l'on passe les ordres sql
Const crlf =Chr(13)&Chr(10)
dim as string codesql,result

' Ordres sql
codesql=".mode column "& crlf
codesql=codesql &"select tit,nom,prenom"& crlf
codesql=codesql &"from contacts" & crlf
codesql=codesql &"order by nom,prenom" & crlf

Print "code :"
Print codesql

Open "ordre.sql" For Output As #1
Print #1,codesql
Close #1

Open Pipe "sqlite3 BaseTest.sqlite < ordre.sql" For Input As #2
While not eof(2)
   Line Input #2,result
   Print result
Close #1

The result
code :
.mode column
select tit,nom,prenom
from contacts
order by nom,prenom

2 Curie Marie
1 Lincoln Abraham
1 Schweitzer Albert
1 Tolstoï Léon

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 3 guests