Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db_update_table() function should not require an engine type or comment #2608

Closed
ddb4github opened this issue Apr 3, 2019 · 2 comments
Closed
Assignees
Labels
api API related issues enhancement General tag for an enhancement
Milestone

Comments

@ddb4github
Copy link
Contributor

ddb4github commented Apr 3, 2019

Update diff to add 'comments'

--- ulib//database.php	2019-03-31 02:45:32.000000000 +0800
+++ ulib//database.php	2019-04-03 19:13:09.000000383 +0800
@@ -894,13 +894,13 @@
 		WHERE TABLE_SCHEMA = SCHEMA()
 		AND TABLE_NAME = '$table'", $log, $db_conn);
 
-	if (isset($info['TABLE_COMMENT']) && str_replace("'", '', $info['TABLE_COMMENT']) != str_replace("'", '', $data['comment'])) {
+	if (isset($info['TABLE_COMMENT']) && isset($data['comment']) && str_replace("'", '', $info['TABLE_COMMENT']) != str_replace("'", '', $data['comment'])) {
 		if (!db_execute("ALTER TABLE `$table` COMMENT '" . str_replace("'", '', $data['comment']) . "'", $log, $db_conn)) {
 			return false;
 		}
 	}
 
-	if (isset($info['ENGINE']) && strtolower($info['ENGINE']) != strtolower($data['type'])) {
+	if (isset($info['ENGINE']) && isset($data['type']) && strtolower($info['ENGINE']) != strtolower($data['type'])) {
 		if (!db_execute("ALTER TABLE `$table` ENGINE = " . $data['type'], $log, $db_conn)) {
 			return false;
 		}
@netniV
Copy link
Member

netniV commented Apr 3, 2019

$data['type'] check should probably be !empty($data['type'])

@ddb4github
Copy link
Contributor Author

Yes, I missed

@ddb4github ddb4github changed the title db_update_table should not required table engine db_update_table should not required table engine and comments Apr 3, 2019
@netniV netniV changed the title db_update_table should not required table engine and comments db_update_table() function should not require an engine type or comment Apr 4, 2019
@netniV netniV self-assigned this Apr 4, 2019
@netniV netniV added api API related issues enhancement General tag for an enhancement labels Apr 4, 2019
@netniV netniV added this to the v1.2.4 milestone Apr 4, 2019
@netniV netniV closed this as completed Apr 4, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api API related issues enhancement General tag for an enhancement
Projects
None yet
Development

No branches or pull requests

2 participants