PHP and sqlca array
Posted in 2012
The poster asked how to get at SQLCA-style error information from PHP/PDO; the only suggestion was PDO's errorInfo() (plus pointers to IBM dev books), which didn't help him. He then switched to ESQL/C to insert TEXT blobs and hit a compile failure on loc_t — resolved by using ifx_loc_t, explained as an AIX header clash with sys/localedef31.h (workaround: predefine _H_LOCALEDEF). His subsequent -608 "illegal attempt to convert Text/Byte blob" error was not resolved: responders asked for the table schema and full locator setup, suggested zeroing loc_type and setting the memory address correctly, and pointed to sample blob code in SQLCMD and Art Kagel's utils2_ak. No final fix is recorded.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
Does anyone know where to access this information when using PHP and PDO? I've looked all over, and don't see any way to do it. Thanks.
Hello. The best publications for Informix Developers: 1) ftp://public.dhe.ibm.com/software/data/sw-library/informix/ebook/Informix_applic ation_dev.pdf 2) http://www.redbooks.ibm.com/abstracts/sg247884.html?Open The order is irrelevant, both are very nice books.... check them out. Regards. Alexandre Marini > To: ids@iiug.org > From: john.callicotte@ottawa.edu > Subject: PHP and sqlca array [27660] > Date: Wed, 18 Jul 2012 14:37:12 -0400 > > Does anyone know where to access this information when using PHP and PDO? I've > looked all over, and don't see any way to do it. Thanks. > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. >
I would check the function errorInfo() John F. Miller III STSM, Embedability Architect miller3@us.ibm.com 503-578-5645 IBM Informix Dynamic Server (IDS) ids-bounces@iiug.org wrote on 07/18/2012 11:37:12 AM: > From: "JOHN CALLICOTTE" <john.callicotte@ottawa.edu> > To: ids@iiug.org, > Date: 07/18/2012 11:43 AM > Subject: PHP and sqlca array [27660] > Sent by: ids-bounces@iiug.org > > Does anyone know where to access this information when using PHP andPDO? I've > looked all over, and don't see any way to do it. Thanks. > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. >
I tried that, but no luck. I actually went over to do this in ESQL/C, but I can't get the compiler to recognize the loc_t data type. Can I use filetoblob for TEXT fields?
I finally got it to compile using ifx_loc_t instead of loc_t, but now I get a -608 error.
Here is my code if it helps. I'm looking at the example on http://publib.boulder.ibm.com/infocenter/idshelp/v115/index.jsp?topic=%2Fcom.ibm .esqlc.doc%2Fsii03147680.htm #define BLOB_SIZE 32000 char szBlobText[BLOB_SIZE + 1]; text_lob.loc_loctype = LOCMEMORY; text_lob.loc_buffer = szBlobText; text_lob.loc_size = BLOB_SIZE; //text_lob.loc_type = SQLTEXT; EXEC SQL insert into ctc_blob (txt,ctc_no) values (:text_lob,:iCtcNo);
On Thu, Jul 19, 2012 at 6:07 AM, JOHN CALLICOTTE <john.callicotte@ottawa.edu > wrote: > I tried that, but no luck. I actually went over to do this in ESQL/C, but I > can't get the compiler to recognize the loc_t data type. The structure for loc_t is declared in locator.h in $INFORMIXDIR/incl/esql. Look in the header; you might need ifx_loc_t instead (there's a long, sorry history of (minor) issues on AIX where there's an ancient compatibility header that defines a loc_t, and ifx_loc_t was an attempt to deal with that issue 20+ years later). If you download the source for SQLCMD from the IIUG software archive, there are a series of 'teaching programs' that manipulate blobs (locator-style blobs). > Can I use filetoblob for TEXT fields? > This is for loading a file into a BLOB - binary smart large object - and uses a different structure from the BYTE or TEXT blobs. There is little support for interworking between 'dumb' and 'smart' blobs. Unless something has changed behind the scenes when I was watching, I think the answer is "no, you can't use FILETOBLOB or FILETOCLOB to load TEXT fields". -- Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused." --f46d04016d5d508b0304c52f9b85
On Thu, Jul 19, 2012 at 6:36 AM, JOHN CALLICOTTE <john.callicotte@ottawa.edu
> wrote:
> I finally got it to compile using ifx_loc_t instead of loc_t, but now I
> get a
> -608 error.
>
From the messages:
-608: Illegal attempt to convert Text/Byte blob type.
There are so many questions that need to be answered it is hard to know
where to start. There is totally insufficient information in this message
for anyone to be able to do anything to help you.
We'll need at least the table schema, SQL statement that generates the
error, and code that initializes the ifx_loc_t structure. (Ideally, see
http://sscce.org/ or http://www.catb.org/~esr/faqs/smart-questions.html for
guidelines.)
Please resubmit the question with enough context that we have a chance of
helping you, probably using a new subject line. (You can even Bcc me on
this email address if you want me to look at it, though the chances are
high that I'll spot it anyway.)
--
Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h>
Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
--f46d04016a97bca79b04c52fb772
On Thu, Jul 19, 2012 at 7:11 AM, JOHN CALLICOTTE <john.callicotte@ottawa.edu
> wrote:
> Here is my code if it helps.
It's a good step in the right general direction. My previous response to
your previous message was seeking this information. There is still some
information missing. And looking at the code provided with SQLCMD will
still help you by giving you working examples of blob manipulation.
$ ls *blob*.ecappblob.ec dumpblob.ec ixblob.ec selmultiblob.ec
connblob.ec insblob.ec selblob.ec updblob.ec
$
Only connblob.ec is not directly relevant; it provides DB connect support
for the programs appblob, insblob, selblob, selmultiblob and updblob. They
all work with files. The code in ixblob.ec provides more general support
to SQLCMD. And dumpblob.ec writes a description of what it finds in an
ifx_loc_t or loc_t structure that it is given.
I'm looking at the example on
>
>
http://publib.boulder.ibm.com/infocenter/idshelp/v115/index.jsp?topic=%2Fcom.ibm
.esqlc.doc%2Fsii03147680.htm
>
> #define BLOB_SIZE 32000
>
> char szBlobText[BLOB_SIZE + 1];
>
> text_lob.loc_loctype = LOCMEMORY;
> text_lob.loc_buffer = szBlobText;
> text_lob.loc_size = BLOB_SIZE;
> //text_lob.loc_type = SQLTEXT;
>
The loc_type field should probably be zeroed if it is neither SQLTEXT nor
SQLBYTES. Though my code doesn't seem to set it ever...
> EXEC SQL insert into ctc_blob (txt,ctc_no) values (:text_lob,:iCtcNo);
>
Schema?
--
Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h>
Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
--f46d04016a97c442b004c52fe105
If you are on AIX there is a clash with some system headers. The locale structure is named loc_t in the AIX header files. If you find which header file it is (don't remember) you can make sure that that header is not loaded. There is another way around it, and if you search the forum posts you may find it (maybe even posted by me), but I'm at a client and cannot take the time to find it for you. You would think that IBM could make two of their own products work together correctly, but this problem has persisted forever. Why AIX doesn't name the locale structure locale_t like every other platform, I don't know. Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Thu, Jul 19, 2012 at 9:07 AM, JOHN CALLICOTTE <john.callicotte@ottawa.edu > wrote: > I tried that, but no luck. I actually went over to do this in ESQL/C, but I > can't get the compiler to recognize the loc_t data type. Can I use > filetoblob > for TEXT fields? > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --bcaec5186a16a55c9d04c5305c57
If you are using the LOCMEMORY loc_type then you also have to set the address in memory containing the blob column contents to insert. FYI: Using LOCUSER and supplying your own open, read, write, & close functions is the fastest way to process TEXT and BYTE columns. You can see examples in my ul.ec and dbcopy.ec utilities in the package utils2_ak which you can download from the IIUG Software Repository. Feel free to borrow the functions in there. Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Thu, Jul 19, 2012 at 10:11 AM, JOHN CALLICOTTE < john.callicotte@ottawa.edu> wrote: > Here is my code if it helps. I'm looking at the example on > > http://publib.boulder.ibm.com/infocenter/idshelp/v115/index.jsp?topic=%2Fcom.ibm .esqlc.doc%2Fsii03147680.htm > > #define BLOB_SIZE 32000 > > char szBlobText[BLOB_SIZE + 1]; > > text_lob.loc_loctype = LOCMEMORY; > text_lob.loc_buffer = szBlobText; > text_lob.loc_size = BLOB_SIZE; > //text_lob.loc_type = SQLTEXT; > EXEC SQL insert into ctc_blob (txt,ctc_no) values (:text_lob,:iCtcNo); > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --14dae9340a99785f1604c5306b76
On Thu, Jul 19, 2012 at 8:23 AM, Art Kagel <art.kagel@gmail.com> wrote: > If you are on AIX there is a clash with some system headers. The locale > structure is named loc_t in the AIX header files. If you find which header > file it is (don't remember) you can make sure that that header is not > loaded. There is another way around it, and if you search the forum posts > you may find it (maybe even posted by me), but I'm at a client and cannot > take the time to find it for you. > /* prevent the including /usr/include/sys/localedef31.h after locator.h */ #ifndef _H_LOCALEDEF #define _H_LOCALEDEF #endif /* _H_LOCALEDEF */ #endif /* _AIX */ So, the header is <sys/localedef31.h>. It is for backwards compatibility with AIX 3.1 (and was when the loc_t name first conflicted back in about 1989; there was a 4-digit PTS bug number raised for the problem). The locale_t type is different, mandated by POSIX, and more recent by far. The protection in the <sys/localdef31.h> header is the _H_LOCALEDEF define. > You would think that IBM could make two of their own products work together > correctly, but this problem has persisted forever. Why AIX doesn't name > the locale structure locale_t like every other platform, I don't know. > The problem started long before Informix was a vassal of IBM. > On Thu, Jul 19, 2012 at 9:07 AM, JOHN CALLICOTTE < > john.callicotte@ottawa.edu > > wrote: > > I tried that, but no luck. I actually went over to do this in ESQL/C, > but I > > can't get the compiler to recognize the loc_t data type. Can I use > > filetoblob > > for TEXT fields? > -- Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused." --f46d042dfc93b89bec04c5347113
Jonathan said: The problem started long before Informix was a vassal of IBM. Yes, but we have been vassals for over 11 years now. Most manor lords were more helpful than this. ;) Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Thu, Jul 19, 2012 at 4:15 PM, Jonathan Leffler < jonathan.leffler@gmail.com> wrote: > On Thu, Jul 19, 2012 at 8:23 AM, Art Kagel <art.kagel@gmail.com> wrote: > > > If you are on AIX there is a clash with some system headers. The locale > > structure is named loc_t in the AIX header files. If you find which > header > > file it is (don't remember) you can make sure that that header is not > > loaded. There is another way around it, and if you search the forum posts > > you may find it (maybe even posted by me), but I'm at a client and cannot > > take the time to find it for you. > > > > /* prevent the including /usr/include/sys/localedef31.h after locator.h */ > #ifndef _H_LOCALEDEF > #define _H_LOCALEDEF > #endif /* _H_LOCALEDEF */ > #endif /* _AIX */ > > So, the header is <sys/localedef31.h>. It is for backwards compatibility > with AIX 3.1 (and was when the loc_t name first conflicted back in about > 1989; there was a 4-digit PTS bug number raised for the problem). The > locale_t type is different, mandated by POSIX, and more recent by far. > > The protection in the <sys/localdef31.h> header is the _H_LOCALEDEF > define. > > > You would think that IBM could make two of their own products work > together > > correctly, but this problem has persisted forever. Why AIX doesn't name > > the locale structure locale_t like every other platform, I don't know. > > > > The problem started long before Informix was a vassal of IBM. > > > On Thu, Jul 19, 2012 at 9:07 AM, JOHN CALLICOTTE < > > john.callicotte@ottawa.edu > > > wrote: > > > I tried that, but no luck. I actually went over to do this in ESQL/C, > > but I > > > can't get the compiler to recognize the loc_t data type. Can I use > > > filetoblob > > > for TEXT fields? > > > > -- > Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> > Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org > "Blessed are we who can laugh at ourselves, for we shall never cease to be > amused." > > --f46d042dfc93b89bec04c5347113 > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --14dae9340cadd54ce004c5352449
On Thu, Jul 19, 2012 at 2:05 PM, Art Kagel <art.kagel@gmail.com> wrote: > Jonathan said: > > > The problem started long before Informix was a vassal of IBM. > > Yes, but we have been vassals for over 11 years now. Most manor lords were > more helpful than this. ;) > It took hundreds of years for changes in manorial rules to happen... > On Thu, Jul 19, 2012 at 4:15 PM, Jonathan Leffler < > jonathan.leffler@gmail.com> wrote: > > > On Thu, Jul 19, 2012 at 8:23 AM, Art Kagel <art.kagel@gmail.com> wrote: > > > > > If you are on AIX there is a clash with some system headers. The locale > > > structure is named loc_t in the AIX header files. If you find which > > header > > > file it is (don't remember) you can make sure that that header is not > > > loaded. There is another way around it, and if you search the forum > posts > > > you may find it (maybe even posted by me), but I'm at a client and > cannot > > > take the time to find it for you. > > > > > > > /* prevent the including /usr/include/sys/localedef31.h after locator.h > */ > > #ifndef _H_LOCALEDEF > > #define _H_LOCALEDEF > > #endif /* _H_LOCALEDEF */ > > #endif /* _AIX */ > > > > So, the header is <sys/localedef31.h>. It is for backwards compatibility > > with AIX 3.1 (and was when the loc_t name first conflicted back in about > > 1989; there was a 4-digit PTS bug number raised for the problem). The > > locale_t type is different, mandated by POSIX, and more recent by far. > > > > The protection in the <sys/localdef31.h> header is the _H_LOCALEDEF > > define. > > > > > You would think that IBM could make two of their own products work > > together > > > correctly, but this problem has persisted forever. Why AIX doesn't name > > > the locale structure locale_t like every other platform, I don't know. > > > > > > > The problem started long before Informix was a vassal of IBM. > -- Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused." --f46d0408da074e901504c5361925
;) Art On Jul 19, 2012 6:14 PM, "Jonathan Leffler" <jonathan.leffler@gmail.com> wrote: > On Thu, Jul 19, 2012 at 2:05 PM, Art Kagel <art.kagel@gmail.com> wrote: > > > Jonathan said: > > > > > The problem started long before Informix was a vassal of IBM. > > > > Yes, but we have been vassals for over 11 years now. Most manor lords > were > > more helpful than this. ;) > > > > It took hundreds of years for changes in manorial rules to happen... > > > On Thu, Jul 19, 2012 at 4:15 PM, Jonathan Leffler < > > jonathan.leffler@gmail.com> wrote: > > > > > On Thu, Jul 19, 2012 at 8:23 AM, Art Kagel <art.kagel@gmail.com> > wrote: > > > > > > > If you are on AIX there is a clash with some system headers. The > locale > > > > structure is named loc_t in the AIX header files. If you find which > > > header > > > > file it is (don't remember) you can make sure that that header is not > > > > loaded. There is another way around it, and if you search the forum > > posts > > > > you may find it (maybe even posted by me), but I'm at a client and > > cannot > > > > take the time to find it for you. > > > > > > > > > > /* prevent the including /usr/include/sys/localedef31.h after locator.h > > */ > > > #ifndef _H_LOCALEDEF > > > #define _H_LOCALEDEF > > > #endif /* _H_LOCALEDEF */ > > > #endif /* _AIX */ > > > > > > So, the header is <sys/localedef31.h>. It is for backwards > compatibility > > > with AIX 3.1 (and was when the loc_t name first conflicted back in > about > > > 1989; there was a 4-digit PTS bug number raised for the problem). The > > > locale_t type is different, mandated by POSIX, and more recent by far. > > > > > > The protection in the <sys/localdef31.h> header is the _H_LOCALEDEF > > > define. > > > > > > > You would think that IBM could make two of their own products work > > > together > > > > correctly, but this problem has persisted forever. Why AIX doesn't > name > > > > the locale structure locale_t like every other platform, I don't > know. > > > > > > > > > > The problem started long before Informix was a vassal of IBM. > > > > -- > Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> > Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org > "Blessed are we who can laugh at ourselves, for we shall never cease to be > amused." > > --f46d0408da074e901504c5361925 > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --14dae93405635c55f604c53635b0