Difference between revisions of "Lianja ODBC Driver on Windows"
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 24: | Line 24: | ||
===Calling Stored Procedures=== | ===Calling Stored Procedures=== | ||
− | Stored Procedures can be called using the '''CALL''' command. Stored procedures are .prg script files residing in a database's directory. For example, the script sp_demo.prg has been created in the southwind database in the Lianja App Builder: | + | Stored Procedures can be called using the '''CALL''' command. Stored procedures are .prg Lianja script files residing in a database's directory. For example, the script sp_demo.prg has been created in the southwind database in the Lianja App Builder: |
[[{{ns:file}}:StoredProcedure.png|150px|thumb|left|Stored Procedure]] | [[{{ns:file}}:StoredProcedure.png|150px|thumb|left|Stored Procedure]] | ||
It takes a parameter, selects data and returns the data as a resultset: | It takes a parameter, selects data and returns the data as a resultset: | ||
Line 45: | Line 45: | ||
browse | browse | ||
endif | endif | ||
+ | sqldisconnect(nhand) | ||
+ | endif</code> | ||
+ | |||
+ | ===Issuing Liana Commands=== | ||
+ | Non-UI Lianja commands can be sent to the Lianja SQL Server by prefixing them with the '''LIANJA''' command. For example, [[:Category:Set Commands|Set Commands]] can be issued or status information output to a file. | ||
+ | <code lang="recital"> | ||
+ | // List status information to a file | ||
+ | nhand = sqlconnect("Lianja_Southwind") | ||
+ | if nhand > 0 | ||
+ | nret = sqlexec(nhand,"lianja list status to file 'C:\Temp\status.txt") | ||
sqldisconnect(nhand) | sqldisconnect(nhand) | ||
endif</code> | endif</code> |
Revision as of 07:28, 7 February 2013
Contents
Before Using the Lianja ODBC Driver
Before using the Lianja ODBC Driver, complete the following steps:
- Download and install the driver. The driver is included in the Lianja SQL Server distribution and a client driver-only Lianja ODBC Driver distribution. The driver requires a local or remote Lianja SQL Server to operate.
- Select your Lianja database or create it in the Lianja App Builder Data Workspace or using SQL.
- Copy or Deploy your database to the Lianja SQL Server Database directory.
- Make sure the Lianja SQL Server service is running.
- Create a DSN for your data source in the Lianja ODBC Manager and test the connection.
Using ODBC Data Sources in the Lianja App Builder
Your Lianja ODBC DSN (as well as third-party ODBC data sources) can be accessed from the Lianja App Builder in the following ways:
- Using the SQL Remote Data Connectivity Functions
- Using the USE...CONNSTR NoSQL Command
- By creating a Virtual Table in a local database
- In the ODBC Console
- By Importing the data into a new local database
Lianja ODBC Driver Additional Functionality
Full Lianja SQL documentation can be found here: SQL.
Calling Stored Procedures
Stored Procedures can be called using the CALL command. Stored procedures are .prg Lianja script files residing in a database's directory. For example, the script sp_demo.prg has been created in the southwind database in the Lianja App Builder:
It takes a parameter, selects data and returns the data as a resultset:
// sp_demo.prg lparameters lcState select account_no, state from example; where state = lcState; into cursor curExample return setresultset("curExample")
After being deployed to the Lianja SQL Server database directory, it can be called when an ODBC connection to the southwind database is active:
nhand = sqlconnect("Lianja_Southwind") if nhand > 0 nret = sqlexec(nhand,"call sp_demo('MA')","mycursor") if nret > 0 select mycursor browse endif sqldisconnect(nhand) endif
Issuing Liana Commands
Non-UI Lianja commands can be sent to the Lianja SQL Server by prefixing them with the LIANJA command. For example, Set Commands can be issued or status information output to a file.
// List status information to a file nhand = sqlconnect("Lianja_Southwind") if nhand > 0 nret = sqlexec(nhand,"lianja list status to file 'C:\Temp\status.txt") sqldisconnect(nhand) endif