Escaping * in SQL query from shell - Networking

This is a discussion on Escaping * in SQL query from shell - Networking ; I am trying to run a sql query from a c++ program on Solaris 10. It is simple like: select * from table but unfortunately shell takes * as its own wildcard and transforms query as select file1 file2 file3 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Escaping * in SQL query from shell

  1. Escaping * in SQL query from shell

    I am trying to run a sql query from a c++ program on Solaris 10. It is
    simple like:
    select * from table
    but unfortunately shell takes * as its own wildcard and transforms
    query as
    select file1 file2 file3 file4 from table
    where file1,2,3,4 are files in the folder from where I am executing
    the program.

    Any idea how can I escape this *?

    thanks
    ps


  2. Re: Escaping * in SQL query from shell

    me2online wrote:
    > I am trying to run a sql query from a c++ program on Solaris 10. It is
    > simple like:
    > select * from table
    > but unfortunately shell takes * as its own wildcard and transforms
    > query as select file1 file2 file3 file4 from table
    > where file1,2,3,4 are files in the folder from where I am executing
    > the program.
    >
    > Any idea how can I escape this *?


    It depends on the details of what you are doing. I'm guessing that you
    are using system() to execute a program that runs the query. Possible
    solutions:
    1) Put the argument to the query program in single quotes:
    system("foo 'select * from table'");
    2) Escape the * with a backslash (you will need 2 since C++ looks at
    backslashes)
    3) Execute the query program directly. This cuts the shell out of the
    picture.
    4) Use a library. This cuts the query program out of the picture also.

  3. Re: Escaping * in SQL query from shell

    On 2007-05-31, me2online wrote:
    > I am trying to run a sql query from a c++ program on Solaris 10.


    Then post to an SQL, C++, or Solaris group. Your question has nothing
    at all to do with linux or networking.

    --keith

    --
    kkeller-usenet@wombat.san-francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
    see X- headers for PGP signature information


+ Reply to Thread