sqlanywhere

Using named parameter only when passing integer

谁说我不能喝 提交于 2019-12-10 16:47:37
问题 Currently I'm trying to work with Named Parameters using SAP Sybase SQL Anywhere 12 with dapper. The following codes runs correctly: public class Test { public int Str1 { get; set; } public string Str2 { get; set; } } class Program { static void Main(string[] args) { using (SAConnection connection = new SAConnection("...")) { connection.Open(); Test test = connection.Query<Test>("SELECT :Str1 as Str1, :Str2 as Str2", new Test() { Str1 = 35, Str2 = "42" }).FirstOrDefault(); Console.WriteLine($

Sybase IN and OUT parameters

↘锁芯ラ 提交于 2019-12-10 14:59:35
问题 I'm going nuts about how the Sybase JDBC driver handles stored procedures with mixed IN and OUT parameters. Check out this simple stored procedure: CREATE OR REPLACE PROCEDURE p (IN i1 INT, OUT o1 INT, IN i2 INT, OUT o2 INT) BEGIN set o1 = i1; set o2 = i2; END And here's how I'd call it with JDBC: CallableStatement c = connection.prepareCall("{ call dba.p(?, ?, ?, ?) }"); c.setInt(1, 1); c.setInt(3, 2); c.registerOutParameter(2, Types.INTEGER); c.registerOutParameter(4, Types.INTEGER); c

How do I output progress messages from a SELECT statement?

陌路散爱 提交于 2019-12-10 13:03:37
问题 I have a SQL script that I want to output progress messages as it runs. Having it output messages between SQL statements is easy, however I have some very long running INSERT INTO SELECTs. Is there a way to have a select statement output messages as it goes, for example after every 1000 rows, or every 5 seconds? Note: This is for SQL Anywhere, but answers in any SQL dialect will be fine. 回答1: There's no way to retrieve the execution status of a single query. None of the mainstream database

Python + Twisted + sqlanydb = abort()

别来无恙 提交于 2019-12-08 02:09:49
问题 I'm using Twisted 11 together with SQLAnywhere 12 via the official sqlanydb driver. Generally, it works fine. But occasionally the application crashes with an abort on the first query. If one query worked, all following work too. However my tests run only seldom through. That's awful to develop with and strace doesn't tell me anything informative too. Sometimes it crashes inside of select(), sometimes in mmap()... I'm running 64bit Linux and run locally the Sybase as dbeng12 for testing. Is

Can I call a user-defined function from a column CHECK constraint?

戏子无情 提交于 2019-12-07 12:14:42
问题 I have a user-defined SQL function that returns 1 or 0 and I want to call it from a column CHECK constraint. 回答1: Yes. SQL Anywhere doesn't have a boolean data type so you have to code a predicate that yields TRUE, FALSE or UNKNOWN. In other words, if your function returns 1 or 0 for pass or fail, you have to code the constraint as CHECK ( f() = 1 ). Note that TRUE and UNKNOWN both result in a "pass"; only a FALSE result causes the check to fail. The following sample shows how to ALTER a

SQLAnywhere: Watcom SQL or T-SQL

吃可爱长大的小学妹 提交于 2019-12-07 04:17:54
问题 A general question. I am developing for Sybase SQL Anywhere 10. For backwards comptibility reasons, almost all our Stored procedures are written in Transact-SQL. Are there any advantages or disadvantages to using T-SQL instead of the Watcom dialect? 回答1: Advantages of TSQL: greater compatibility with Sybase ASE and Microsoft SQL Server Disadvantages of TSQL: some statements and functionality are only available in Watcom-SQL procedures. Some examples: greater control over EXECUTE IMMEDIATE

External “Hello World” Function in SQL Anywhere with Powerbuilder-generated DLL

戏子无情 提交于 2019-12-06 10:57:04
I created a function in PowerBuilder.NET Hello World . The project compiled as Helloworld.dll , generated in C# from the PowerBuilder utility. Inside Helloworld, I made the non-visual n_cst_helloworld . Inside the non-visual, I made the object function of_hello() . These are the issues I encountered when trying to access Helloworld.n_cst_helloworld.of_hello() in an external function on SQL Anywhere. The external function uses CLR and is called in Interactive SQL right now. Here is the script I'm trying to launch in iSQL (through ASA): ALTER PROCEDURE "DBA"."ext_helloworld"() EXTERNAL NAME

Python + Twisted + sqlanydb = abort()

半世苍凉 提交于 2019-12-06 06:13:02
I'm using Twisted 11 together with SQLAnywhere 12 via the official sqlanydb driver. Generally, it works fine. But occasionally the application crashes with an abort on the first query. If one query worked, all following work too. However my tests run only seldom through. That's awful to develop with and strace doesn't tell me anything informative too. Sometimes it crashes inside of select(), sometimes in mmap()... I'm running 64bit Linux and run locally the Sybase as dbeng12 for testing. Is anyone working successfully using these components? Any suggestions how to solve that? I used sqlanydb

Can I call a user-defined function from a column CHECK constraint?

女生的网名这么多〃 提交于 2019-12-05 13:08:15
I have a user-defined SQL function that returns 1 or 0 and I want to call it from a column CHECK constraint. Yes. SQL Anywhere doesn't have a boolean data type so you have to code a predicate that yields TRUE, FALSE or UNKNOWN. In other words, if your function returns 1 or 0 for pass or fail, you have to code the constraint as CHECK ( f() = 1 ). Note that TRUE and UNKNOWN both result in a "pass"; only a FALSE result causes the check to fail. The following sample shows how to ALTER a table that already contains data, to add a column with such a CHECK constraint. Breck CREATE TABLE t ( pkey

SQLAnywhere: Watcom SQL or T-SQL

☆樱花仙子☆ 提交于 2019-12-05 11:01:30
A general question. I am developing for Sybase SQL Anywhere 10. For backwards comptibility reasons, almost all our Stored procedures are written in Transact-SQL. Are there any advantages or disadvantages to using T-SQL instead of the Watcom dialect? Advantages of TSQL: greater compatibility with Sybase ASE and Microsoft SQL Server Disadvantages of TSQL: some statements and functionality are only available in Watcom-SQL procedures. Some examples: greater control over EXECUTE IMMEDIATE behavior in Watcom-SQL LOAD TABLE, UNLOAD TABLE, REORGANIZE (among others) are only available in Watcom-SQL the