In most databases (MSSSQL, Postgre, MySql, etc...) I can use prepared statements with labels instead of "?" question marks. It's even possible to bind more than one parameter without respecting the order of parameters. Example using PHP's PDO:

$dbh = new PDO(' ** connection dsn ** ');
$stmt = $dbh->prepare('SELECT * FROM products WHERE product_status = :statusid AND product_code = :productcode');
$stmt->execute(array(
    ':productcode' => 'ABCDEF',
    ':statusid' => 123,
));

Is there a way to obtain the same behaviour also on SQLAnywhere functions? It would be more confortable using parameters labels instead of question marks '?'.

asked 28 Apr '14, 03:59

tzanarella's gravatar image

tzanarella
36227
accept rate: 0%


If you are more comfortable using PDO to access data, you could try the SQL Anywhere PDO Driver

permanent link

answered 28 Apr '14, 11:28

Mikel%20Rychliski's gravatar image

Mikel Rychliski
2.1k1641
accept rate: 30%

Does this driver manage the parameters by itself internally simulating the DBMS behaviour (sending to the database only the final "valued" query), or does it send the parameters right to the database along with the statement?

(29 Apr '14, 03:19) tzanarella
Replies hidden

The input/output parameters are bound using the sqlany_bind_param method. Statements are executed using the sqlany_execute method. The actual parameters should be sent as host variables separate from the statement.

(29 Apr '14, 12:00) Mikel Rychliski
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×47
×13

question asked: 28 Apr '14, 03:59

question was seen: 1,518 times

last updated: 29 Apr '14, 12:00