Search the web
Sign In
New User? Sign Up
lnotes-l-new · lnotes-l
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Moving email users to a new server.   Message List  
Reply | Forward Message #3060 of 3562 |
RE: [lnotes-l] A simple Enquote() function (was: Generating a SQL query string) [2 Attachments]

I guess it is a debugger ‘thing’. If I print the string I’ve generated then it’s fine. However the same string assigned to the ODBCREsultSet.query shows the duplicated sets of quotes.  I wonder how I can see what is actually passed to Access?

 

 

 

From: lnotes-l-new@yahoogroups.com [mailto:lnotes-l-new@yahoogroups.com] On Behalf Of jdillon@...
Sent: 02 July 2009 18:14
To: lnotes-l-new@yahoogroups.com
Subject: RE: [lnotes-l] A simple Enquote() function (was: Generating a SQL query string) [2 Attachments]

 

[Attachment(s) from jdillon@... included below]



No, this is a function we include in a standard script library that we share across all our applications.
_____________________________________________________
 




Thanks

 

Is this just a debugger thing then?  I’ve done it via the enquote function but the debugger shows two pairs either side.  It seems that somehow these string values already have quotes. However if I miss out the enquote I don’t any quotes at ll.

 

 

From: lnotes-l-new@yahoogroups.com [mailto:lnotes-l-new@yahoogroups.com] On Behalf Of jdillon@...
Sent:
02 July 2009 17:36
To:
lnotes-l-new@yahoogroups.com
Subject:
[lnotes-l] A simple Enquote() function (was: Generating a SQL query string)

 

 


Another option is to use a simple Enquote() function.  Here's what I wrote:


Public Function EnQuote( strIn As String ) As String

       
       ' return a given input string wrapped in quotation marks

       ' this is especially useful when creating a CSV file
       
       On Error Goto errHandler

       
       EnQuote = Chr$( 34 ) & strIn & Chr$( 34 )

       
       Goto Done

       
errHandler:

       ' use your own code here: Call ErrorMessage( Err, Erl, Error$, Lsi_info( 2 ), False )

       Resume Done

Done:

       
End Function



Now when I build a string with lots of quotes, it looks something like this:

strNew = "<img src=" & Enquote( strImg ) _

      & " width=" & Enquote( Cstr( intWidth ) ) _

      & " height=" & Enquote( Cstr( intHeight ) ) _

      & " alt=" & Enquote( strAltTextIsImportant ) _

      & " title=" & Enquote( strImgTitle ) _

      & ">"


All the other methods (defining a QUOTE const, escaping quotes, etc) work too.

_____________________________________________________

One thing I do to make this whole process less confusing is assign the quote character to a variable, let's call it Q, so you get code like this:

 
Q = |'|
 
sql_query = "select * from t_names where lastname = " + quote + "Jones" + quote
 
That simply makes the line easier to read and keep track of whether you've closed all your quotes.
 

Robert D. Marshall

rdm@...

678-596-9095

 

 


From: lnotes-l-new@yahoogroups.com [mailto:lnotes-l-new@yahoogroups.com] On Behalf Of David Clark
Sent:
Thursday, July 02, 2009 10:45 AM
To:
lnotes-l-new@yahoogroups.com
Subject:
[lnotes-l] Generating a SQL query string

I’m trying to create a string to be used in a SQL query where field values are used as part of the string.  It seems that these must be enclosed in quotes to cope with empty values, the problem is that I always get a double set so instead of “test” I get “”test””.

Two methods are suggested for this:

1. Use different delimiters such as |    When I use this as the outer delimiter I get the above effect so |Where pen_id = “| + doc.penid(0) + |“|  leads to “Where pen_id = “”test”””  (in the debugger anyway).  If I use as the inner delimiter around the variable it works in so far as it gives “Where pen_id = |test|” but this isn’t valid SQL.

2. The other method I found says at if you want to include a quotation mark ( or pipe) then enter a double one. This is, I suppose, analogous to ‘escaping’ it.  This becomes quite comical as |Where pen_id = “”| + doc.penid(0) + |””|  leads to “Where pend_id = “””test”””  and “Where pen_id = “”” + doc.penid(0) + “”””  isn’t much better.

