Re: [PHP-DB] PHP ODBC odbc_fetch_array returns uninitialized values for Booleans
Is it a truly a three state field (true, false, null) or just T/F? Perhaps a default value for the field might be better? On Mon, Jun 29, 2015 at 11:42 AM Bruce Bailey brucebailey...@gmail.com wrote: *Description* The PHP function odbc_fetch_array returns uninitialized values for PostgreSQL boolean values. On older systems, this function returned '1' for true and '0' for false values. On our 64 bit system, the boolean values appear to be uninitialized data. *Additional information* Increasing buffer size in php_odbc.c (odbc.so) in function odbc_bindcols, just prior to call to SQLBindCol makes problem stop exhibiting. SQLColAttributes(...,SQL_COLUMN_TYPE,...) returns type of SQL_VARCHAR on system with problem, SQL_CHAR on system where code works as expected. SQLColAttributes is deprecated (shouldn't matter, though) *Recreation steps:* // Create table/data in PostgreSQL DROP TABLE IF EXISTS public.persons; create table public.persons (id int, name varchar(255), switch_sw boolean); insert into public.persons values (0, 'smith', true); insert into public.persons values (1, 'jones', false); insert into public.persons values (2, 'bailey', true); insert into public.persons values (3, 'johnson', false); // Test script ?php if(!($conn = odbc_connect(... , ... , ...))) die(odbc_connect failed\n); if(!($rows = odbc_exec($conn, select * from persons;))) die(odbc_exec failed\n); for(;;) { if (!($row = odbc_fetch_array ($rows))) break; print_r($row); } odbc_close($conn); ? *Actual output* Array ( [id] = 0 [name] = smith [switch_sw] = . // some unreadable binary content ) . . . *Expected Output* Array ( [id] = 0 [name] = smith [switch_sw] = 1 ) . . . *Software levels* kernel - Linux C921189 3.10.0-123.20.1.el7.x86_64 . . . GNU/Linux ODBC - libodbc.so.1 (cannot exactly determine version) PostgreSQL - 9.3.0 PHP - 5.6.7 This system is little endian
Re: [PHP-DB] PHP ODBC and Pervasive.SQL
Robert, Thank you very much for your post: odbtp solved the problem and gave me a head start on moving the site to a Linux box. Pascal Robert Twitty [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Pascal The odbc extension uses ODBC 2, while Access and Pervasive are most likely using ODBC 3. This may or may not be the cause of your problem. Try using the odbtp extension at http://odbtp.sourceforge.net. It uses ODBC 3, and may give you better results. -- bob On Wed, 25 Feb 2004, Pascal Schaedeli wrote: Hi, I am executing a SELECT query from PHP (4.3.4) through ODBC on a Pervasive 2000SP4 (all on Windows). odbc_result_all, odbc_fetch_into, and all other php odbc function stop returning records before the end of the effective resultset. Here is what is happening : * In Pervasive: SELECT * FROM table returns n records (correct). * In Access, throught ODBC, the same query returns the same n records (correct). * In PHP, odbc_exec of the same query returns mn records. Specifically, I have identifed one field (call it fieldx) that seems to be at the source of the problem : it seems stored over 4 bytes in Pervasive and represents a decimal number. If I rewrite the query in PHP to read SELECT fielda, fieldb,fieldc FROM table, it returns n records (correct) (just to clarify SELECT fielda, fieldb,fieldc,fieldx FROM table returns mn records). How many is m? It depends on the sort order. I have identified with record's fieldx is causing the problem. The records returned by odbc_* are up to that problem record. If the sort order makes that problem record to be the last one, then m = n-1. If the sort order makes that record be the first, then m = 0. Here is even more details for those who are still reading: fieldx is written to Pervasive from an application for which I do not have the source code. If I read the content of fieldx of the problem records, erase it and manually re-enter it (in Pervasive Control Center), the issue is solved and the PHP odbc query returns n records. I'm not an expert on odbc and pervasive. Intuitively, it seems that the field is somehow missformated. However, both Pervasive and Access are able to interpret it correctly. Does anybody have a suggestion on how I could either: - Get Pervasive to reformat all field correctly. - Get the odbc library in PHP to at least give me an error, or better, interpret the field as Access does. Thanks, Pascal -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP ODBC and Pervasive.SQL
Hi Pascal The odbc extension uses ODBC 2, while Access and Pervasive are most likely using ODBC 3. This may or may not be the cause of your problem. Try using the odbtp extension at http://odbtp.sourceforge.net. It uses ODBC 3, and may give you better results. -- bob On Wed, 25 Feb 2004, Pascal Schaedeli wrote: Hi, I am executing a SELECT query from PHP (4.3.4) through ODBC on a Pervasive 2000SP4 (all on Windows). odbc_result_all, odbc_fetch_into, and all other php odbc function stop returning records before the end of the effective resultset. Here is what is happening : * In Pervasive: SELECT * FROM table returns n records (correct). * In Access, throught ODBC, the same query returns the same n records (correct). * In PHP, odbc_exec of the same query returns mn records. Specifically, I have identifed one field (call it fieldx) that seems to be at the source of the problem : it seems stored over 4 bytes in Pervasive and represents a decimal number. If I rewrite the query in PHP to read SELECT fielda, fieldb,fieldc FROM table, it returns n records (correct) (just to clarify SELECT fielda, fieldb,fieldc,fieldx FROM table returns mn records). How many is m? It depends on the sort order. I have identified with record's fieldx is causing the problem. The records returned by odbc_* are up to that problem record. If the sort order makes that problem record to be the last one, then m = n-1. If the sort order makes that record be the first, then m = 0. Here is even more details for those who are still reading: fieldx is written to Pervasive from an application for which I do not have the source code. If I read the content of fieldx of the problem records, erase it and manually re-enter it (in Pervasive Control Center), the issue is solved and the PHP odbc query returns n records. I'm not an expert on odbc and pervasive. Intuitively, it seems that the field is somehow missformated. However, both Pervasive and Access are able to interpret it correctly. Does anybody have a suggestion on how I could either: - Get Pervasive to reformat all field correctly. - Get the odbc library in PHP to at least give me an error, or better, interpret the field as Access does. Thanks, Pascal -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/ODBC/Apache/Netware/Foxpro Problem
What is the setting of the ODBC connect string parameter SOURCEDB? Does the PC running Apache have permission to access the path specified by SOURCEDB? -- bob On Mon, 14 Jul 2003, YT Lee wrote: I have a Windows XP PC configured as follow: 1. Apache 2.0.46 2. PHP 4.3.2 3. Microsoft Visual Foxpro ODBC Driver The PC is connected to a Netware 3.2 server. The database are implemented as Foxpro 2.6 free tables on the Netware server. The PC is connected to the server via Netware client version 4.83 SP1E. Using WinSQL Lite, I can access the Foxpro tables on the Netware server from the PC through ODBC. Using PHP command line mode, I can also execute the following PHP script on the PC without problems: --- fp.php --- ?php $link = odbc_connect ('foxtest', '', '', 0) or die (Could not connect); print (Connected successfully to foxtest); $result = odbc_exec($link, SELECT * FROM SVCCAR); if (!$result) { echo odbc_error(); exit; } odbc_close ($link); ? -- fp.php However, when I try to run the same script from Apache using a browser, an error occurs and the output is as follow: --- output --- Connected successfully to foxtest Warning: SQL error: [Microsoft][ODBC Visual FoxPro Driver]File 'svccar.dbf' does not exist., SQL state S0002 in SQLExecDirect in C:\htdocs\php\FP.PHP on line 9 S0002 output --- It appears that PHP is able to connect to the ODBC but it is not able to see any tables on the Netware disk. If I move the Foxpro files to the PC's hard disk, the script runs fine. Any assistance is highly appreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php- odbc- access
don't think it's possible @ once... what I suggest... those people have to make a comma delimited export file, then you make an upload page, where people can upload this file. and you make a script so it will be imported get the point? kind regards ___ Mark Snijders, Developer Atos Origin Groenewoudeseweg 1, Room VN-515 5621 BA Eindhoven, The Netherlands * : [EMAIL PROTECTED] *:+31 (0)40 - 2785992 (tel) * : +31 (0)40 - 2788729 (fax) The information in this mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Access to this mail by anyone else than the addressee is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken omitted to be taken in reliance of it, is prohibited and may be unlawful. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php- odbc- access
There are programs that can import access db files into mysql, but none that I know of that are automated. If you have access to the access app they are running, you can install an odbc connection from their machines to your mysql database and modify your access app to connect to mysql and copy the records over. You can also have them export their data to a CSV file, upload that file and mysql can import it. Other than that I am not sure what you can do. Cheers Jason -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 11, 2002 7:41 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] php- odbc- access Many of the people who will be using my php site, will also be using an app that runs an access db. I would like to create a page on my webpage that allows the users to click a button, and data is moved from their access db on their machines, to my mysql db. Is this possible? I will know where the access db file lives. Can php make an odbc connection and do the transfer? Can I upload the db file to my webserver and then transfer? Thanks, Eddie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-ODBC
Nithin, This issue is due to the ODBCINI environment variable not being set by in your PHP script, or the odbc.ini file that variable points to not being readable by the user that Apache runs as. Check out the PHP-ODBC-HOWTO at www.iodbc.org for examples of what environment variables need to be set to connect properly. Best regards, Andrew Hill Director of Technology Evangelism - OpenLink Software Universal Data Access and the Virtuoso Universal Server http://www.openlinksw.com/virtuoso/whatis.htm On Thursday, October 24, 2002, at 10:24 AM, Poduval, Nithin wrote: Hi All, We are also facing a problem in connecting PHP with database, We are trying to access the MS SQL Server 2000 which runs on Windows 2000 from the php in the Linux 7.2. During access the php, it gives the followin message. Warning: SQL error: [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded, SQL state IM002 in We do followed all the step done by you. We would like to know how did you solve the issue. We have been using the Openlink database driver.Please help in this issue. Thanks In Advance. With Regards, Nithin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php