Re: Import mysql dump into 4D v15, build database structure & import data
Michael, Hi. Well, straight away I can see that the your CREATE TABLE command includes specific directives that only apply to MySQL, e.g. ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci so that will most likely be the reason why it is ignored. I think you need to adapt MySQL's CREATE TABLE command to be compatible with 4D's SQL syntax. I searched the 4D Tech archive and found this that might help you: http://4d.1045681.n5.nabble.com/Creating-SQL-Tables-td5716546.html Regards, Narinder Chandi, ToolBox Systems Ltd. -- -Original Message- From: 4D_Tech <4d_tech-boun...@lists.4d.com> on behalf of 4D Tech Mailing List <4d_tech@lists.4d.com> Reply-To: 4D Tech Mailing List <4d_tech@lists.4d.com> Date: Saturday, 22 June 2019 at 16:10 To: 4D Tech Mailing List <4d_tech@lists.4d.com> Cc: jarosz Subject: Re: Import mysql dump into 4D v15, build database structure & import data Hi Narinder I have found that the SQL EXECUTE SCRIPT command will import records into a pre-existing database structure. So INSERT INTO `nmiep_action_logs` (`id`, `message_language_key`, `message`, `log_date`, `extension`, `user_id`, `item_id`, `ip_address`) VALUES (1, 'PLG_ACTIONLOG_JOOMLA_USER_LOGGED_IN', '{\"action\":\"login\",\"userid\":\"707\",\"username\":\"admin\",\"accountlink\":\"index.php?option=com_users=user.edit=707\",\"app\":\"PLG_ACTIONLOG_JOOMLA_APPLICATION_ADMINISTRATOR\"}', '2019-06-12 11:23:03', 'com_users', 707, 0, 'COM_ACTIONLOGS_DISABLED'), will import 1 record into the nmiep_action_logs table with 8 fields. However it will ignore this code in the sql dump/import file CREATE TABLE `nmiep_action_logs` ( `id` int(10) UNSIGNED NOT NULL, `message_language_key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `message` text COLLATE utf8mb4_unicode_ci NOT NULL, `log_date` datetime NOT NULL DEFAULT '-00-00 00:00:00', `extension` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `user_id` int(11) NOT NULL DEFAULT '0', `item_id` int(11) NOT NULL DEFAULT '0', `ip_address` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0.0.0.0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; Do I need to write a database structure creation routine to parse this? Or has anyone written one already? Or do newer versions of 4D interpret this and create the database table and fields? Thanks Michael ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Import mysql dump into 4D v15, build database structure & import data
Hi Narinder I have found that the SQL EXECUTE SCRIPT command will import records into a pre-existing database structure. So INSERT INTO `nmiep_action_logs` (`id`, `message_language_key`, `message`, `log_date`, `extension`, `user_id`, `item_id`, `ip_address`) VALUES (1, 'PLG_ACTIONLOG_JOOMLA_USER_LOGGED_IN', '{\"action\":\"login\",\"userid\":\"707\",\"username\":\"admin\",\"accountlink\":\"index.php?option=com_users=user.edit=707\",\"app\":\"PLG_ACTIONLOG_JOOMLA_APPLICATION_ADMINISTRATOR\"}', '2019-06-12 11:23:03', 'com_users', 707, 0, 'COM_ACTIONLOGS_DISABLED'), will import 1 record into the nmiep_action_logs table with 8 fields. However it will ignore this code in the sql dump/import file CREATE TABLE `nmiep_action_logs` ( `id` int(10) UNSIGNED NOT NULL, `message_language_key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `message` text COLLATE utf8mb4_unicode_ci NOT NULL, `log_date` datetime NOT NULL DEFAULT '-00-00 00:00:00', `extension` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `user_id` int(11) NOT NULL DEFAULT '0', `item_id` int(11) NOT NULL DEFAULT '0', `ip_address` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0.0.0.0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; Do I need to write a database structure creation routine to parse this? Or has anyone written one already? Or do newer versions of 4D interpret this and create the database table and fields? Thanks Michael -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Import mysql dump into 4D v15, build database structure & import data
Could you import the SQL script file using the SQL EXECUTE SCRIPT command? Regards, Narinder Chandi, ToolBox Systems Ltd. -- -Original Message- From: 4D_Tech <4d_tech-boun...@lists.4d.com> on behalf of 4D Tech Mailing List <4d_tech@lists.4d.com> Reply-To: 4D Tech Mailing List <4d_tech@lists.4d.com> Date: Thursday, 13 June 2019 at 15:34 To: 4D Tech Mailing List <4d_tech@lists.4d.com> Cc: jarosz Subject: Import mysql dump into 4D v15, build database structure & import data In 4D v15 there is an SQL EXPORT DATABASE command which exports the database as an SQL dump file. Is there an equivalent function to import an SQL dump file, create the database structure in 4D, and import the data into it? ie the equivalent of the import function in phpmyadmin? Or does anybody have some code to do this which they'd be willing to share? Michael Jarosz -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com ** ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Import mysql dump into 4D v15, build database structure & import data
In 4D v15 there is an SQL EXPORT DATABASE command which exports the database as an SQL dump file. Is there an equivalent function to import an SQL dump file, create the database structure in 4D, and import the data into it? ie the equivalent of the import function in phpmyadmin? Or does anybody have some code to do this which they'd be willing to share? Michael Jarosz -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **