31.07.2013 Views

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

myOperation->equal("SUB_ID", 2);<br />

myOperation->setValue("COUNTRY_CODE", 1);<br />

myOperation= myTransaction->getNdbOperation(myTable);<br />

if (myOperation == NULL) APIERROR(myTransaction->getNdbError());<br />

myOperation->insertTuple();<br />

myOperation->equal("SUB_ID", 4);<br />

myOperation->setValue("COUNTRY_CODE", 61);<br />

myOperation= myTransaction->getNdbOperation(myTable);<br />

if (myOperation == NULL) APIERROR(myTransaction->getNdbError());<br />

myOperation->insertTuple();<br />

myOperation->equal("SUB_ID", 5);<br />

myOperation->setValue("COUNTRY_CODE", 33);<br />

myOperation= myTransaction->getNdbOperation(myTable);<br />

if (myOperation == NULL) APIERROR(myTransaction->getNdbError());<br />

myOperation->insertTuple();<br />

myOperation->equal("SUB_ID", 7);<br />

myOperation->setValue("COUNTRY_CODE", 46);<br />

myOperation= myTransaction->getNdbOperation(myTable);<br />

if (myOperation == NULL) APIERROR(myTransaction->getNdbError());<br />

myOperation->insertTuple();<br />

myOperation->equal("SUB_ID", 8);<br />

myOperation->setValue("COUNTRY_CODE", 1);<br />

myOperation= myTransaction->getNdbOperation(myTable);<br />

if (myOperation == NULL) APIERROR(myTransaction->getNdbError());<br />

myOperation->insertTuple();<br />

myOperation->equal("SUB_ID", 9);<br />

myOperation->setValue("COUNTRY_CODE", 44);<br />

myOperation= myTransaction->getNdbOperation(myTable);<br />

if (myOperation == NULL) APIERROR(myTransaction->getNdbError());<br />

myOperation->insertTuple();<br />

myOperation->equal("SUB_ID", 10);<br />

myOperation->setValue("COUNTRY_CODE", 33);<br />

myOperation= myTransaction->getNdbOperation(myTable);<br />

if (myOperation == NULL) APIERROR(myTransaction->getNdbError());<br />

myOperation->insertTuple();<br />

myOperation->equal("SUB_ID", 12);<br />

myOperation->setValue("COUNTRY_CODE", 44);<br />

myOperation= myTransaction->getNdbOperation(myTable);<br />

if (myOperation == NULL) APIERROR(myTransaction->getNdbError());<br />

myOperation->insertTuple();<br />

myOperation->equal("SUB_ID", 13);<br />

myOperation->setValue("COUNTRY_CODE", 1);<br />

myOperation= myTransaction->getNdbOperation(myTable);<br />

if (myOperation == NULL) APIERROR(myTransaction->getNdbError());<br />

myOperation->insertTuple();<br />

myOperation->equal("SUB_ID", 14);<br />

myOperation->setValue("COUNTRY_CODE", 61);<br />

}<br />

if (myTransaction->execute( NdbTransaction::Commit ) == -1)<br />

APIERROR(myTransaction->getNdbError());<br />

myNdb.closeTransaction(myTransaction);<br />

/************************************************************<br />

* Read and print all tuples via primary ordered index scan *<br />

************************************************************/<br />

static void do_indexScan(Ndb &myNdb)<br />

{<br />

NdbDictionary::Dictionary* myDict= myNdb.getDictionary();<br />

Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 46/81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!