forums › forums › SQLyog › Using SQLyog › How do you?
- This topic is empty.
-
AuthorPosts
-
-
December 5, 2003 at 9:17 pm #8268LanceMember
How do you get the app to take a MySQL function as a default value like PhpMyAdmin will?
-
December 6, 2003 at 1:30 am #15329RiteshMember
Can you explain a little more?
-
December 6, 2003 at 10:01 pm #15330LanceMember
When you define a table (or alter) a table in PHPMyAdmin, it will let you use a MySQL function (e.g. Now()) as a default value for the field. I can not figure out how to get SQLyog to set this type of default. Or is that type of default even possible?
Thanks!
-
December 7, 2003 at 4:30 am #15331mr slimMember
I'm wondering the same thing. It doesn't seem to take a MySQL function even when entered in a field in the F8 or F11 insert data windows. I see in the history window that when I use the NOW() function in a field in an insert/update data window, that SQLyog puts the function in quotes. For example assuming the field 'theDate' has a datatype of datetime:
insert into `abc`.`test` ( `the_id`, `name`, `theDate` ) values ( NULL, 'abc', 'NOW()' )
Since the function is seen as a string, it does nothing. If I copy and paste the the SQL line into the SQL window and remove the quotes from the function:
insert into `abc`.`test` ( `the_id`, `name`, `theDate` ) values ( NULL, 'abc', NOW() )
the NOW() function is executed and the date is inserted into the relevant field as it should be. But it would be nice to know how to or to be able to do this from within the insert data windows themselves. And also to set default values based on functions, as Lance wants to do.
-
December 8, 2003 at 12:49 pm #15332ShadowMember
An excerpt from MySql's manual:
Quote:A DEFAULT value has to be a constant, it cannot be a function or an expression.(6.5.3 CREATE TABLE Syntax)
I beleive that answers your question.
-
December 8, 2003 at 12:55 pm #15333ShadowMember
Later on, when you insert new rows into an existing table (or update rows) then you may be able tos specify functions as the value of the field. phpMyAdmin must have some kind of a workaround to allow this feature. SQLyog's insert/update window does not allow functions to be used, but it's an admin tool rather than an end-user-data-entry tool.
-
December 9, 2003 at 6:23 am #15334mr slimMemberQuote:SQLyog's insert/update window does not allow functions to be used, but it's an admin tool rather than an end-user-data-entry tool.
Webyog may choose to change this characteristic or not, but I wouldn't be so quick to rationalize it away with semantics. I'm very pleased with this product, intend to continue to use it and look forward to seeing its future development. But this is a shortcoming, not a strength, regardless of what adjective one chooses to say what kind of tool it is.
I hadn't realized that MySQL doesn't take functions as a default. Thanks, shadow, for pointing that out. No reason why SQLyog must do what the database doesn't (though having a useful feature never hurts), but in the case of a function in the insert/update window, it fails to execute something that the database supports. I think it would be a realistic and welcome addition for at least that much to be supported.
Again, I say this constructively as a happy user.
-
December 9, 2003 at 9:43 am #15335ShadowMember
What I wanted to point out by saying that SQLyog is an admin tool was that it can be used to enter loads of data through its GUI, but it's not really convenient regardless of the support (no support in this case) of MySql functions. You can still write your own SQL statements in its SQL window and have them executed. If it had form designer and report building capabilities, then yes, I would complain about not supporting MySql functions in the data entry tool. Its stated primary objective is to be the best tool for managing dbs. As time passes, it may acquire end-user friendly functions, of course. However, I believe an improved sync engine is more important.
Regarding the support of non-standard defauld values (functions, etc.). I would say it is MySql's task to implement this absolutely useful feature. Workarounds can be devoleped (by storing parametrized queries in SQLyog, for example), but they could not be used outside of SQLyog. If the developers of SQLyog decided to create a full end-user tool, then they should consider incorporating this function, as well.
-
December 10, 2003 at 7:45 am #15336mr slimMember
Thanks for the clarification, shadow.
-
-
AuthorPosts
- You must be logged in to reply to this topic.