Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. MySQL

MySQL

Scheduled Pinned Locked Moved Database
databasemysqlsql-serversysadmin
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mycroft Holmes
    wrote on last edited by
    #1

    I've been faffing around with MariaDB with the view to converting our SQL Server Apps. First step is to convert out CRUD code generator. I'm used to SQL Server which insists that I prefix a parameter value with @ MySQL has no such rule and you can end up with something like

    select *
    from vwTestMAF
    where TestMAFID = -1 or TestMAFID = TestMAFID;

    where the TestMAFID is both the field name and the parameter name and the query naturally does not work. Is there a naming convention for MySQL parameter (prefixing the parameter name with @ did not work either!)

    Never underestimate the power of human stupidity RAH

    M M 2 Replies Last reply
    0
    • M Mycroft Holmes

      I've been faffing around with MariaDB with the view to converting our SQL Server Apps. First step is to convert out CRUD code generator. I'm used to SQL Server which insists that I prefix a parameter value with @ MySQL has no such rule and you can end up with something like

      select *
      from vwTestMAF
      where TestMAFID = -1 or TestMAFID = TestMAFID;

      where the TestMAFID is both the field name and the parameter name and the query naturally does not work. Is there a naming convention for MySQL parameter (prefixing the parameter name with @ did not work either!)

      Never underestimate the power of human stupidity RAH

      M Offline
      M Offline
      Midi_Mick
      wrote on last edited by
      #2

      Perhaps qualifying the field names could help.

      ...where vwTestMAF.TestMAFID = -1 or vwTestMAF.TestMAFID = TestMAFID;

      Cheers, Mick ------------------------------------------------ It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.

      M 1 Reply Last reply
      0
      • M Mycroft Holmes

        I've been faffing around with MariaDB with the view to converting our SQL Server Apps. First step is to convert out CRUD code generator. I'm used to SQL Server which insists that I prefix a parameter value with @ MySQL has no such rule and you can end up with something like

        select *
        from vwTestMAF
        where TestMAFID = -1 or TestMAFID = TestMAFID;

        where the TestMAFID is both the field name and the parameter name and the query naturally does not work. Is there a naming convention for MySQL parameter (prefixing the parameter name with @ did not work either!)

        Never underestimate the power of human stupidity RAH

        M Offline
        M Offline
        Michael_Davies
        wrote on last edited by
        #3

        The old MySQL method was to placehold with ? so and you had to add the values in the right order, currently MySQL uses @ and it works, not sure about MariaDB; select * from vwTestMAF where TestMAFID = -1 or TestMAFID = ?;

        1 Reply Last reply
        0
        • M Midi_Mick

          Perhaps qualifying the field names could help.

          ...where vwTestMAF.TestMAFID = -1 or vwTestMAF.TestMAFID = TestMAFID;

          Cheers, Mick ------------------------------------------------ It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          Qualifying the names did the trick, I was hoping there was a standard convention the mysql users would recognise.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups