Skip to Content.
Sympa Menu

freetds - Re: [freetds] PHP_5 odbc_prepare() SQL error: [FreeTDS][SQL Server]ASA Error -131: Syntax error near 'call'

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: morry <morry AT mail.plasticcard.com.ua>
  • To: Frediano Ziglio <freddy77 AT gmail.com>
  • Cc: FreeTDS mailing list <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] PHP_5 odbc_prepare() SQL error: [FreeTDS][SQL Server]ASA Error -131: Syntax error near 'call'
  • Date: Mon, 19 Oct 2009 16:10:25 +0300

Thank you, perhaps you can help me more:
php sample

<?php
$a = 1;
$b = 2;
if (!$con = @odbc_connect("ACSK", "dba", "sql")) {
echo "Could not connect to database!\n";
exit;
};

$pr = odbc_prepare($con, "{call dba.p_sel_prop_acsk(?)}");

$arr = array($a, $b);
$rs = odbc_execute($pr, $arr);

// odbc_fetch_row($pr);
// odbc_result_all($pr);
odbc_close($con);
?>

odbc_prepare no longer cause an error but odbc_execute returns
Warning: odbc_execute() [function.odbc-execute]: SQL error: Failed to
fetch error message, SQL state HY000 in SQLExecute

FreeTDS log
===========================================================================
18:49:04.954380 11748 (log.c:190):Starting log file for FreeTDS 0.82
on 2009-10-19 18:49:04 with debug flags 0xffff.
18:49:04.955078 11748 (iconv.c:78):Using trivial iconv
18:49:04.955199 11748 (iconv.c:197):names for ISO-8859-1: ISO-8859-1
18:49:04.955241 11748 (iconv.c:197):names for UTF-8: UTF-8
18:49:04.955282 11748 (iconv.c:197):names for UCS-2LE: UCS-2LE
18:49:04.955324 11748 (iconv.c:197):names for UCS-2BE: (null)
18:49:04.955367 11748 (iconv.c:363):iconv to convert client-side data to
the "windows-1251" character set
18:49:04.955475 11748 (iconv.c:432):tds_iconv_info_init: client charset
name "" unrecognized
18:49:04.955549 11748 (net.c:210):Connecting to 192.168.1.1 port 2638
(TDS version 5.0)
18:49:04.956576 11748 (net.c:264):tds_open_socket: connect(2) returned
"Operation now in progress"
18:49:04.956821 11748 (net.c:303):tds_open_socket() succeeded
18:49:04.956874 11748 (util.c:162):Changed query state from DEAD to IDLE
18:49:04.956949 11748 (net.c:779):Sending packet
0000 02 00 02 00 00 00 00 00-77 65 62 69 6b 2e 74 63 |........ webik.tc|
0010 6f 6e 2e 6b 69 65 76 2e-75 61 00 00 00 00 00 00 |on.kiev. ua......|
*** skip ***
01e0 00 05 00 00 00 00 0d 11-75 73 5f 65 6e 67 6c 69 |........ us_engli|
01f0 73 68 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |sh...... ........|

18:49:04.959309 11748 (net.c:779):Sending packet
0000 02 01 00 61 00 00 00 00-00 00 00 00 00 00 0a 00 |...a.... ........|
0010 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0030 00 00 00 00 00 00 00 00-00 00 00 00 01 35 31 32 |........ .....512|
0040 00 00 00 03 00 00 00 00-e2 16 00 01 09 00 08 0e |........ â.......|
0050 6d 7f ff ff ff fe 02 09-00 00 00 00 02 68 00 00 |m.ÿÿÿþ.. .....h..|
0060 00 - |.|

