Unsupported Screen Size: The viewport size is too small for the theme to render properly.

How do you?

forums forums SQLyog Using SQLyog How do you?

  • This topic is empty.
Viewing 8 reply threads
  • Author
    Posts
    • #8268
      Lance
      Member

      How do you get the app to take a MySQL function as a default value like PhpMyAdmin will?

    • #15329
      Ritesh
      Member

      Can you explain a little more?

    • #15330
      Lance
      Member

      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!

    • #15331
      mr slim
      Member

      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.

    • #15332
      Shadow
      Member

      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.

    • #15333
      Shadow
      Member

      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.

    • #15334
      mr slim
      Member
      Quote:
      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.

    • #15335
      Shadow
      Member

      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.

    • #15336
      mr slim
      Member

      Thanks for the clarification, shadow.

Viewing 8 reply threads
  • You must be logged in to reply to this topic.