Re: Trouble supporting mixed case entities.

Benjamin Scherrey <[email protected]>
Newsgroups gmane.comp.python.db.pypgsql.user
Organization Proteus Technologies, Inc.
Message-ID <TSPK85E312UJH43ACXUYXRMC0XTT.3e88decf@BONZO>
Bah! Didn't send correct code... here's the corrected code that demonstrates the problem:

------------------------------
from pyPgSQL import PgSQL

if __name__ == '__main__':
    src = PgSQL.connect( user="xxx", password="xxx", host="xxx", database="xxx" );
    cur = src.cursor()

    cstmt = ""
    sstmt = ""
    istmt = ""

    # Change this to demonstrate problem with mixed case...
    mixed = 0

    if not mixed:   
        cstmt = r"""create table test ( fname varchar(20), lname varchar(20) )"""
        istmt = r"""insert into test values ( 'Benjamin', 'Scherrey' )"""
        sstmt = r"""select fname, lname from test"""

    else:
        cstmt = r"""create table "Test" ( "FName" varchar(20), "LName" varchar(20) )"""
        istmt = r"""insert into "Test" values ( 'Benjamin', 'Scherrey' )"""
        sstmt = r"""select "FName", "LName" from "Test" """


    print cstmt
    cur.execute( cstmt )

    print istmt
    cur.execute( istmt )

    print sstmt
    cur.execute( sstmt )

    res = cur.fetchone()

    if not mixed:
        print res["fname"]
        print res["lname"]
    else:
        print res['"FName"']
        print res['"LName"']
    
    cur.close()
    src.close() 






-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.