how to pipe to variable of a "here document"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eight02645999@yahoo.com

    #1

    how to pipe to variable of a "here document"

    hi

    I need to execute sql command using a "here document" like in unix.

    os.popen("osql" , "w").write( """\
    select * from table
    go
    """)

    how can i pipe these result of the select into a variable?
    thanks

  • Burton Samograd

    #2
    Re: how to pipe to variable of a "here document"

    eight02645999@y ahoo.com writes:
    [color=blue]
    > I need to execute sql command using a "here document" like in unix.
    >
    > os.popen("osql" , "w").write( """\
    > select * from table
    > go
    > """)
    >
    > how can i pipe these result of the select into a variable?[/color]

    popen doesn't work that way. you can only open them read or write.
    you'll have to create a couple of pipes (one for reading, one for
    writing), do a fork, execve, etc with the posix api. at least that's
    how one does it in C...i'm a bit new to python so there might be
    better ways.

    --
    burton samograd kruhft .at. gmail
    kruhft.blogspot .com www.myspace.com/kruhft metashell.blogs pot.com

    Comment

    • Lawrence D'Oliveiro

      #3
      Re: how to pipe to variable of a "here document"

      In article <jeuj32pv3ppcbt vuobobhmp7jcp76 ribog@4ax.com>,
      Dennis Lee Bieber <wlfraed@ix.net com.com> wrote:
      [color=blue]
      > Question: Is there a DB-API module that can directly connect to the
      >database server?[/color]

      There certainly is for MySQL, which is what I mostly use.

      Comment

      • gry@ll.mit.edu

        #4
        Re: how to pipe to variable of a &quot;here document&quot;



        Comment

        Working...