XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
chris miszturSubject: Defining 'connection string' for ddtek:sql-insert at runtime.
Author: chris misztur
Date: 12 Jun 2013 02:21 PM
ERROR:
"Argument 1 of function 'ddtek:sql-insert' must be a string literal."

XQUERY:
ddtek:sql-insert(mf:getConnectionString("F0101Z2")...)

QUESTION:
I have a requirement to execute the same xquery against different database environments. Can I do this with the same xquery document but different dbs?

-c

Postnext
Ivan PedruzziSubject: Defining 'connection string' for ddtek:sql-insert at runtime.
Author: Ivan Pedruzzi
Date: 12 Jun 2013 02:58 PM
This is by design, DataDirect XQuery requires a literal to identify the table.

You will need to create multiple queries. You may also insert on multiple tables from the same query as long as the tables resides on the same database.


Ivan Pedruzzi
Stylus Studio Team

Postnext
Ivan PedruzziSubject: Defining 'connection string' for ddtek:sql-insert at runtime.
Author: Ivan Pedruzzi
Date: 12 Jun 2013 03:05 PM

notice also that the first argument is not a connection string but a table name.

The database connection (server, driver port, username, password, ...) is set outside the query.

In Stylus Studio you do that when you drag&drop a connection from File Explorer into the XQuery Editor.

When running the XQuery processor through the API you have to setup such connection in DataSource object
http://www.datadirect.com/resources/dis/xqj-tutorial/index.html


Ivan Pedruzzi
Stylus Studio Team

Postnext
chris miszturSubject: Defining 'connection string' for ddtek:sql-insert at runtime.
Author: chris misztur
Date: 12 Jun 2013 03:18 PM
I do see the connection info in the xqery metadata. So basically I would have to pre-process the file somehow to alter the metadata or API or create another xquery.

Do you have a .NET port of the SS api?

Postnext
Ivan PedruzziSubject: Defining 'connection string' for ddtek:sql-insert at runtime.
Author: Ivan Pedruzzi
Date: 12 Jun 2013 03:46 PM

I have to warn you, changing the metadata block outside Stylus Studio is not supported, this means there is no guarantee that will work on future releases.

DataDirect XQuery is only available as Java library.

Ivan

Postnext
chris miszturSubject: Defining 'connection string' for ddtek:sql-insert at runtime.
Author: chris misztur
Date: 13 Jun 2013 08:06 AM
Even though it's not supported and I might change my mind as the xquery complexity changes, this works for me ... for now.

http://pastebin.com/2MCn2awz

Postnext
chris miszturSubject: Defining 'connection string' for ddtek:sql-insert at runtime.
Author: chris misztur
Date: 13 Jun 2013 08:31 AM
And the executing batch file looks like this:

%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command "Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted; . .\AriadneChangeEnvironment.ps1; AriadneChangeEnvironment %1 %2"

Postnext
chris miszturSubject: Defining 'connection string' for ddtek:sql-insert at runtime.
Author: chris misztur
Date: 12 Jun 2013 03:43 PM
also, in a pipeline, is there a way to select the xquery scenario or whichever one is default is the one executed?

Posttop
chris miszturSubject: Defining 'connection string' for ddtek:sql-insert at runtime.
Author: chris misztur
Date: 12 Jun 2013 04:10 PM
I answered my own question. I see the declared external variables as inputs to the xquery files.

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.