In the debugger, of course, the values of string variables are shown with quotes around them – it’s like I don’t need the quotes but if miss them out of the string generation I don’t get any.

I don’t have much hair as it is so help gratefully received.


--> --> -->


--> --> -->



Thu Jul 2, 2009 5:34 pm

beetroot_soup
Offline Offline
Send Email Send Email

Attachment
~WRD287.jpg
Type:
image/jpeg
Attachment
image001.jpg
Type:
image/jpeg
Forward
Message #3060 of 3562 |
Expand Messages Author Sort by Date

We have an older server that we are going to take out of commission and want to move all the users and their databases to a new server. The old server is R6.5...
rjcashmere
Offline Send Email
Jul 2, 2009
12:54 pm

Use admin client to move everyone via adminp Keith Brooks Sent from Lotus Notes Traveler 8.5 ... From: "rjcashmere" <rjcashmere@...> To:...
Keith Brooks
kbmsg
Offline Send Email
Jul 2, 2009
1:07 pm

We are planning on having the new server have the same name and IP as the old server.  Can we do that using AdminP?  Thanks. ... From: Keith Brooks...
Rob Johns
rjcashmere
Offline Send Email
Jul 2, 2009
1:20 pm

The way we do this is: Give the new box a temporary IP Address Shut down the existing server and copy all of the files across from the Notes Data directory ...
ron.devereux@...
rpd153
Offline Send Email
Jul 2, 2009
2:17 pm

I'm trying to create a string to be used in a SQL query where field values are used as part of the string. It seems that these must be enclosed in quotes to...
David Clark
beetroot_soup
Offline Send Email
Jul 2, 2009
2:50 pm

One thing I do to make this whole process less confusing is assign the quote character to a variable, let's call it Q, so you get code like this: Q = |'| ...
Robert D. Marshall
rdmarshall
Offline Send Email
Jul 2, 2009
3:17 pm

Well, I guess if I assign the value to a variable called "Q", I should use that variable in the code! <slap side of head> Good reason to include the Explicit...
Robert D. Marshall
rdmarshall
Offline Send Email
Jul 2, 2009
3:24 pm

Thanks I really wanted that to work but it still results in double quotes (that is 2 sets of double quotes) either side of the variable values. I agree it ...
David Clark
beetroot_soup
Offline Send Email
Jul 2, 2009
3:39 pm

Another option is to use a simple Enquote() function. Here's what I wrote: Public Function EnQuote( strIn As String ) As String ' return a given input string...
jdillon@...
Send Email
Jul 2, 2009
4:44 pm

Thanks Is this just a debugger thing then? I've done it via the enquote function but the debugger shows two pairs either side. It seems that somehow these ...
David Clark
beetroot_soup
Offline Send Email
Jul 2, 2009
5:02 pm

No, this is a function we include in a standard script library that we share across all our applications. _____________________________________________________...
jdillon@...
Send Email
Jul 2, 2009
5:18 pm

What I meant was - is it just the way I'm looking at these string in the debugger that makes it look wrong? From: lnotes-l-new@yahoogroups.com...
David Clark
beetroot_soup
Offline Send Email
Jul 2, 2009
5:27 pm

I guess it is a debugger 'thing'. If I print the string I've generated then it's fine. However the same string assigned to the ODBCREsultSet.query shows the...
David Clark
beetroot_soup
Offline Send Email
Jul 2, 2009
5:34 pm

I think I'm sure that the query passed to Access contains those extra quotes. My program inserts new rows if the query is a simple "SELECT * from pens" (funny...
David Clark
beetroot_soup
Offline Send Email
Jul 2, 2009
5:51 pm

It turns out there is a special way to do this by using parameters in the 'where' clause and then using a method to set those parameter values before executing...
David Clark
beetroot_soup
Offline Send Email
Jul 3, 2009
9:36 am

Depends on how quickly you want to do it. There is an admin process to move people to a new server - not sure if R8 is a complication though. It requires...
David Clark
beetroot_soup
Offline Send Email
Jul 2, 2009
2:13 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help