[glom/mysql: 9/21] More MySQL implementation
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/mysql: 9/21] More MySQL implementation
- Date: Fri, 11 Jan 2013 11:31:59 +0000 (UTC)
commit d45c75ad9313a336c63db288faeff913e41d772e
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Jan 3 22:18:05 2013 +0100
More MySQL implementation
glom/libglom/connectionpool_backends/mysql.cc | 2 +-
glom/libglom/connectionpool_backends/mysql_self.cc | 8 ++++----
glom/libglom/db_utils.cc | 8 +++++++-
3 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/glom/libglom/connectionpool_backends/mysql.cc b/glom/libglom/connectionpool_backends/mysql.cc
index bb5353a..18ad52b 100644
--- a/glom/libglom/connectionpool_backends/mysql.cc
+++ b/glom/libglom/connectionpool_backends/mysql.cc
@@ -864,7 +864,7 @@ Gnome::Gda::SqlOperatorType MySQL::get_string_find_operator() const
const char* MySQL::get_public_schema_name() const
{
- return "public";
+ return ""; //TODO_MySQL: Find out what to use here, to speed up the metadata update.
}
} //namespace ConnectionPoolBackends
diff --git a/glom/libglom/connectionpool_backends/mysql_self.cc b/glom/libglom/connectionpool_backends/mysql_self.cc
index df076b9..6ce6b64 100644
--- a/glom/libglom/connectionpool_backends/mysql_self.cc
+++ b/glom/libglom/connectionpool_backends/mysql_self.cc
@@ -182,7 +182,7 @@ Backend::InitErrors MySQLSelfHosted::initialize(const SlotProgress& slot_progres
+ " --no-defaults" //Otherwise Ubuntu specifies --user=mysql
+ " --datadir=" + Glib::shell_quote(dbdir_data);
//TODO: + " --random-passwords";
- std::cout << "debug: command_initdb=" << command_initdb << std::endl;
+ //std::cout << "debug: command_initdb=" << command_initdb << std::endl;
const bool result = Glom::Spawn::execute_command_line_and_wait(command_initdb, slot_progress);
if(!result)
{
@@ -354,13 +354,13 @@ Backend::StartupErrors MySQLSelfHosted::startup(const SlotProgress& slot_progres
+ " --datadir=" + Glib::shell_quote(dbdir_data)
+ " --socket=" + Glib::shell_quote(dbdir_socket)
+ " --pid-file=" + Glib::shell_quote(dbdir_pid);
- std::cout << G_STRFUNC << ": debug: command_mysql_start=" << command_mysql_start << std::endl;
+ //std::cout << G_STRFUNC << ": debug: command_mysql_start=" << command_mysql_start << std::endl;
m_port = available_port; //Needed by get_mysqladmin_command().
const std::string command_check_mysql_has_started = get_mysqladmin_command(m_saved_username, m_saved_password) //TODO: Get the temporary password in a callback.
+ " ping";
const std::string second_command_success_text = "mysqld is alive"; //TODO: This is not a stable API. Also, watch out for localisation.
- std::cout << G_STRFUNC << ": debug: command_check_mysql_has_started=" << command_check_mysql_has_started << std::endl;
+ //std::cout << G_STRFUNC << ": debug: command_check_mysql_has_started=" << command_check_mysql_has_started << std::endl;
const bool result = Glom::Spawn::execute_command_line_and_wait_until_second_command_returns_success(command_mysql_start, command_check_mysql_has_started, slot_progress, second_command_success_text);
std::cout << G_STRFUNC << std::cout << " DEBUG: started" << std::endl;
@@ -406,7 +406,7 @@ Backend::StartupErrors MySQLSelfHosted::startup(const SlotProgress& slot_progres
m_saved_password = m_initial_password_to_set;
const std::string query = build_query_change_username(gda_connection, "root", m_initial_username_to_set);
- std::cout << G_STRFUNC << std::cout << " DEBUG: rename user query=" << query << std::endl;
+ //std::cout << G_STRFUNC << std::cout << " DEBUG: rename user query=" << query << std::endl;
try
{
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index dcdc2b8..c9b68a7 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -1245,7 +1245,13 @@ bool create_table(const sharedptr<const TableInfo>& table_info, const Document::
info->set_g_type( Field::get_gda_type_for_glom_type(field->get_glom_type()) );
field->set_field_info(info); //TODO_Performance
- Glib::ustring sql_field_description = escape_sql_id(field->get_name()) + " " + field->get_sql_type();
+ Glib::ustring field_type = field->get_sql_type();
+ if(field_type == "varchar")
+ field_type = "varchar(255)"; //For MySQL.
+ else if(field_type == "VARBINARY")
+ field_type = "blob"; //For MySQL.
+
+ Glib::ustring sql_field_description = escape_sql_id(field->get_name()) + " " + field_type;
if(field->get_primary_key())
sql_field_description += " NOT NULL PRIMARY KEY";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]