commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/geas/src/oql oql.c


From: Reinhard Mueller
Subject: gnue/geas/src/oql oql.c
Date: Wed, 19 Dec 2001 15:07:41 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Reinhard Mueller <address@hidden>       01/12/19 15:07:41

Modified files:
        geas/src/oql   : oql.c 

Log message:
        Continued on parser replacement.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/oql/oql.c.diff?tr1=1.73&tr2=1.74&r1=text&r2=text

Patches:
Index: gnue/geas/src/oql/oql.c
diff -c gnue/geas/src/oql/oql.c:1.73 gnue/geas/src/oql/oql.c:1.74
*** gnue/geas/src/oql/oql.c:1.73        Tue Dec 18 16:30:12 2001
--- gnue/geas/src/oql/oql.c     Wed Dec 19 15:07:40 2001
***************
*** 19,25 ****
    along with GEAS; if not, write to the Free Software Foundation, Inc.,
    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
!   $Id: oql.c,v 1.73 2001/12/18 21:30:12 reinhard Exp $
  */
  
  #include "config.h"
--- 19,25 ----
    along with GEAS; if not, write to the Free Software Foundation, Inc.,
    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
!   $Id: oql.c,v 1.74 2001/12/19 20:07:40 reinhard Exp $
  */
  
  #include "config.h"
***************
*** 43,51 ****
                                         GString * buf);
  static void oql_add_complex_conditions_to_sql (_QueryData * q, DBType db,
                                                 GString * buf);
! static void oql_add_complex_constraint_to_sql (_QueryData * q, odl_class * cl,
!                                                DBType db, oql_constraint * c,
!                                                GString * buf);
  static GString *oql_make_select (_QueryData * q, DBType db);
  static GString *oql_make_delete (_QueryData * q, DBType db);
  static GString *oql_make_write (_QueryData * q, DBType db);
--- 43,52 ----
                                         GString * buf);
  static void oql_add_complex_conditions_to_sql (_QueryData * q, DBType db,
                                                 GString * buf);
! static void oql_add_complex_constraint_to_sql (_QueryData *q,
!                                                const char *classname,
!                                                DBType db, oql_constraint *c,
!                                                GString *buf);
  static GString *oql_make_select (_QueryData * q, DBType db);
  static GString *oql_make_delete (_QueryData * q, DBType db);
  static GString *oql_make_write (_QueryData * q, DBType db);
***************
*** 267,275 ****
  char *
  oql_quote_column (const char *table, const char *column, DBType db)
  {
!   char *mangled = NULL;
    char *retval = NULL;
!   char *quotedttable = NULL;
    char *quotedcolumn = NULL;
    char *p;
    int dotcount = 0;
--- 268,276 ----
  char *
  oql_quote_column (const char *table, const char *column, DBType db)
  {
!   geas_cd_class *c;
    char *retval = NULL;
!   const char *quotedttable = NULL;
    char *quotedcolumn = NULL;
    char *p;
    int dotcount = 0;
***************
*** 284,310 ****
  
    if (table)
      {
!       mangled = odl_mangle_qualified_name (table);
! 
!       switch (db)
          {
!         case OQL_DBTYPE_CACHEONLY:
!         case OQL_DBTYPE_MYSQL:
!           if (is_word_reserved (mangled, db))
!             /* quotedttable = g_strdup_printf ("__%s", mangled, db); */
!             quotedttable = g_strdup_printf ("__%s", mangled);
!           else
!             quotedttable = g_strdup (mangled);
!           break;
! 
!         case OQL_DBTYPE_POSTGRESQL:
!           quotedttable = g_strdup (mangled);
!           if (is_word_reserved (mangled, db))
!             /* quotedttable = g_strdup_printf ("\"%s\"", mangled, db); */
!           quotedttable = g_strdup_printf ("\"%s\"", mangled);
!           else
!             quotedttable = g_strdup (mangled);
!           break;
          }
      }
  
--- 285,294 ----
  
    if (table)
      {
!       c = geas_cd_class_find (table);
!       if (c)
          {
!           quotedttable = geas_cd_class_get_name_db (c);
          }
      }
  
***************
*** 370,379 ****
        p++;
      }
  
-   if (mangled)
-     g_free (mangled);
-   if (quotedttable)
-     g_free (quotedttable);
    if (quotedcolumn)
      g_free (quotedcolumn);
  
--- 354,359 ----
***************
*** 895,909 ****
    query->fields = g_list_append (query->fields, g_strdup ("sys_id"));
    query->values = g_list_append (query->values, g_strdup (key));
  
-   /* c = odl_find_class (all_classes, classname, NULL);
-   all_fields = odl_class_get_fields (c, FT_basic); */
    c = geas_cd_class_find (classname);
    fl = geas_cd_class_fieldlist_new (c);
    f = geas_cd_fieldlist_next (fl);
    while (f)
      {
        fieldname = geas_cd_field_get_name (f);
-       g_message (fieldname);
        value = g_hash_table_lookup (values, fieldname);
        if (value)
          {
--- 875,886 ----
***************
*** 1595,1601 ****
  oql_add_complex_conditions_to_sql (_QueryData * q, DBType db, GString * buf)
  {
    GList *l;
-   odl_class *cl;
    char *classname;
  
    if (!q)
--- 1572,1577 ----
***************
*** 1611,1618 ****
      {
        g_string_append (buf, "(");
  
!       cl = odl_find_class (all_classes, classname, NULL);
!       oql_add_complex_constraint_to_sql (q, cl, db, l->data, buf);
  
        g_string_append (buf, ")");
        if (l->next)
--- 1587,1593 ----
      {
        g_string_append (buf, "(");
  
!       oql_add_complex_constraint_to_sql (q, classname, db, l->data, buf);
  
        g_string_append (buf, ")");
        if (l->next)
***************
*** 1625,1638 ****
   * Add complex constraint to SQL query.
  \* ------------------------------------------------------------------------- 
*/
  static void
! oql_add_complex_constraint_to_sql (_QueryData * q, odl_class * cl, DBType db,
!                                    oql_constraint * c, GString * buf)
  {
    GList *l;
    /* gboolean need_and = FALSE; */
    char *logic;
    char *quoted;
-   const char *classname = odl_class_get_full_name (cl);
    char *temp;
  
    if (c->logic == oql_and)
--- 1600,1612 ----
   * Add complex constraint to SQL query.
  \* ------------------------------------------------------------------------- 
*/
  static void
! oql_add_complex_constraint_to_sql (_QueryData *q, const char *classname,
!                                    DBType db, oql_constraint *c, GString *buf)
  {
    GList *l;
    /* gboolean need_and = FALSE; */
    char *logic;
    char *quoted;
    char *temp;
  
    if (c->logic == oql_and)
***************
*** 1780,1786 ****
      {
        /* add this constraint */
        g_string_append (buf, "(");
!       oql_add_complex_constraint_to_sql (q, cl, db, l->data, buf);
        g_string_append (buf, ")");
  
        /* next */
--- 1754,1760 ----
      {
        /* add this constraint */
        g_string_append (buf, "(");
!       oql_add_complex_constraint_to_sql (q, classname, db, l->data, buf);
        g_string_append (buf, ")");
  
        /* next */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]