A favor to ask of any C-OCI programmer to prove a DBMS bug....

I am looking for someone good and kind enough to write a C+OCI
program that does this trivial thing:
Make a connection, prepare a statement for execution, with no
parameters, simply to execute "TRUNCATE TABLE MYTABLE".
Then the program should execute the statement. Then, it should
print out to stdout "TRUNCATED MYTABLE. Press <enter> to repeat",
and read stdin until it gets the newline, and then executes the
statement again.
This program will demonstrate the failure of the DBMS-client
contract. The user will start a SQL-PLUS session and create
that table, and insert rows (and commit). Then, in another
window, the user will start this C program, which will truncate
the table, and wait for further input. Then the user will verify
from SQL-plus that the table has been truncated. Then the
user use SQL-PLUS to add more rows to the table, and commit.
Then the user will press <ENTER> at the C program, making it
re-execute the TRUNCATE statement (apparently successfully)
and exit. The user should then see in SQL-PLUS that the second
batch of rows are still there.
Joe

Hi Joe,
I'm not sure I would call this a database bug, rather it seems more like a documentation bug/omission. In fact, the issue is correctly identified in the 11g OCI docs for the OCIStmtPrepare function:
http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28395/oci17msc001.htm#i575144
In particular:
Before re-executing a DDL statement, call this function a second time.
It looks like the designed behavior is to ignore subsequent invocations of DDL without calling OCIStmtPrepare as a server round-trip does not appear to take place. So what you are seeing may not be the desired behavior, but it appears to be the expected behavior.
For example, a tkprof of the scenario you describe shows:
truncate table mytable
call     count       cpu    elapsed       disk      query    current        rows
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.00       0.01          0         57         13           0
Fetch        0      0.00       0.00          0          0          0           0
total        2      0.00       0.01          0         57         13           0Having said that, here's a (very) basic bit of OCI code to illustrate this...
DISCLAIMER(s): I am not an OCI programmer. I am a DBA and I sometimes live in the .NET world. This is very basic and contains bad practices such as hard-coding and no error checking.
#ifdef WIN32
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#include <stdio.h>
#include <string.h>
#include <oci.h>
int main (int argc, char *argv[])
  OCIEnv      *envhp = NULL;  /* OCI Environment handle     */
  OCIError    *errhp = NULL;  /* OCI Error handle           */
  OCISvcCtx   *svchp = NULL;  /* OCI Service Context handle */
  OCIServer   *srvhp = NULL;  /* OCI Server handle          */
  OCISession  *usrhp = NULL;  /* OCI User Session handle    */
  OCIStmt     *stmtp = NULL;  /* OCI Statement handle       */
  /* connection information */
  oratext *username = "scott";
  oratext *password = "tiger";
  oratext *database = "otndemo";
  /* the sql statement to execute */
  oratext *sqlstmt = "truncate table mytable";
  /* used to hold the results of each OCI call */
  sword result = 0; 
  /* used to hold input */
  char buf[80];
  /* Initialize and create a default environment  */ 
  result = OCIEnvCreate(&envhp, OCI_DEFAULT, (void *) 0, 0, 0, 0, (size_t) 0, (void **) 0);
  /* allocate an error handle */
  result = OCIHandleAlloc((void *) envhp, (void **) &errhp, OCI_HTYPE_ERROR, 0, (void **) 0);
  /* allocate a service context handle */
  result = OCIHandleAlloc((void *) envhp, (void **) &svchp, OCI_HTYPE_SVCCTX, 0, (void **) 0);
  /* allocate a server handle */
  result = OCIHandleAlloc((void *) envhp, (void **) &srvhp, OCI_HTYPE_SERVER, 0, (void **) 0);
  /* allocate a user session handle */
  result = OCIHandleAlloc((void *) envhp, (void **) &usrhp, OCI_HTYPE_SESSION, 0, (void **) 0);
  /* set user name attribute in user session handle */
  result = OCIAttrSet((void *) usrhp, OCI_HTYPE_SESSION, (void *) username, (ub4) strlen(username), OCI_ATTR_USERNAME, errhp);
  /* set password attribute in user session handle */
  result = OCIAttrSet((void *) usrhp, OCI_HTYPE_SESSION, (void *) password, (ub4) strlen(password), OCI_ATTR_PASSWORD, errhp);
  /* create a server context using the specified database */
  result = OCIServerAttach(srvhp, errhp, database , (sb4) strlen(database), OCI_DEFAULT);
  /* set the server attribute in the service context handle */
  result = OCIAttrSet((void *) svchp, OCI_HTYPE_SVCCTX, (void *) srvhp, (ub4) 0, OCI_ATTR_SERVER, errhp);
  /* open the session with the database */
  result = OCISessionBegin(svchp, errhp, usrhp, OCI_CRED_RDBMS, OCI_DEFAULT);
  /* set the user session attribute in the service context handle */
  result = OCIAttrSet((void *) svchp, OCI_HTYPE_SVCCTX, (void *) usrhp, (ub4) 0, OCI_ATTR_SESSION, errhp);
  /* allocate the statement handle */
  result = OCIHandleAlloc((void *) envhp, (void **) &stmtp, OCI_HTYPE_STMT, 0, (void **) 0);
  /* prepare the statement for execution */
  result = OCIStmtPrepare(stmtp, errhp, sqlstmt, (ub4) strlen((char *) sqlstmt), OCI_NTV_SYNTAX, OCI_DEFAULT);
  /* execute the statement */
  result = OCIStmtExecute(svchp, stmtp, errhp, (ub4) 1, (ub4) 0, (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);
  /* print prompt line to console window */
  (void) printf("TRUNCATED MYTABLE. Press <enter> to repeat ");
  /* not safe, but as this is a controlled test, it is a known item */
  (void) gets(buf);
  /* NOTE: preparing the statement again is required for DDL to work correctly */
  /* comment the following line to illustrate that ddl is not re-executed */
  result = OCIStmtPrepare(stmtp, errhp, sqlstmt, (ub4) strlen((char *) sqlstmt), OCI_NTV_SYNTAX, OCI_DEFAULT);
  /* execute the statement again */
  result = OCIStmtExecute(svchp, stmtp, errhp, (ub4) 1, (ub4) 0, (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);
  /* free statement handle */
  result = OCIHandleFree((void *) stmtp, OCI_HTYPE_STMT);
  /* terminate the session with the database */
  result = OCISessionEnd(svchp, errhp, usrhp, OCI_DEFAULT);
  /* detach from the server */
  result = OCIServerDetach(srvhp, errhp, OCI_DEFAULT);
  /* deallocate the environment handle     */
  /* OCI will deallocate the child handles */
  result = OCIHandleFree((void *) envhp, OCI_HTYPE_ENV);
  return OCI_SUCCESS;
}Perhaps Jonah or Prajith will also see this thread and have a comment. They are both more well-versed in OCI than I...
Regards,
Mark
[EDIT]
Small edit for clarification on documentation link.

Similar Messages

  • Favor to ask : can you open this labview 2009 Vi and save it for me in a Labview 8.6 readable vi ?

    Hi guys, 
    I have a favor to ask : May somebody would be nice enough to open this Labview 2009 VI and save it in a Labview 8.6 readable VI  ? You'll probably have some missing blocks cause I use specials ones but I don't want to have to re-make all the VI.
    Thanks you very much
    G.
    Solved!
    Go to Solution.
    Attachments:
    Control3.vi ‏29 KB

    notimperial wrote:
    Probably not the right place to do this, but could someone onpen this in labview 2010 and save it in a format compatible with labview 2009?
    Thank you in advance
    You are right we have a thread for this here.
    http://forums.ni.com/t5/LabVIEW/Downconvert-VI-Req​uests/m-p/1067229
    Here is your vi please use the downconvert thread next time.
    Tim
    Johnson Controls
    Holland Michigan
    Attachments:
    WFMreaderIII.vi ‏53 KB

  • I have an iphone with the app GOOD to read e-mails.  I sync to my other PC having first updated itunes.  During sync it reported that it had removed GOOD, with out asking.  Any ideas?

    I have an iphone with the app GOOD to read e-mails.  I sync to my other PC having first updated itunes.  During sync it reported that it had removed GOOD, with out asking.  Any ideas?

    With the iPhone, you can sync all iTunes content with only one computer.  Trying to sync iTunes content with a second computer will result in iTunes erasing the content from the first computer.

  • CC wants to make changes - write your administrator code - no info on which changes it wants to make - keeps alerting me. I didn't ask for any changes.

    Every five seconds I get a notification that Adobe CC cannot install or uninstall Adobe add-ons without admin rights. I did'nt ask for any changes.
    If I press the upcoming alert, I get a window saying that CC wants to make changes, please write my admin code, but it doesn'r say which changes it is about to make.
    What do I do?

    Hi. I'm sure you've already tried this but are both you and your wife's accounts set as administrators?

  • I cant find the end button when i receive a incomming call please help me. Is there any solution for it or is it a bug in the ios7.0.3 iam updated with ios7.0.3

    I cant find the end button when i receive a incomming call please help me. Is there any solution for it or is it a bug in the ios7.0.3 iam updated with ios7.0.3

    Do you mean decline button before picking up the call?

  • A favor to ask

    i figured this would be the place to ask this question. Do you think Apple would be able to make an iChat compatible for a Windows PC? that would really be neat because i like iChat more than AIM and any other instant messenger program that can be run on Windows. I would really like for them to be able to do this, and i didn't know where else to ask.

    Hi lmakeeper88,
    Welcome to the Apple Discussions
    iChat is not likely to be cross feed like iTunes.
    Questions like this are considered to be speculation of Apple Products and their software.
    Speculation of these are not allowed by the Terms and Conditions
    2. Submissions
    * Search or browse for existing answers before you ask a question. Someone else may have asked your question — it may save you some time.
    * Stay on topic. Apple's discussion forums are here to help people use Apple products and technologies more effectively. Unless otherwise noted, don't add Submissions about nontechnical topics, including:
    o That Apple rumor you saw on another website.
    o Discussions of Apple policies or procedures.
    o Speculations/rumors about unannounced products.
    o The status of your 1973 MG Midget restoration.
    * Don't threadjack. Be sure your response relates to the topic. If you're reading about iPods and want to discuss your iSight, find the appropriate topic or start a new one.
    * Be polite. Everyone should feel comfortable reading Submissions and participating in discussions. Apple will not tolerate flames or other inappropriate statements, material, or links. Most often, a "flame" is simply a statement that is taunting and thus arbitrarily inflammatory. However, this also includes those which are libelous, defamatory, indecent, harmful, harassing, intimidating, threatening, hateful, objectionable, discriminatory, abusive, vulgar, obscene, pornographic, sexually explicit, or offensive in a sexual, racial, cultural, or ethnic context.
    * Don't be a troll. A troll is someone who strives to disrupt a constructive conversation by posting flames or specious arguments. Trolls sometimes impersonate another user by posting under a false user name. If you have a troll in your midst, let an Apple Host know.
    * Post constructive comments and questions. Unless otherwise noted, your Submission should either be a technical support question or a technical support answer. Feedback about new feature requests or product enhancements are welcome too. Don't post non-constructive complaints, polls, or petitions.
    * Do not post a URL unless it directly answers a user's question. If any portion of your Submission, including any posted URL, results in any accrual of compensation or benefit to you, then you must note this in your post by stating, "I may receive some form of compensation, financial or otherwise, from my recommendation or link."
    * State your question clearly. Include as much information as you can about your issue. At minimum, include:
    o The operating system you're using and its version.
    o The names and versions of other relevant products.
    o A complete description of computer and connected peripherals.
    o What you were doing when you ran into this issue. Example: I'm using Mac OS X 10.3.4 on a 20-inch flat panel iMac with 768 MB of RAM and 15 GB free space on my hard disk. I have an X-brand PDA connected via its USB cradle. iCal 1.5.2 unexpectedly quits when I add an event. Tip: As in the example, a good description of your computer includes how much RAM and how much free hard disk space you have.
    This can mean the thread will disappear before you read the answer.
    7:43 PM Wednesday; January 31, 2007

  • HT201363 I made from soft bank shop my apple id no body ask me any  security question befor many time used app stor  my id butt now showing security question please help me thanks  ashraf muhammad

    Plase help me i lowdid  app stor card but asking security question ido t have any security question

    Hello Ash1959,
    It sounds like you do not remember setting up security questions for your Apple ID and need them reset so you can set them up with your answers. You can use the the following article to reset them with a rescue email address, and it contains a link to contact the correct department if you do not have a rescue email address set up already.
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/ht5312
    You can edit or delete your rescue email address at My Apple ID. To edit your rescue email address:
    Navigate to My Apple ID using your web browser.
    Click "Manage your account"
    When prompted, sign in using your Apple ID and password.
    Click Password & Security
    You'll be asked to answer 2 of your 3 security questions before you can make any modifications. If you are unable to remember your answers, you can choose to send an email to your rescue email to reset your security questions.
    Note: The option to send an email to reset your security questions and answers will not be available if a rescue email address is not provided. You will need to contact iTunes Store support in order to do so. 
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • Audigy 2 SPDIF output - again, asking for any help.

    Some time ago I asked question about my Audigy 2:
    [size="">Hi, I am using Audigy 2 soundcard connected to Altec Lansing ADA885 speakers. These speakers have built-in Dolby Digital Decoder, and of course SPDIF input for this. Additionally, they have inputs for analog front and rear speakers signal. They can be switched to different operation modes : Dolby Digital decoding, Dolby ProLogic decoding, stereo, and quad modes. I have connected them to my Audigy 2 using analog connections, and also digital output. The problem is, that they process both kind of inputs (analog and digital) all the time in most modes simultaneously. For example, when I set them to "quad" mode (for gaming) they process analog signal that Audigy deli'vers them, but also they attempt to decode the signal from digital input. This produces some kind of phase distortions (basses dissappear and the sound becomes slightly muffled). Possible solutions could be : - disable digital decoding in speakers when using analog output from Audigy - this can't be done, these speakers' decoder is not configurable, - disconnect digital cable when using analog output from Audigy - obvious solution, however not very comfortable - disable "ON-DEMAND" spdif output on Audigy card and enable it when necessary. This would be most satisfying option for me. But.... is it possible at all ? Just something similar to the "Digital output only" setting in soundcard panel, but in my case i'd like to have an option of "Analog outputs only". Thanks in advance for any help <img title="Smiley Happy" alt="" src="http://forums.creative.com/i/smilies/6x6_smiley-happy.gif"> Greetings, Martin
    No-one answered me, unfortunately
    Yesterday I moved to Vista Ultimate and newest set of Creative Drivers.
    To my surprise, there is an option of SPDIF output volume and mute in system mixer. However, it also doesn't work.
    Can anyone confirm, if I can mute digital output whenever I want ?
    Best regards,
    Martin

    Glad to hear that I'm not the only one experiencing such pain with this card.
    After 3 connectors, I have my SPDIF of my Audigy 2 ZS connected to my Recei'ver and passing sound. However, it is NOT passing the 5. AC3/DTS stream. Playing a movie through Media Center 2005, if Dolby Digital 5. is selected, I hear the movie, but the Recei'ver does not indicate it is in Dolby Digital (like when I play it through my standalone DVD Player). When selecting DTS in the Audio Options of the DVD Menu, I hear no sound at all.
    I have a minijack to RCA Stereo connector with a Digial Coax cable going from the White connector to my Recei'ver Digital Coax Input.
    I have set the Device Decoding Options for SPDIF Passthrough.
    What am I missing? This is going on a week now to get something going that worked right out of the box with a $40 DVD Player. And the $40 DVD Player sounds better than this $00 sound card....because it passes the AC3 stream flawlessly.

  • Asking again: any fixes for http:/1.1 300 and 500 errors in iCal-Server?

    Hi there
    I've set up several OS X servers in the last few months, most of them with ical services up and running. Quite everything works smooth, but most customers experience sooner or later errors like
    http:/1.1 300... (mostly with repeating events, which seem to be buggy in iCal&CalDAV already for a long time)
    http:/1.1 500...
    neither are there any relevant entries in the log, nor does it occur on a regular base - in fact, we can observe these errors all 2 or 3 weeks or so. Stopping an restarting of iCal services usually fixes them. DNS is set up perfectly well, including the SRV-entries.
    What about you? Do we just have to live with these errors? Or do I really have to sell Kerio to my customers?
    Thanks for any suggestion
    Regards
    Roman

    Hi Roman
    I have had a few years setting up and administering various calendar options on Xserve.
    The Apple built in iCal server is by far the worst of the lot.
    Previous to that we used phpicalendar- http://phpicalendar.net/documentation/index.php/Main_Page
    It is a bit dated and does not support the same feature set as the Apple one. It works well though.
    Kerio on the other hand is great, works well and is easy to use, apart from accepting invites on iOS devices. Its also a much better mailserver than Apple's one.
    Another option is to write a script to run everyday to stop and restart the ical service?

  • HT204382 quick time is not opening my files, so I'm asking about any additional program?

    Dear sir/ madam,
    I'm actually asking for aaditional media support to my quick time because im i couldn't able to open my files and listen to what i need to listen.
    Thanks

    Try using Perian or VLC.
    (105680)

  • Asking for any 5 examples from a list of 10

    I am building a quiz for the first time, I have a need for the student to answer a question,
    Please
           Name 3 of the 5 discount types
    I cannot seem to work out how to do this
    Any help would be greatly appreciated
    regards
    Jim

    Welcome to our community, Jim
    I might suggest exploring the "Fill in the blank" type of question. Basically you could construct it this way:
    Please Name 3 of the 5 discount types
    Answer 1 (Blank here)
    Answer 2 (Blank here)
    Answer 3 (Blank here)
    You would then enter your five possible answers in the Question Properties.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • A favor to ask of you...

    Hello,
    I am starting a wedding videography company and I need to see if my Flash wedding demo plays smoothly on the web for my website. Could you please go to the below link to check it out? I need to know if there are any stutters. Could you also note if your computer is directly connected to the Internet or if it's wifi. I'm most interested in g bandwith wifi as that will be common.
    http://www.design.iflair.net/steaming/index.html
    Thanks in advance.

    Hey Peter,
    I bought this $5 pdf file:
    http://www.proappstips.com/EncodingRecipes/
    It seems really useful. The examples are links, e.g
    http://www.proappstips.com/EncodingRecipes/pageFlash.html
    so that you can see how they look online.
    Actually, the .swf file does download first. It goes into
    the browser cache so you don't see it.
    Here's a summary of how I encode now:
    1. In FCP, I crush the blacks. Using the color corrector effect,
    I limit the effect to blacks and dark greys and make them
    all black so you don't see dark grey noise swirling around.
    2. In FCP, I bring up the mids and crop if necessary,
    so that the image "reads" even if it's small.
    Good time to clean up and compress the audio, if necessary.
    3. I then export the edited excerpt to a full-sized good-looking codec,
    preferably the same codec as the original or something like h.264.
    4. Then I use Quicktime Player to export to .flv (I have the codec from
    my Adobe app install).
    a. Normal On2 VP6 codec, set to high (although Flash 9 supports h264,
    which will be even better!)
    b. Resize to values that are a multiple of 8, so 600 x 336 for 16:9
    or 504 x 336 for 3:2.
    c. Select mp3 at 192kbps for the audio.
    d. Reduce framerate by an even number, so 30 fps becomes 20 fps,
    and 24 becomes 16.
    In Flash, make sure the player doesn't make the video any larger or smaller.
    I hope that helps.
    Les

  • My new version of Pages crashes any time I ask him to Print, other programmes print from the same computer. Does anyone know why this might be?

    Last week I installed Mavericks and I cannot print with the new version of pages anymore.
    Every time I click on print and/or I press ctl +p the programme crashes and it allegedly reports Apple about my problem, but nothing happens.
    Could anyonw help me please?

    Have you tried using the PAges '09 that should still be in your Applications/iWork folder?
    Peter

  • I can't open any folders or programmes

    I'm posting this question through bootcamp.
    Everytime when I delete the files, my mac asked me to type password. So I searched to fix the problem and it told me to go to terminal and type:
    sudo chown -R username:staff /Users/dominica
    sudo chmod -R 600 /Users/dominica
    After when I typed this, my mac got froze. So I had to restart my mac, and it completely went basic. All my programmes and documents were gone, also I couldn't open finders, and did not show the bar on top.
    Then I restarted mac with cmmd+R, and I verifyed and recovered the disk to fix the problem. 
    When I restarted my mac, all my programmes were back. But it did not allow me to open of any progammes or folders saying I don't have any permisson to open these files.
    So how can I fix this? I didn't back up any of my work, and I really don't want to reinstall the OS. Please help me.

    #5 and #6 here
    ..Step by Step to fix your Mac
    if that don't work then
    .Create a data recovery/undelete external boot drive
    then
    Erase, formatting, OS X installs on Mac's

  • With the IPhone4, the bluetooth is not working (can't find any other iphone or mac). is it a bug or is it just a problem with mine?

    I'm trying to connect to mac or Ipad or even Iphone and it's searching without any result.

    For what purpose are you trying to connect them?
    Only specific apps support Bluetooth connections between iOS devices, and you can only connect an iPhone to a computer via Bluetooth for internet tethering.

Maybe you are looking for