Skip to content

Commit

Permalink
Tableconvert: SQL: All colums are now handled as strings
Browse files Browse the repository at this point in the history
  • Loading branch information
frlan committed Sep 28, 2014
1 parent ae2f079 commit 36fdddc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
8 changes: 8 additions & 0 deletions tableconvert/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2014-09-28 Frank Lanitz <[email protected]>

* SQL: Treating every column as a string when transfering data to SQL
Most DBMS can take a string and convert them to e.g. integer.
However, some check for integer would be useful nevertheless



2011-10-06 Frank Lanitz <[email protected]>

* Fixing some i18n issue.
Expand Down
17 changes: 9 additions & 8 deletions tableconvert/src/tableconvert.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* tableconvert.c
*
* Copyright 2011-2013 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
* Copyright 2011-2014 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -94,9 +94,9 @@ TableConvertRule tablerules[] = {
"",
"",
"",
",",
"\t(",
")",
"','",
"\t('",
"')",
",\n",
";"
}
Expand All @@ -105,7 +105,7 @@ TableConvertRule tablerules[] = {

static GtkWidget *main_menu_item = NULL;

static gchar* convert_to_table_worker(gchar **rows, gboolean header,
static gchar* convert_to_table_worker(gchar **rows, gboolean header,
const TableConvertRule *rule)
{
guint i;
Expand Down Expand Up @@ -135,8 +135,8 @@ static gchar* convert_to_table_worker(gchar **rows, gboolean header,
header == TRUE)
{
g_string_append(replacement_str, rule->header_stop);
/* We are assuming, that if someone inserts a head,
* only in this case we will insert some special body.
/* We are assuming, that if someone inserts a head,
* only in this case we will insert some special body.
* Might needs to be discussed further */
g_string_append(replacement_str, rule->body_start);
}
Expand Down Expand Up @@ -165,7 +165,7 @@ static gchar* convert_to_table_worker(gchar **rows, gboolean header,
{
g_string_append(replacement_str, rule->body_end);
}

/* Adding the footer of table */
g_string_append(replacement_str, rule->end);

Expand Down Expand Up @@ -218,6 +218,7 @@ static void convert_to_table(gboolean header)
}
case GEANY_FILETYPES_SQL:
{
/* TODO: Check for INTEGER and other datatypes on SQL */
replacement = convert_to_table_worker(rows,
header,
&tablerules[TC_SQL]);
Expand Down

0 comments on commit 36fdddc

Please sign in to comment.