Ssql
From SRB
Contents |
NAME
Ssql - query DAI objects and converted-Datascope objects with SQL commands
SYNOPSIS
Ssql [-d datascope_descriptor_table] [-o output_file] [-x] [-s single_query] srbObj
Ssql [-h]
DESCRIPTION
Ssql make SQL queries against srbObj , which is an DAI object, and writes the query results on the standard output, or a file.
OPTIONS
- -h
- displays command options
- -d
- datascope_descriptor_table name of datascope descriptor table. If you use Sds2db, or ds2sql, to convert the datascope tables. This table is created automatically with a default name. This option is only for advanced users.
- -o
- output_file This program write result to stdout by default. This option will flag the program to write result to the file.
- -x
- instead of having a typical SQL client output format, use XML.
- -s
- single_query by default, this program give an interactive UI. This option enables single query mode. It process the one query, and quit. For example, ( Ssql -s "select * from tabs;" srbObj )
DATASCOPE
This program supports datascope operations. It's meant to make use of DAI object, that is converted from a datascope database. Read man page for Sds2db to learn the details. In general, use selectds instead of select to use datascope support.
Supported functions:
trloadchan
selectds trloadchan(start_time, end_time, station, channel) from wf_table;
This trloadchan is similar to Antelope::trloadchan(3). It returns the data sample specified by start time, end time, station, and channel. for example:
selectds trloadchan(1079326702,1079438062,'IGPP','Temp-in') from LACOFD_wfdisc;
selects all data samples from unix time 1079326702 to 1079438062 at station 'IGPP', channel 'Temp-in', from table LACOFD_wfdisc. Note that table LACOFD_wfdisc is a database table converted from a datascope table called wfdisc with prefix LACOFD. This table is converted by Sds2db.
trsample
selectds trsample(start_time, end_time, station, channel, max_num_sample, gap_filler) from wf_table;
trsample is very simular to trloadchan, but instead of return all data samples, which is massive usually, it returns number of sample up to the max_num_sample. It tries to return the data sample as uniformed distributed as possible. Also, in case of data gap, it uses the gap_filler for empty points.
Along with the datasample, it give timestamp for each data sample. for example:
selectds trsample(1079326702,1079438062,'IGPP','Temp-in', 200, -99) from LACOFD_wfdisc;
selects all data samples from unix time 1079326702 to 1079438062 at station 'IGPP', channel 'Temp-in', up to 200 samples, and use -99 as filler, in case of data gap.


