rtcom-eventlogger/eventlogger-query.h File Reference

Defines an RTComElQuery object. More...

#include "rtcom-eventlogger/eventlogger-types.h"
#include <glib-object.h>
#include "rtcom-eventlogger/eventlogger.h"

Go to the source code of this file.

Functions

RTComElQuery * rtcom_el_query_new (RTComEl *el)
void rtcom_el_query_set_is_caching (RTComElQuery *query, gboolean is_caching)
void rtcom_el_query_set_limit (RTComElQuery *query, gint limit)
void rtcom_el_query_set_offset (RTComElQuery *query, gint offset)
void rtcom_el_query_set_group_by (RTComElQuery *query, RTComElQueryGroupBy group_by)
gboolean rtcom_el_query_refresh (RTComElQuery *query)
gboolean rtcom_el_query_prepare (RTComElQuery *query,...)
const gchar * rtcom_el_query_get_sql (RTComElQuery *query)
const gchar * rtcom_el_query_get_where_clause (RTComElQuery *query)


Detailed Description

Defines an RTComElQuery object.

Copyright (C) 2005-06 Nokia Corporation. Contact: Naba Kumar <naba.kumar@nokia.com>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

RTComElQuery desribes a query.

Definition in file eventlogger-query.h.


Function Documentation

const gchar* rtcom_el_query_get_sql ( RTComElQuery *  query  ) 

Gets the sql generated by this query

Parameters:
query The RTComElQuery
Returns:
the generated sql

const gchar* rtcom_el_query_get_where_clause ( RTComElQuery *  query  ) 

Gets the WHERE clause generated by this query, i.e. a pointer to the internal SQL string, starting after the word 'WHERE'.

Parameters:
query The RTComElQuery
Returns:
the WHERE clause

RTComElQuery* rtcom_el_query_new ( RTComEl *  el  ) 

Creates a new RTComElQuery.

Parameters:
el The RTComEl this query operates on
Returns:
A newly allocated RTComElQuery.
Examples:
check_el.c.

gboolean rtcom_el_query_prepare ( RTComElQuery *  query,
  ... 
)

Prepares the query. The syntax is the following: serie of 3-argument where: arg 1: column name arg 2: value arg 3: operation (see RTComElOp enumeration) E.g.:

 rtcom_el_query_prepare(
    query,

    "service-id",
    event_logger_get_service_id(“RTCOM_EL_SERVICE_SMS”),
    RTCOM_EL_OP_EQUAL,

    "event-type-id",
    event_logger_get_eventtype_id(“RTCOM_EL_EVENTTYPE_SMS_INBOUND”),
    RTCOM_EL_OP_EQUAL,

    "local-uid",
    “555-123456”,
    RTCOM_EL_OP_EQUAL,

    "storage-time",
    1324183274,
    RTCOM_EL_OP_GREATER

    NULL);

This will return all the events relative to incoming SMSs from the number 555-123456, after the time 1324183274.

You can also get the service and the event type by name, like:

 "service", "SOME_SERVICE_NAME", RTCOM_EL_OP_EQUAL,
 "event-type", "SOME_EVENTTYPE_NAME", RTCOM_EL_OP_EQUAL

Then you can use array of strings to get multiple values. E.g.:

 const gchar * channels[] = {"Foo", "Bar", NULL};
 const gchar * services[] = {"S1", S2", "S3", NULL};
 rtcom_el_query_prepare(
     query,
     "channel", channels, RTCOM_EL_OP_IN_STRV,
     "service", services, RTCOM_EL_OP_IN_STRV);

Parameters:
query The RTComElQuery object
Returns:
TRUE in case of success, FALSE otherwise
Examples:
check_el.c.

gboolean rtcom_el_query_refresh ( RTComElQuery *  query  ) 

Re-prepares the query leaving the WHERE clauses unchanged. This should be used just after changing the limit, offset or group properties of the query, in order to rebuild the sql.

Parameters:
query The RTComElQuery object
Returns:
TRUE in case of success, FALSE otherwise
See also:
rtcom_el_query_prepare

void rtcom_el_query_set_group_by ( RTComElQuery *  query,
RTComElQueryGroupBy  group_by 
)

Sets the group property

Parameters:
query The RTComElQuery
group A gboolean value, telling wheter you want to group the events by their group_uid.
Examples:
check_el.c.

void rtcom_el_query_set_is_caching ( RTComElQuery *  query,
gboolean  is_caching 
)

Sets the is-caching property

Parameters:
query The RTComElQuery
is_caching The value that will be used to set the is-caching prop

void rtcom_el_query_set_limit ( RTComElQuery *  query,
gint  limit 
)

Sets the limit property

Parameters:
query The RTComElQuery
limit The LIMIT for the query
Examples:
check_el.c.

void rtcom_el_query_set_offset ( RTComElQuery *  query,
gint  offset 
)

Sets the offset property

Parameters:
query The RTComElQuery
offset The OFFSET for the query


Generated on Thu Jun 17 14:07:13 2010 for rtcom-eventlogger by  doxygen 1.5.6