18:49:04.959811 11748 (token.c:312):tds_process_login_tokens()
18:49:04.963493 11748 (net.c:592):Received header
0000 04 01 00 5b 00 00 00 00- |...[....|

18:49:04.963614 11748 (net.c:671):Received packet
0000 e3 09 00 03 06 63 70 31-32 35 31 00 ad 22 00 05 |ã....cp1 251.­"..|
0010 05 00 00 00 18 41 64 61-70 74 69 76 65 20 53 65 |.....Ada ptive Se|
0020 72 76 65 72 20 41 6e 79-77 68 65 72 65 07 00 00 |rver Any where...|
0030 00 e2 16 00 01 09 00 00-0e 61 01 ff ff fe e6 02 |.â...... .a.ÿÿþæ.|
0040 09 ff ff 00 00 02 68 00-00 0a fd 00 00 01 00 00 |.ÿÿ...h. ..ý.....|
0050 00 00 00 - |...|

18:49:04.964026 11748 (token.c:316):looking for login token, got
e3(ENVCHANGE)
18:49:04.964071 11748 (token.c:108):tds_process_default_tokens() marker
is e3(ENVCHANGE)
18:49:04.964193 11748 (token.c:2356):server indicated charset change to
"cp1251"
18:49:04.964266 11748 (iconv.c:985):setting server single-byte charset
to "CP1251"
18:49:04.964347 11748 (iconv.c:432):tds_iconv_info_init: client charset
name "" unrecognized
18:49:04.964437 11748 (iconv.c:477):tds_iconv_info_init: use memcpy to
convert "ISO-8859-1"->"CP1251"
18:49:04.964487 11748 (token.c:316):looking for login token, got
ad(LOGINACK)
18:49:04.964540 11748 (token.c:316):looking for login token, got
e2(CAPABILITY)
18:49:04.964584 11748 (token.c:108):tds_process_default_tokens() marker
is e2(CAPABILITY)
18:49:04.964629 11748 (token.c:316):looking for login token, got
fd(DONE)
18:49:04.964673 11748 (token.c:108):tds_process_default_tokens() marker
is fd(DONE)
18:49:04.964718 11748 (token.c:2201):tds_process_end: more_results = 0
was_cancelled = 0
error = 0
done_count_valid = 0
18:49:04.964768 11748 (token.c:2217):tds_process_end() state set to
TDS_IDLE
18:49:04.964812 11748 (token.c:2232): rows_affected = 0
18:49:04.964856 11748 (token.c:393):leaving tds_process_login_tokens()
returning 1
18:49:04.964930 11748 (mem.c:563):tds_free_all_results()
18:49:04.964978 11748 (util.c:162):Changed query state from IDLE to
QUERYING
18:49:04.965028 11748 (util.c:162):Changed query state from QUERYING to
PENDING
18:49:04.965071 11748 (net.c:779):Sending packet
0000 0f 01 00 21 00 00 00 00-21 14 00 00 00 00 73 65 |...!.... !.....se|
0010 74 20 74 65 78 74 73 69-7a 65 20 36 34 35 31 32 |t textsi ze 64512|
0020 20 - | |

18:49:04.965408 11748 (token.c:495):tds_process_tokens(0x7d07e900,
0xcfbe16f4, 0xcfbe16f8, 0x100)
18:49:04.965467 11748 (util.c:162):Changed query state from PENDING to
READING
18:49:04.965882 11748 (net.c:592):Received header
0000 04 01 00 11 00 00 00 00- |........|

18:49:04.966030 11748 (net.c:671):Received packet
0000 fd 00 00 01 00 00 00 00-00 |ý....... .|

18:49:04.966118 11748 (token.c:510):processing result tokens. marker is
fd(DONE)
18:49:04.966163 11748 (token.c:2201):tds_process_end: more_results = 0
was_cancelled = 0
error = 0
done_count_valid = 0
18:49:04.966211 11748 (token.c:2217):tds_process_end() state set to
TDS_IDLE
18:49:04.966253 11748 (util.c:162):Changed query state from READING to
IDLE
18:49:04.966295 11748 (token.c:2232): rows_affected = 0
18:49:04.966339 11748 (util.c:110):logic error: cannot change query
state from IDLE to PENDING
18:49:04.966386 11748 (token.c:495):tds_process_tokens(0x7d07e900,
0xcfbe16f4, 0xcfbe16f8, 0x100)
18:49:04.966433 11748 (token.c:498):tds_process_tokens() state is
COMPLETED
18:49:04.966578 11748 (odbc.c:5587):SQLGetInfo(0x7eeaf800, 23,
0x862c47ec, 2, 0x0)
18:49:04.966633 11748 (odbc.c:4841):_SQLGetInfo(0x7eeaf800, 23,
0x862c47ec, 2, 0x0
18:49:04.966687 11748 (odbc.c:5587):SQLGetInfo(0x7eeaf800, 24,
0x862c47ee, 2, 0x0)
18:49:04.966735 11748 (odbc.c:4841):_SQLGetInfo(0x7eeaf800, 24,
0x862c47ee, 2, 0x0
18:49:04.967111 11748 (odbc.c:1504):SQLAllocStmt(0x7eeaf800, 0x7d07ef14)
18:49:04.967185 11748 (odbc.c:1403):_SQLAllocStmt(0x7eeaf800,
0x7d07ef14)
18:49:04.967285 11748 (odbc.c:4079):SQLGetStmtAttr(0x7d07e200, 10010,
0x7dcf6d94, 0, 0x0)
18:49:04.967338 11748 (odbc.c:3917):_SQLGetStmtAttr(0x7d07e200, 10010,
0x7dcf6d94, 0, 0x0)
18:49:04.967393 11748 (odbc.c:4079):SQLGetStmtAttr(0x7d07e200, 10011,
0x7dcf6bf4, 0, 0x0)
18:49:04.967443 11748 (odbc.c:3917):_SQLGetStmtAttr(0x7d07e200, 10011,
0x7dcf6bf4, 0, 0x0)
18:49:04.967545 11748 (odbc.c:4079):SQLGetStmtAttr(0x7d07e200, 10012,
0x7dcf6ed4, 0, 0x0)
18:49:04.967594 11748 (odbc.c:3917):_SQLGetStmtAttr(0x7d07e200, 10012,
0x7dcf6ed4, 0, 0x0)
18:49:04.967649 11748 (odbc.c:4079):SQLGetStmtAttr(0x7d07e200, 10013,
0x7dcf6e94, 0, 0x0)
18:49:04.967698 11748 (odbc.c:3917):_SQLGetStmtAttr(0x7d07e200, 10013,
0x7dcf6e94, 0, 0x0)
18:49:04.967791 11748 (odbc.c:5587):SQLGetInfo(0x7eeaf800, 8,
0xcfbe254c, 4, 0x0)
18:49:04.967840 11748 (odbc.c:4841):_SQLGetInfo(0x7eeaf800, 8,
0xcfbe254c, 4, 0x0
18:49:04.967907 11748 (odbc.c:4124):SQLPrepare(0x7d07e200, {call
dba.p_sel_prop_acsk(?)}, -3)
18:49:04.967994 11748 (odbc.c:795):SQLNumParams(0x7d07e200, 0x8550aa9e)
18:49:04.968051 11748 (odbc.c:4100):SQLNumResultCols(0x7d07e200,
0xcfbe24ea)
18:49:04.968430 11748 (odbc.c:1224):SQLBindParameter(0x7d07e200, 1, 1,
1, 0, 0, 0, 0x8550a784, 0, 0x8550b350)
18:49:04.968516 11748 (odbc.c:1125):_SQLBindParameter(0x7d07e200, 1, 1,
1, 0, 0, 0, 0x8550a784, 0, 0x8550b350)
18:49:04.968647 11748 (odbc.c:3848):SQLFreeStmt(0x7d07e200, 0)
18:49:04.968697 11748 (odbc.c:3769):_SQLFreeStmt(0x7d07e200, 0, 0)
18:49:04.968754 11748 (odbc.c:3237):SQLExecute(0x7d07e200)
18:49:04.969031 11748 (error.c:574):SQLError(0x0, 0x0, 0x7d07e200,
0xcfbe12b0, 0xcfbe12a8, 0xcfbe12c0, 511, 0xcfbe12ae)
18:49:04.969102 11748 (error.c:510):_SQLGetDiagRec(3, 0x7d07e200, 1,
0xcfbe12b0, 0xcfbe12a8, 0xcfbe12c0, 511, 0xcfbe12ae)
18:49:04.970199 11748 (odbc.c:3848):SQLFreeStmt(0x7d07e200, 3)
18:49:04.970280 11748 (odbc.c:3769):_SQLFreeStmt(0x7d07e200, 3, 0)
18:49:04.970350 11748 (odbc.c:4100):SQLNumResultCols(0x7d07e200,
0xcfbe14aa)
18:49:04.970683 11748 (odbc.c:3848):SQLFreeStmt(0x7d07e200, 1)
18:49:04.970756 11748 (odbc.c:3769):_SQLFreeStmt(0x7d07e200, 1, 0)
18:49:04.971777 11748 (odbc.c:2005):SQLDisconnect(0x7eeaf800)
18:49:04.971949 11748 (mem.c:563):tds_free_all_results()
18:49:04.972253 11748 (util.c:162):Changed query state from IDLE to DEAD
18:49:04.972349 11748 (odbc.c:3680):SQLFreeHandle(2, 0x0x7eeaf800)
18:49:04.972575 11748 (odbc.c:3706):_SQLFreeConnect(0x7eeaf800)
18:49:04.972637 11748 (odbc.c:3680):SQLFreeHandle(1, 0x0x7dccc840)
18:49:04.972788 11748 (odbc.c:3744):_SQLFreeEnv(0x7dccc840)
==============================================================================

These questions arose in the migration of the web project from the
Windows platform (Apache for win, php, ODBC, Sybase ASA 7.0) to the
OpenBSD server.

On Fri, 2009-10-16 at 17:07 +0200, Frediano Ziglio wrote:
> You forgot brackets. Odbc syntax is
>
> {call store(parameters)}
>
> Il giorno 16/ott/2009, alle ore 14.52, morry <morry AT mail.plasticcard.com.ua
> > ha scritto:
>
> > I use the following configuration:
> > PHP_5.3.0 with iodbc
> > iODBC 3.52.6
> > FreeTDS (--with-tdsver=5.0 --with-iodbc=/usr/local --disable-
> > threadsafe)
> > Sybase SQL Anywhere 7.0 on windows server
> >

--
Best Regards.
morry <morry AT mail.plasticcard.com.ua>
PlasticCard Ltd





Archive powered by MHonArc 2.6.24.

Top of Page