0

I am writing an extension for the gnome-shell. The javascript extension spawns a sql query and captures the output on standard output.

The result of the query produces records with 2 columns. I can't seem to extract each column of a record individually because the delimiter used, in this case a '|', can possibly occur in either of the columns which are strings themselves.

How do I go about achieving the same? I am new to this type of real programming(i.e, databases, gnome, javascript). My previous programming experiences have been limited to implementing algorithms taught in the course/textbooks.

I recognise that this problem would dissappear if there was a javascript/gnome interface to sqlite3 like the c/c++ interface. I could then extract each column in a record with ease.

Googling in search of such an interface did not help me. I searched for "javascript interface for sqlite" and "gnome interface for sqlite".

Abhijith Madhav
  • 2,748
  • 5
  • 33
  • 44

1 Answers1

1

If you are using the sqlite3 command-line utility, you can use the .format command to specify other output formats. .separator and .headers might also come in handy. Run sqlite3 and enter .help for more details.

Marcelo Cantos
  • 181,030
  • 38
  • 327
  • 365
  • Thanks. Though I do not use the command line utility, your answer reminded me of 'man sqlite3'. The -line option seems best suited for my purposes. – Abhijith Madhav Mar 15 '12 at 12:15