View Single Post
Old 14th June 2020, 08:42 AM
Posts: n/a
Default Re: Ann: Devart ODBC driver for NexusDB (public beta)

I have been testing the devart odbc driver from php 7.4, there are some
differences between the nexus and the devart odbc driver, you need to
make some changes to your code before everything works. i ho this wil
help you

1 - select statement
in the nexusdb odbc driver
in the query
$rs = odbc_exec($conn, “select username from nawtable”);
$arr = odbc_fetch_array($rs);

will return the variable username as $arr['username']; where the casing
is equal to the casing in the query.

In devart $arr['username']; will return an error if the field username
in the database is defined as eg ‘Username’ so you need to use the
casing equal to the casing in the database.

2- odbc_prepare
in the nexusdb odbc the following code will work :
$query_string = ‘INSERT INTO students ( studentID, lastName, firstName)
VALUES ( ?,?,? )’
$res = odbc_prepare($db_conn, $query_string);
$exc = odbc_execute($res, array(12, “smith”,”john”));

The integer values are interpreted as integer in the query.
In the devart however they are interpreted as strings. To make it work
the query has to be changed
$query_string = ‘INSERT INTO students ( studentID, lastName, firstName)
VALUES (cast( ? as int) ,?,? )’

3 - odbc_num_rows
In the nexusdb odbc driver odbc_num_rows will return the amount of
records after a select statement, in the devart odbc driver it will
return -1