| SE_table_calculate_stats |
Obsolete. Generates statistics for a table.
LONG SE_table_calculate_stats
(SE_CONNECTION connection,
const CHAR *column,
LONG mask,
const SE_SQL_CONSTRUCT
*construct,
LONG max_distinct,
SE_STATS **stats);
| connection | The connection handle |
| column | The DBMS column name |
| mask | Which statistics to calculate |
| construct | A pointer to an SE_SQL_CONSTRUCT structure |
| max_distinct | The maximum number of distinct values allowed |
| stats | The SE_STATS structure that will contain the statistics |
SE_table_calculate_stats returns a set of statistics for a column. You can also use an SQL column expression as the column name (e.g., "COLUMN_1 + COLUMN_2 * 10"). The expression must be supported by the underlying DBMS.
The SE_SQL_CONSTRUCT structure is defined as follows:
typedef struct {
LONG num_tables;
/* Number of tables */
CHAR **tables; /* Table names */
CHAR *where; /* Where clause */
} SE_SQL_CONSTRUCT;
The mask parameter uses a bit-mask to determine which statistics to calculate. The possibilities are:
SE_MIN_STATS /* The minimum value */
SE_AVERAGE_STATS /* The average value */
SE_MAX_STATS /* The maximum value */
SE_STD_DEV_STATS /* The standard deviation */
SE_COUNT_STATS /* The number of rows */
SE_DISTINCT_STATS /* The distinct information */
SE_BASIC_STATS /* Returns minimum, average, maximum,
standard deviation, and count */
SE_ALL_STATS /* Returns the basic plus distinct statistics */
The statistics are returned in an SE_STATS structure.
typedef struct { /* Statistics structure */
LONG count; /* Number of rows */
LFLOAT min; /* Minimum value */
LFLOAT average; /* Average value */
LFLOAT max; /* Maximum value */
LFLOAT std_dev; /* Standard deviation */
SE_DISTINCT *distinct; /* Distinct info */
} SE_STATS;
typedef struct {
LONG num_distinct; /* Number of distinct values */
LONG type; /* Value type */
SE_VALUE *values; /* Array of counts and union’ed values */
} SE_DISTINCT;
typedef struct {
LONG freq; /* Frequency of value */
union {
CHAR *str_val; /* SE_STRING_TYPE value */
LONG int_val; /* SE_INTEGER_TYPE value */
LFLOAT double_val; /* SE_DOUBLE_TYPE value */
struct tm date_val; /* SE_DATE_TYPE value */
} uval;
} SE_VALUE;
When computing table statistics, in order for any spatial
constraint set on the stream to be used, the spatial constraint MUST have the
"mask" variable set to true. If this variable is set to false, the spatial
constraint is just ignored. The calculate statistics function then returns the
statistics for the entire table.
The calc_masks parameter MUST be set to true, for the spatial filter to be
applied to the statistics function.
Use SE_stream_set_spatial_constraints()
to set the calc_masks parameter.
SE_SUCCESS
SE_CONNECTION_IN_USE
SE_CONNECTION_LOCKED
SE_DB_IO_ERROR
SE_INVALID_CONNECTION
SE_INVALID_DISTINCT_TYPE
SE_INVALID_PARAM_VALUE
SE_INVALID_POINTER
SE_INVALID_STATS_TYPE
SE_NET_FAILURE
SE_OUT_OF_CLMEM
SE_OUT_OF_SVMEM
SE_SDE_NOT_STARTED
SE_TOO_MANY_DISTINCTS