[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/geas/src/objectstore compare.c mysql.c pos...
From: |
Reinhard Mueller |
Subject: |
gnue/geas/src/objectstore compare.c mysql.c pos... |
Date: |
Wed, 19 Dec 2001 15:06:26 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Reinhard Mueller <address@hidden> 01/12/19 15:06:26
Modified files:
geas/src/objectstore: compare.c mysql.c postgresql.c
Log message:
Don't quote table and column names as they are already quoted.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/objectstore/compare.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/objectstore/mysql.c.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/objectstore/postgresql.c.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
Patches:
Index: gnue/geas/src/objectstore/compare.c
diff -c gnue/geas/src/objectstore/compare.c:1.5
gnue/geas/src/objectstore/compare.c:1.6
*** gnue/geas/src/objectstore/compare.c:1.5 Sat Dec 15 05:43:33 2001
--- gnue/geas/src/objectstore/compare.c Wed Dec 19 15:06:26 2001
***************
*** 19,25 ****
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
! $Id: compare.c,v 1.5 2001/12/15 10:43:33 reinhard Exp $
*/
#include "config.h"
--- 19,25 ----
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
! $Id: compare.c,v 1.6 2001/12/19 20:06:26 reinhard Exp $
*/
#include "config.h"
***************
*** 224,233 ****
*
\* -------------------------------------------------------------------------
*/
static DatabaseTable *
! find_database_table (DatabaseDefinition *def, const char *name, DBType db)
{
GList *l;
- char *quoted;
g_assert (def != NULL);
g_assert (name != NULL);
--- 224,232 ----
*
\* -------------------------------------------------------------------------
*/
static DatabaseTable *
! find_database_table (DatabaseDefinition *def, const char *name)
{
GList *l;
g_assert (def != NULL);
g_assert (name != NULL);
***************
*** 235,244 ****
l = def->tables;
while (l)
{
! /* We have to quote this because the database can return the unquoted
! names */
! quoted = oql_quote_column (((DatabaseTable *) l->data)->name, NULL, db);
! if (!g_strcasecmp (quoted, name))
{
return ((DatabaseTable *) l->data);
}
--- 234,240 ----
l = def->tables;
while (l)
{
! if (!g_strcasecmp (((DatabaseTable *)l->data)->name, name))
{
return ((DatabaseTable *) l->data);
}
***************
*** 415,421 ****
while ((c = geas_cd_classlist_next (cl)))
{
change = NULL;
! table = find_database_table (database, geas_cd_class_get_name_db (c),
db);
if (!table)
{
change = dbchange_add_table (result, geas_cd_class_get_name_db (c));
--- 411,417 ----
while ((c = geas_cd_classlist_next (cl)))
{
change = NULL;
! table = find_database_table (database, geas_cd_class_get_name_db (c));
if (!table)
{
change = dbchange_add_table (result, geas_cd_class_get_name_db (c));
Index: gnue/geas/src/objectstore/mysql.c
diff -c gnue/geas/src/objectstore/mysql.c:1.10
gnue/geas/src/objectstore/mysql.c:1.11
*** gnue/geas/src/objectstore/mysql.c:1.10 Sat Dec 15 15:09:54 2001
--- gnue/geas/src/objectstore/mysql.c Wed Dec 19 15:06:26 2001
***************
*** 20,26 ****
along with GEAS; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
! $Id: mysql.c,v 1.10 2001/12/15 20:09:54 reinhard Exp $
*/
#include "config.h"
--- 20,26 ----
along with GEAS; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
! $Id: mysql.c,v 1.11 2001/12/19 20:06:26 reinhard Exp $
*/
#include "config.h"
***************
*** 562,576 ****
void
MySQL_add_column_data (GString * buf, GList * l, const char *separator)
{
- char *name;
DBchange *c;
while (l)
{
c = (DBchange *) l->data;
! name = oql_quote_column (NULL, c->name, OQL_DBTYPE_MYSQL);
! g_string_append (buf, name);
! g_free (name);
g_string_append (buf, " ");
switch (c->datatype)
--- 562,573 ----
void
MySQL_add_column_data (GString * buf, GList * l, const char *separator)
{
DBchange *c;
while (l)
{
c = (DBchange *) l->data;
! g_string_append (buf, c->name);
g_string_append (buf, " ");
switch (c->datatype)
***************
*** 737,745 ****
{
/* for each new table, construct a CREATE command */
buf = g_string_new ("");
! name = oql_quote_column (add->name, NULL, OQL_DBTYPE_MYSQL);
! g_string_sprintf (buf, "CREATE TABLE %s (", name);
! g_free (name);
MySQL_add_column_data (buf, add->columns, ", ");
g_string_append (buf, "PRIMARY KEY (sys_id) )");
}
--- 734,740 ----
{
/* for each new table, construct a CREATE command */
buf = g_string_new ("");
! g_string_sprintf (buf, "CREATE TABLE %s (", add->name);
MySQL_add_column_data (buf, add->columns, ", ");
g_string_append (buf, "PRIMARY KEY (sys_id) )");
}
***************
*** 748,756 ****
/* for each table with new columns, construct a MODIFY command
*/
buf = g_string_new ("");
! name = oql_quote_column (add->name, NULL, OQL_DBTYPE_MYSQL);
! g_string_sprintf (buf, "ALTER TABLE %s ADD ", name);
! g_free (name);
MySQL_add_column_data (buf, add->columns, ", ADD ");
buf->str[strlen (buf->str) - 5] = '\0';
while (isspace (buf->str[strlen (buf->str) - 1]) ||
--- 743,749 ----
/* for each table with new columns, construct a MODIFY command
*/
buf = g_string_new ("");
! g_string_sprintf (buf, "ALTER TABLE %s ADD ", add->name);
MySQL_add_column_data (buf, add->columns, ", ADD ");
buf->str[strlen (buf->str) - 5] = '\0';
while (isspace (buf->str[strlen (buf->str) - 1]) ||
Index: gnue/geas/src/objectstore/postgresql.c
diff -c gnue/geas/src/objectstore/postgresql.c:1.15
gnue/geas/src/objectstore/postgresql.c:1.16
*** gnue/geas/src/objectstore/postgresql.c:1.15 Sat Dec 15 15:09:54 2001
--- gnue/geas/src/objectstore/postgresql.c Wed Dec 19 15:06:26 2001
***************
*** 20,26 ****
along with GEAS; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
! $Id: postgresql.c,v 1.15 2001/12/15 20:09:54 reinhard Exp $
*/
#include "config.h"
--- 20,26 ----
along with GEAS; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
! $Id: postgresql.c,v 1.16 2001/12/19 20:06:26 reinhard Exp $
*/
#include "config.h"
***************
*** 693,706 ****
postgresql_add_column_data (GString *buf, GList *l, const char *separator)
{
DBchange *c;
- char *name;
while (l)
{
c = (DBchange *) l->data;
! name = oql_quote_column (NULL, c->name, OQL_DBTYPE_POSTGRESQL);
! g_string_append (buf, name);
! g_free (name);
g_string_append (buf, " ");
switch (c->datatype)
--- 693,703 ----
postgresql_add_column_data (GString *buf, GList *l, const char *separator)
{
DBchange *c;
while (l)
{
c = (DBchange *) l->data;
! g_string_append (buf, c->name);
g_string_append (buf, " ");
switch (c->datatype)
***************
*** 768,774 ****
gboolean remove_items, int *errorcode,
char **errormsg)
{
- char *name;
GString *buf;
DatabaseChange *changes = NULL;
GList *tmp;
--- 765,770 ----
***************
*** 863,871 ****
{
/* for each new table, construct a CREATE command */
buf = g_string_new ("");
! name = oql_quote_column (add->name, NULL, OQL_DBTYPE_POSTGRESQL);
! g_string_sprintf (buf, "CREATE TABLE %s (", name);
! g_free (name);
postgresql_add_column_data (buf, add->columns, ", ");
g_string_append (buf, "PRIMARY KEY (sys_id) )");
--- 859,865 ----
{
/* for each new table, construct a CREATE command */
buf = g_string_new ("");
! g_string_sprintf (buf, "CREATE TABLE %s (", add->name);
postgresql_add_column_data (buf, add->columns, ", ");
g_string_append (buf, "PRIMARY KEY (sys_id) )");
***************
*** 895,904 ****
while (l)
{
buf = g_string_new ("");
! name =
! oql_quote_column (add->name, NULL, OQL_DBTYPE_POSTGRESQL);
! g_string_sprintf (buf, "ALTER TABLE %s ADD ", name);
! g_free (name);
/* tmplst hack because postgresql can only add one column at a
time */
/* and I want to reuse postgresql_add_column_data */
--- 889,895 ----
while (l)
{
buf = g_string_new ("");
! g_string_sprintf (buf, "ALTER TABLE %s ADD ", add->name);
/* tmplst hack because postgresql can only add one column at a
time */
/* and I want to reuse postgresql_add_column_data */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/geas/src/objectstore compare.c mysql.c pos...,
Reinhard Mueller <=