Thread: are \r \n and \t legal in

are \r \n and \t legal in

From
Heitzso
Date:
PreparedStatement setString(i, s)

i.e.

p = connection.preparedStatement("SELECT a FROM b WHERE c = ?");
String s = "hello\t\out\r\nthere\t\t\t\r\n";
p.setString(1, s);

Just beating my head against the wall trying to sort out
what I'm doing wrong and about to hook up to MS SQL Server
via Sprinta to get this working ...

Thanks,
Heitzso


Re: are \r \n and \t legal in

From
Barry Lind
Date:
They should be.  Is the \o a typo below, or are you really trying to
send \o?

thanks,
--Barry

Heitzso wrote:

> PreparedStatement setString(i, s)
>
> i.e.
>
> p = connection.preparedStatement("SELECT a FROM b WHERE c = ?");
> String s = "hello\t\out\r\nthere\t\t\t\r\n";
> p.setString(1, s);
>
> Just beating my head against the wall trying to sort out
> what I'm doing wrong and about to hook up to MS SQL Server
> via Sprinta to get this working ...
>
> Thanks,
> Heitzso
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>



Re: are \r \n and \t legal in

From
Heitzso
Date:
it was a typo

everything works now, problem was my actual query/update code
lacked a space after table name and the where, i.e.

"SELECT a FROM " + table_name +
"WHERE ... etc."

because of the way I had laid out my code the missing space
didn't jump out at me and the sql exception message wasn't clear

When I jumped over to MS SQL Server and Sprinta and the
problem didn't go away I knew it was in my court and dug out the typo.

Another (my bug) problem came in when I jumped from Statement to
PreparedStatement but didn't drop the query from the executeUpdate(query)
and SQL reported a parse error on "".    Once I pulled the query
from the method call with PreparedStatement everything worked
like a champ.

All is well now.

Thanks,
Heitzso

> They should be.  Is the \o a typo below, or are you really trying to
> send \o?
>
> thanks,
> --Barry
>
> Heitzso wrote:
>
>> PreparedStatement setString(i, s)
>>
>> i.e.
>>
>> p = connection.preparedStatement("SELECT a FROM b WHERE c = ?");
>> String s = "hello\t\out\r\nthere\t\t\t\r\n";
>> p.setString(1, s);
>>
>> Just beating my head against the wall trying to sort out
>> what I'm doing wrong and about to hook up to MS SQL Server
>> via Sprinta to get this working ...
>>
>> Thanks,
>> Heitzso
>>