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

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
You forgot brackets. Odbc syntax is

{call store(parameters)}

Bye
   freddy77

Inviato da iPhone

Il giorno 16/ott/2009, alle ore 14.52, morry <[email protected] 
 > 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
>
> When php executes the following commands:
> $link = odbc_connect($CONF['db_name'], $CONF['db_user_name'],
> $CONF['db_password']);
> $query = odbc_prepare($link, "call
> dba.p_sel_prop_cert(null,null,null,null,null,null,null,null,?)");
>
> I get the following error
>
> Warning: odbc_prepare() [function.odbc-prepare]: SQL error:
> [FreeTDS][SQL Server]ASA Error -131: Syntax error near 'call', SQL  
> state
> 42W04 in SQLPrepare
>
> FreeTDS.log
>
> === 
> === 
> === 
> === 
> === 
> === 
> === 
> === 
> === 
> ====================================================================
> 17:54:19.158869 22040 (log.c:190):Starting log file for FreeTDS 0.82
>    on 2009-10-16 17:54:19 with debug flags 0xffff.
> 17:54:19.159116 22040 (iconv.c:363):iconv to convert client-side  
> data to
> the "windows-1251" character set
> 17:54:19.159259 22040 (iconv.c:432):tds_iconv_info_init: client  
> charset
> name "" unrecognized
> 17:54:19.159331 22040 (net.c:210):Connecting to 192.168.1.1 port 2638
> (TDS version 5.0)
> 17:54:19.160182 22040 (net.c:264):tds_open_socket: connect(2) returned
> "Operation now in progress"
> 17:54:19.160317 22040 (net.c:303):tds_open_socket() succeeded
> 17:54:19.160365 22040 (util.c:162):Changed query state from DEAD to  
> IDLE
> 17:54:19.160435 22040 (net.c:779):Sending packet
> 0000 02 00 02 00 00 00 00 00-77 65 62 69 6b 2e 74 63 |........  
> webik.tc|
> ** skipped**
> 01f0 73 68 00 00 00 00 00 00-00 00 00 00 00 00 00 00 | 
> sh...... ........|
>
> 17:54:19.162776 22040 (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                     -                        |.|
>
> 17:54:19.163281 22040 (token.c:312):tds_process_login_tokens()
> 17:54:19.167732 22040 (net.c:592):Received header
> 0000 04 01 00 5b 00 00 00 00-                        |...[....|
>
> 17:54:19.167865 22040 (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               -                        |...|
>
> 17:54:19.168278 22040 (token.c:316):looking for login token, got
> e3(ENVCHANGE)
> 17:54:19.168323 22040 (token.c:108):tds_process_default_tokens()  
> marker
> is e3(ENVCHANGE)
> 17:54:19.168398 22040 (token.c:2356):server indicated charset change  
> to
> "cp1251"
> 17:54:19.168469 22040 (iconv.c:985):setting server single-byte charset
> to "CP1251"
> 17:54:19.168549 22040 (iconv.c:432):tds_iconv_info_init: client  
> charset
> name "" unrecognized
> 17:54:19.168624 22040 (iconv.c:477):tds_iconv_info_init: use memcpy to
> convert "ISO-8859-1"->"CP1251"
> 17:54:19.168674 22040 (token.c:316):looking for login token, got
> ad(LOGINACK)
> 17:54:19.168731 22040 (token.c:316):looking for login token, got
> e2(CAPABILITY)
> 17:54:19.168773 22040 (token.c:108):tds_process_default_tokens()  
> marker
> is e2(CAPABILITY)
> 17:54:19.168819 22040 (token.c:316):looking for login token, got
> fd(DONE)
> 17:54:19.168863 22040 (token.c:108):tds_process_default_tokens()  
> marker
> is fd(DONE)
> 17:54:19.168908 22040 (token.c:2201):tds_process_end: more_results = 0
>        was_cancelled = 0
>        error = 0
>        done_count_valid = 0
> 17:54:19.168959 22040 (token.c:2217):tds_process_end() state set to
> TDS_IDLE
> 17:54:19.169002 22040 (token.c:2232):                rows_affected = 0
> 17:54:19.169045 22040 (token.c:393):leaving tds_process_login_tokens()
> returning 1
> 17:54:19.169102 22040 (mem.c:563):tds_free_all_results()
> 17:54:19.169147 22040 (util.c:162):Changed query state from IDLE to
> QUERYING
> 17:54:19.169196 22040 (util.c:162):Changed query state from QUERYING  
> to
> PENDING
> 17:54:19.169238 22040 (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                     -                        | |
>
> 17:54:19.169530 22040 (token.c:495):tds_process_tokens(0x7d07e200,
> 0xcfbe16f4, 0xcfbe16f8, 0x100)
> 17:54:19.169585 22040 (util.c:162):Changed query state from PENDING to
> READING
> 17:54:19.169979 22040 (net.c:592):Received header
> 0000 04 01 00 11 00 00 00 00-                        |........|
>
> 17:54:19.170091 22040 (net.c:671):Received packet
> 0000 fd 00 00 01 00 00 00 00-00                      |ý....... .|
>
> 17:54:19.170179 22040 (token.c:510):processing result tokens.   
> marker is
> fd(DONE)
> 17:54:19.170225 22040 (token.c:2201):tds_process_end: more_results = 0
>        was_cancelled = 0
>        error = 0
>        done_count_valid = 0
> 17:54:19.170273 22040 (token.c:2217):tds_process_end() state set to
> TDS_IDLE
> 17:54:19.170315 22040 (util.c:162):Changed query state from READING to
> IDLE
> 17:54:19.170357 22040 (token.c:2232):                rows_affected = 0
> 17:54:19.170400 22040 (util.c:110):logic error: cannot change query
> state from IDLE to PENDING
> 17:54:19.170444 22040 (token.c:495):tds_process_tokens(0x7d07e200,
> 0xcfbe16f4, 0xcfbe16f8, 0x100)
> 17:54:19.170517 22040 (token.c:498):tds_process_tokens() state is
> COMPLETED
> 17:54:19.170615 22040 (odbc.c:5587):SQLGetInfo(0x85aaac00, 23,
> 0x862c4c6c, 2, 0x0)
> 17:54:19.170667 22040 (odbc.c:4841):_SQLGetInfo(0x85aaac00, 23,
> 0x862c4c6c, 2, 0x0
> 17:54:19.170718 22040 (odbc.c:5587):SQLGetInfo(0x85aaac00, 24,
> 0x862c4c6e, 2, 0x0)
> 17:54:19.170765 22040 (odbc.c:4841):_SQLGetInfo(0x85aaac00, 24,
> 0x862c4c6e, 2, 0x0
> 17:54:19.170978 22040 (odbc.c:1504):SQLAllocStmt(0x85aaac00,  
> 0x7d07ee14)
> 17:54:19.171038 22040 (odbc.c:1403):_SQLAllocStmt(0x85aaac00,
> 0x7d07ee14)
> 17:54:19.171135 22040 (odbc.c:4079):SQLGetStmtAttr(0x7d07ec00, 10010,
> 0x7dcf6f14, 0, 0x0)
> 17:54:19.171186 22040 (odbc.c:3917):_SQLGetStmtAttr(0x7d07ec00, 10010,
> 0x7dcf6f14, 0, 0x0)
> 17:54:19.171241 22040 (odbc.c:4079):SQLGetStmtAttr(0x7d07ec00, 10011,
> 0x7dcf6bf4, 0, 0x0)
> 17:54:19.171290 22040 (odbc.c:3917):_SQLGetStmtAttr(0x7d07ec00, 10011,
> 0x7dcf6bf4, 0, 0x0)
> 17:54:19.171342 22040 (odbc.c:4079):SQLGetStmtAttr(0x7d07ec00, 10012,
> 0x7dcf6c94, 0, 0x0)
> 17:54:19.171392 22040 (odbc.c:3917):_SQLGetStmtAttr(0x7d07ec00, 10012,
> 0x7dcf6c94, 0, 0x0)
> 17:54:19.171444 22040 (odbc.c:4079):SQLGetStmtAttr(0x7d07ec00, 10013,
> 0x7dcf6bd4, 0, 0x0)
> 17:54:19.171529 22040 (odbc.c:3917):_SQLGetStmtAttr(0x7d07ec00, 10013,
> 0x7dcf6bd4, 0, 0x0)
> 17:54:19.171589 22040 (odbc.c:5587):SQLGetInfo(0x85aaac00, 8,
> 0xcfbe254c, 4, 0x0)
> 17:54:19.171637 22040 (odbc.c:4841):_SQLGetInfo(0x85aaac00, 8,
> 0xcfbe254c, 4, 0x0
> 17:54:19.171704 22040 (odbc.c:4124):SQLPrepare(0x7d07ec00, call
> dba.p_sel_prop_cert(null,null,null,null,null,null,null,null,?), -3)
> 17:54:19.171770 22040 (odbc.c:4188):Creating prepared statement
> 17:54:19.171834 22040 (mem.c:563):tds_free_all_results()
> 17:54:19.171876 22040 (util.c:162):Changed query state from IDLE to
> QUERYING
> 17:54:19.171926 22040 (util.c:162):Changed query state from QUERYING  
> to
> PENDING
> 17:54:19.171969 22040 (net.c:779):Sending packet
> ??? 
> ??? 
> ?????????????????????????????????????????????????????????????????????
> 0000 0f 01 00 77 00 00 00 00-e7 6c 00 01 00 0a 77 78 |...w.... çl... 
> .wx|
> 0010 71 38 31 63 61 30 30 30-5d 00 63 72 65 61 74 65 | 
> q81ca000 ].create|
> 0020 20 70 72 6f 63 20 77 78-71 38 31 63 61 30 30 30 | proc wx  
> q81ca000|
> 0030 20 61 73 20 63 61 6c 6c-20 64 62 61 2e 70 5f 73 | as call   
> dba.p_s|
> 0040 65 6c 5f 70 72 6f 70 5f-63 65 72 74 28 6e 75 6c |el_prop_ cert 
> (nul|
> 0050 6c 2c 6e 75 6c 6c 2c 6e-75 6c 6c 2c 6e 75 6c 6c |l,null,n  
> ull,null|
> 0060 2c 6e 75 6c 6c 2c 6e 75-6c 6c 2c 6e 75 6c 6c 2c |,null,nu  
> ll,null,|
> 0070 6e 75 6c 6c 2c 3f 29   -                        |null,?)|
> ??? 
> ??? 
> ?????????????????????????????????????????????????????????????????????
>
> 17:54:19.172641 22040 (token.c:495):tds_process_tokens(0x7d07e200,
> 0xcfbe24b4, 0xcfbe24b8, 0x104)
> 17:54:19.172695 22040 (util.c:162):Changed query state from PENDING to
> READING
> 17:54:19.173124 22040 (net.c:592):Received header
> 0000 04 01 00 61 00 00 00 00-                        |...a....|
>
> 17:54:19.173250 22040 (net.c:671):Received packet
> 0000 e7 0d 00 20 00 0a 77 78-71 38 31 63 61 30 30 30 |ç.. ..wx q81ca 
> 000|
> 0010 e5 3d 00 66 00 00 00 00-0f 05 34 32 57 30 34 00 |å=.f.... ..42W 
> 04.|
> 0020 01 00 28 00 41 53 41 20-45 72 72 6f 72 20 2d 31 |..(.ASA  Error  
> -1|
> 0030 33 31 3a 20 53 79 6e 74-61 78 20 65 72 72 6f 72 |31: Synt ax  
> error|
> 0040 20 6e 65 61 72 20 27 63-61 6c 6c 27 00 00 00 00 | near 'c  
> all'....|
> 0050 fd 02 00 01 00 00 00 00-00                      |ý....... .|
>
> 17:54:19.173677 22040 (token.c:510):processing result tokens.   
> marker is
> e7(TDS5_DYNAMIC)
> 17:54:19.173743 22040 (token.c:2451):tds_process_msg() reading message
> from server
> 17:54:19.173811 22040 (token.c:2516):tds_process_msg() calling client
> msg handler
> 17:54:19.173856 22040 (odbc.c:2032):msgno 102 20003
> 17:54:19.173934 22040 (token.c:2529):tds_process_msg() returning
> TDS_SUCCEED
> 17:54:19.173980 22040 (token.c:510):processing result tokens.   
> marker is
> fd(DONE)
> 17:54:19.174026 22040 (token.c:2201):tds_process_end: more_results = 0
>        was_cancelled = 0
>        error = 1
>        done_count_valid = 0
> 17:54:19.174074 22040 (token.c:2217):tds_process_end() state set to
> TDS_IDLE
> 17:54:19.174117 22040 (util.c:162):Changed query state from READING to
> IDLE
> 17:54:19.174160 22040 (token.c:2232):                rows_affected = 0
> 17:54:19.174203 22040 (util.c:110):logic error: cannot change query
> state from IDLE to PENDING
> 17:54:19.174249 22040 (token.c:495):tds_process_tokens(0x7d07e200,
> 0xcfbe24b4, 0xcfbe24b8, 0x104)
> 17:54:19.174296 22040 (token.c:498):tds_process_tokens() state is
> COMPLETED
> 17:54:19.174380 22040 (error.c:574):SQLError(0x0, 0x0, 0x7d07ec00,
> 0xcfbe22f0, 0xcfbe22e8, 0xcfbe2300, 511, 0xcfbe22ee)
> 17:54:19.174441 22040 (error.c:510):_SQLGetDiagRec(3, 0x7d07ec00, 1,
> 0xcfbe22f0, 0xcfbe22e8, 0xcfbe2300, 511, 0xcfbe22ee)
> 17:54:19.175560 22040 (odbc.c:2005):SQLDisconnect(0x85aaac00)
> 17:54:19.175693 22040 (odbc.c:3769):_SQLFreeStmt(0x7d07ec00, 1, 1)
> 17:54:19.175772 22040 (mem.c:563):tds_free_all_results()
> 17:54:19.176036 22040 (util.c:162):Changed query state from IDLE to  
> DEAD
> 17:54:19.176139 22040 (odbc.c:3680):SQLFreeHandle(2, 0x0x85aaac00)
> 17:54:19.176187 22040 (odbc.c:3706):_SQLFreeConnect(0x85aaac00)
> 17:54:19.176429 22040 (odbc.c:3680):SQLFreeHandle(1, 0x0x8282ff00)
> 17:54:19.176563 22040 (odbc.c:3744):_SQLFreeEnv(0x8282ff00)
> === 
> === 
> === 
> === 
> === 
> === 
> === 
> === 
> === 
> ====================================================================
>
> In the log i see no valid for sybase expression
>
> create proc wxq81ca000
> as call dba.p_sel_prop_cert(null,null,null,null,null,null,null,null,?)
>
> Can anyone help me in my "grief"?
>
> PS: Sorry for my English.
> -- 
> morry <[email protected]>
> PlasticCard Ltd
>
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.