Forum > Databases

SOLVED How to get PRAGMA result in query or array

(1/1)

JanRoza:
I tried to get the result of an SQLite PRAGMA statement in a query but I must be doing something wrong as the resulting query stays empty.
I tried the following:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---qryColumns.Active := false;qryColumns.SQL.Text := 'SELECT name FROM PRAGMA_TABLE_INFO("Temp_Export")';qryColumns.Active := true; 
In a SQLite manager (SQLIteExpert) the PRAGMA statement works perfectly, so the syntax is fine.
I would also like to know how to get the result of the PRAGMA statement into an array (as alternative for a query).
Can anyone get me on the right path?

JanRoza:
It must be the late hour  %), but I already found the answer.
Solved it by using:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    strSQL := 'INSERT INTO Temp_Columns SELECT name FROM PRAGMA_TABLE_INFO("Temp_Export")';  DataModule1.DbConnection.ExecuteDirect(strSQL);  DataModule1.DbTransaction.CommitRetaining; 
Which gives me a nice table with column names.

Navigation

[0] Message Index

Go to full version