Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index

On Thu, 2012-03-01 at 14:11 +0000, Mark Stanton wrote:
Hi Fernand,

so "?" works for native SQL
      ":" works for OO-SQL

I'm not sure if you are asking me a question or making a statement.
What you are saying is not what I was saying, I'm not certain it is right, 
I don't think it is.  I may be wrong :-)

1) For all datasource types Base supports - When a query definition is
parsed by LibreOffice before being sent to the database engine, allowing
for named parameters and nested queries, the syntax is :<parameter_name>

When the LibreOffice query definition is run a dialog box will prompt
the user for the parameter value(s), displaying the string

select * from foo where bar = :MyBar

When run will prompt the user using the string "MyBar". All input by the
user is treated as a string and then converted the appropriate data

2) For all datasource types Base supports - When using a basic script
you can create a parameterized query also, by using a prepared
statement. In this case the parameters are not named and are designated
by a ? character. You can assign values to the parameters by parameter
count (or place) starting with 1. You also must use setxxx functions
appropriate for the data type.

So - lets assume the table foo with structure:
id - integer
name - text

Then in the basic script you might use something like this

pstmt = <connection object>.prepareStatement("insert into foo
values( ?, ?)")
pstmt.setInt(1, 100)
pstmt.setString(2, "John Doe")

Best wishes,


For unsubscribe instructions e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.