Richard-

Saturday, March 23, 2013, 10:45:30 AM, you wrote:

> Anyway, to deal with queries where I have to use non-standard syntax, it
> seems that I can have switches:

> switch dbTyp
> case postgres
> put "SELECT * FROM mytable WHERE icare=True" into dcmd
> break
> case mySql
> put "SELECT * FROM mytable WHERE icare=1" into dcmd
> break
> case SQLite
> put "SELECT * FROM mytable WHERE icare='TRUE'" into dcmd
> break
> end switch

If you end up needing to do that, I would code it as

put "SELECT * FROM mytable WHERE icare=" & dbBoolean(dbTyp) into dcmd

function dbBoolean pDbType
  local tBoolean
  
  switch pDbType
    case mySql
      put 1 into tBoolean
      break
    case SQLite
      put "'TRUE'" into tBoolean
      break
    default
      put "True" into tBoolean
  end switch
  return tBoolean
end dbBoolean

-- 
-Mark Wieder
 mwie...@ahsoftware.net


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to