Networking Forums

Networking Forums > Computer Networking > Linux Networking > Escaping * in SQL query from shell

Reply
Thread Tools Display Modes

Escaping * in SQL query from shell

 
 
me2online
Guest
Posts: n/a

 
      05-31-2007, 02:04 PM
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

 
Reply With Quote
 
 
 
 
Keith Keller
Guest
Posts: n/a

 
      05-31-2007, 07:32 PM
On 2007-05-31, me2online <(E-Mail Removed)> 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-(E-Mail Removed)
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information

 
Reply With Quote
 
Allen McIntosh
Guest
Posts: n/a

 
      05-31-2007, 11:02 PM
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell commands mu91t Linux Networking 3 08-07-2008 12:05 PM
shell mu91t Linux Networking 1 08-02-2008 06:30 AM
power shell anoop chandran Windows Networking 1 03-24-2008 04:47 PM
Escaping Plusnet Zzaaarathustra Broadband 43 08-20-2006 03:06 PM
p2p on shell. Mr_jud Linux Networking 0 12-08-2005 05:04 PM



1 2 3 4 5 6 7 8 9 10 11