glom r1814 - in trunk: . glom glom/libglom/data_structure glom/mode_design/fields
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1814 - in trunk: . glom glom/libglom/data_structure glom/mode_design/fields
- Date: Thu, 18 Dec 2008 17:38:30 +0000 (UTC)
Author: murrayc
Date: Thu Dec 18 17:38:30 2008
New Revision: 1814
URL: http://svn.gnome.org/viewvc/glom?rev=1814&view=rev
Log:
2008-12-18 Murray Cumming <murrayc murrayc com>
* glom/mode_design/fields/box_db_table_definition.cc:
get_field_definition(): Actually store the primary-key and unique
details. This was a regression since the port to libgda 4.0.
Modified:
trunk/ChangeLog
trunk/glom/dialog_import_csv_progress.cc
trunk/glom/libglom/data_structure/glomconversions.cc
trunk/glom/mode_design/fields/box_db_table_definition.cc
Modified: trunk/glom/dialog_import_csv_progress.cc
==============================================================================
--- trunk/glom/dialog_import_csv_progress.cc (original)
+++ trunk/glom/dialog_import_csv_progress.cc Thu Dec 18 17:38:30 2008
@@ -93,7 +93,8 @@
void Dialog_Import_CSV_Progress::begin_import()
{
- m_progress_bar->set_text(Glib::ustring::compose("%1 / %2", m_current_row, m_data_source->get_row_count()));
+ //Note to translators: This is a progress indication, showing how many rows have been imported, of the total number of rows.
+ m_progress_bar->set_text(Glib::ustring::compose(_("%1 / %2"), m_current_row, m_data_source->get_row_count()));
m_progress_bar->set_fraction(0.0);
m_progress_connection = Glib::signal_idle().connect(sigc::mem_fun(*this, &Dialog_Import_CSV_Progress::on_idle_import));
@@ -123,7 +124,8 @@
bool Dialog_Import_CSV_Progress::on_idle_import()
{
- m_progress_bar->set_text(Glib::ustring::compose("%1 / %2", m_current_row, m_data_source->get_row_count()));
+ //Note to translators: This is a progress indication, showing how many rows have been imported, of the total number of rows.
+ m_progress_bar->set_text(Glib::ustring::compose(_("%1 / %2"), m_current_row, m_data_source->get_row_count()));
m_progress_bar->set_fraction(static_cast<double>(m_current_row) / static_cast<double>(m_data_source->get_row_count()));
if(m_current_row == m_data_source->get_row_count())
@@ -142,10 +144,10 @@
const sharedptr<Field>& field = m_data_source->get_field_for_column(i);
if(field)
{
- bool success;
-
- // We always assume exported data was stored in postgres format, since
- // we do export it this way.
+ // We always assume exported data is in postgres format, since
+ // we export it this way.
+ // TODO: Document what that format is.
+ bool success = false;
Gnome::Gda::Value value = field->from_sql(m_data_source->get_data(m_current_row, i), Field::SQL_FORMAT_POSTGRES, success);
if(success)
@@ -193,12 +195,14 @@
if(Glom::Conversions::value_is_empty(primary_key_value))
{
- Glib::ustring message(Glib::ustring::compose(_("Error importing row %1: Cannot import the row since the primary key is empty.\n"), m_current_row + 1));
+ Glib::ustring message(Glib::ustring::compose(_("Error importing row %1: Cannot import the row because the primary key is empty.\n"), m_current_row + 1));
add_text(message);
}
else
{
+ std::cout << "Dialog_Import_CSV_Progress::on_idle_import(): Calling record_new() with primary_key_value=" << primary_key_value.to_string() << " ..." << std::endl;
record_new(true /* use_entered_data */, primary_key_value);
+ std::cout << "Dialog_Import_CSV_Progress::on_idle_import(): ... Finished calling record_new()" << std::endl;
}
m_current_row_values.clear();
@@ -217,7 +221,9 @@
Gnome::Gda::Value Dialog_Import_CSV_Progress::get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) const
{
type_mapValues::const_iterator iter = m_current_row_values.find(field->get_name());
- if(iter == m_current_row_values.end()) return Gnome::Gda::Value();
+ if(iter == m_current_row_values.end())
+ return Gnome::Gda::Value();
+
return iter->second;
}
@@ -234,7 +240,9 @@
Gnome::Gda::Value Dialog_Import_CSV_Progress::get_primary_key_value_selected() const
{
type_mapValues::const_iterator iter = m_current_row_values.find(m_field_primary_key->get_name());
- if(iter == m_current_row_values.end()) return Gnome::Gda::Value();
+ if(iter == m_current_row_values.end())
+ return Gnome::Gda::Value();
+
return iter->second;
}
Modified: trunk/glom/libglom/data_structure/glomconversions.cc
==============================================================================
--- trunk/glom/libglom/data_structure/glomconversions.cc (original)
+++ trunk/glom/libglom/data_structure/glomconversions.cc Thu Dec 18 17:38:30 2008
@@ -451,7 +451,7 @@
else if(glom_type == Field::TYPE_IMAGE)
{
//Return the binary-as-escaped-text format, suitable for use in the document.
- //TODO: Where do we need this? Do we need to have this in SQLite format sometimes?
+ //TODO_sqlite: Where do we need this? Do we need to have this in SQLite format sometimes?
std::string result;
long buffer_length;
const guchar* buffer = value.get_binary(buffer_length);
@@ -609,7 +609,7 @@
{
//We assume that the text is the same (escaped text) format that we use in the document when saving images:
//(The SQL format).
- // TODO: For what do we need this? Does this have to be in SQLite format sometimes?
+ // TODO_sqlite: For what do we need this? Does this have to be in SQLite format sometimes?
Gnome::Gda::Value result;
size_t buffer_binary_length = 0;
@@ -1103,6 +1103,9 @@
Glib::ustring Conversions::escape_binary_data_postgres(guint8* buffer, size_t buffer_size)
{
+ std::cout << "Conversions::escape_binary_data_postgres()" << std::endl;
+
+
//g_warning("Conversions::get_escaped_binary_data: debug: buffer ");
//for(int i = 0; i < 10; ++i)
// g_warning("%02X (%c), ", (guint8)buffer[i], buffer[i]);
@@ -1160,6 +1163,7 @@
guint8* Conversions::unescape_binary_data_postgres(const Glib::ustring& escaped_binary_data, size_t& length)
{
+ std::cout << "Conversions::unescape_binary_data_postgres()" << std::endl;
return Glom_PQunescapeBytea((const guchar*)escaped_binary_data.c_str(), &length);
}
Modified: trunk/glom/mode_design/fields/box_db_table_definition.cc
==============================================================================
--- trunk/glom/mode_design/fields/box_db_table_definition.cc (original)
+++ trunk/glom/mode_design/fields/box_db_table_definition.cc Thu Dec 18 17:38:30 2008
@@ -415,17 +415,21 @@
GType fieldType = Field::get_gda_type_for_glom_type(glom_type);
//Unique:
- //const bool bUnique = m_AddDel.get_value_as_bool(row, m_colUnique);
+ const bool bUnique = m_AddDel.get_value_as_bool(row, m_colUnique);
//TODO_gda: fieldInfo->set_unique_key(bUnique);
//Primary Key:
- //const bool bPrimaryKey = m_AddDel.get_value_as_bool(row, m_colPrimaryKey);
+ const bool bPrimaryKey = m_AddDel.get_value_as_bool(row, m_colPrimaryKey);
///TODO_gda: fieldInfo->set_primary_key(bPrimaryKey);
fieldInfo->set_g_type(fieldType);
//Put it together:
fieldResult->set_field_info(fieldInfo);
+
+ //TODO: Use the libgda functions above when we make them work:
+ fieldResult->set_unique_key(bUnique);
+ fieldResult->set_primary_key(bPrimaryKey);
}
return fieldResult;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]