• Welcome to SQLitening Support Forum.
 

News:

Welcome to the SQLitening support forums!

Main Menu

PRAGMA table_info ordlista

Started by Fim, July 27, 2016, 11:03:08 AM

Previous topic - Next topic

Fim

slexe "PRAGMA table_info ordlista" gives no result.
Is there any other way to get the names of al columns in a table.
Fim W

cj

#1
#INCLUDE "sqlitening.inc"
FUNCTION PBMAIN () AS LONG

  LOCAL s AS STRING
  LOCAL columns AS LONG

  slOpen "sample.db3"
s = slGetTableColumnNames("Parts")
  ? PARSE$(s,$NUL,1),,"First in string"
  ? PARSE$(s,$NUL,9),,"Last  in string"

  'Put column names into an array
  columns = PARSECOUNT(s,$NUL)
  DIM sColumnNames(1 TO columns) AS STRING
  PARSE s,sColumnNames(),$NUL
  ? JOIN$(sColumnNames(),$CR),,"All columns in array"
  ? sColumnNames(1),,"First in array"
  ? sColumnNames(columns),,"Last in array"

END FUNCTION

cj

INCLUDE "sqlitening.inc"
FUNCTION PBMAIN () AS LONG
  DIM sColumnNames() AS STRING
  slOpen "sample.db3"
  slSelAry "select * from parts where 1=0",sColumnNames()
  ? JOIN$(sColumnNames(),$CR)
END FUNCTION                 

Fim

Thank you.
A little embarrassed, I had not seen "slGetTableColumnNames" in the manual.
Glad you did not answer RTFM.
Fim W