List:Cluster« Previous MessageNext Message »
From:Antonio Modesto Date:July 20 2012 8:28pm
Subject:Re: [OFF-TOPIC] MySQL C API Insertion Doubt
View as plain text  
Hi,

	I'm doing the selects on a ndbcluster database, the inserts will be on
a mysqld server. I am trying to create the insert statement, as I'm not
a C expert I'm having some difficulties, the mysql_fetch_row doesn't
return null-terminated strings and that makes the handling a little bit
harder for me.


Thanks for your help, It was very helpful.


Regards.


On Fri, 2012-07-20 at 13:07 -0700, Dan Smythe wrote:
> Antonio,
> 
> I don't know of anything in the C API that allows you to SELECT a tuple
> using SQL statement,
> and use that result set to pass it into somewhere else.
> 
> The fact of the matter is that the C API is designed to interact with
> mysqld server, which means
> your interaction with the server will undoubtedly be via SQL statements.
> 
> But you sent this email to the cluster@ mailing list...
> 
> So are you using the mysqld C API or the ndbcluster NDB API ? Or both?
> 
> With NDB API the methods for inserting tuples are much different than the C
> API, because you
> are not directly interfacing with mysqld, you are directly interfacing with
> storage nodes of the
> cluster.
> 
> This shows an example of how to insert a tuple with NDB API into ndbcluster.
> http://dev.mysql.com/doc/ndbapi/en/ndb-examples-synchronous-transactions.html
> 
> 
> This is the main page for the NDB API documentation ( for working the
> ndbcluster data nodes )
> http://dev.mysql.com/doc/ndbapi/en/ndbapi.html
> 
> But if you are trying to INSERT data into mysqld ( engines Innodb, Myisam,
> etc. )
> Then you will want the MySQL C API documentation:
> http://dev.mysql.com/doc/refman/5.5/en/c.html
> 
> Which unfortunately does not have some mysql_insert_row function, but
> instead has
> mysql_query and you must construct an INSERT statement.
> 
> If you use NDB API you still will have to 'construct' a series of objects
> representing the tuple
> you would like to insert into a ndbcluster table....
> 
> I hope this is helpful...
> 
> Cheers~
> Dan
> 
> On Fri, Jul 20, 2012 at 11:44 AM, Antonio Modesto
> <modesto@stripped>wrote:
> 
> > Hi,
> >
> >
> >         I'm writing a C code (using the mysql api) to select specific rows
> > from
> > a database and insert them in another database in a different host. The
> > problem is that I didn't find any method to insert a row directly, What
> > I've noticed so far is that I have to construct a mysql statement
> > (Insert into bla bla bla..) based on the result of the query, and then
> > pass it to the mysql_query function to insert the row in the another
> > database. Is a easier way to do that? Something like
> > mysql_insert_row(&mysql_handler, row)?
> >
> >
> > Thanks and sorry for asking it in this list, but I searched a lot on the
> > web and didn't find anything that could help.
> >
> >
> > Regards.
> >
> >
> > --
> > MySQL Cluster Mailing List
> > For list archives: http://lists.mysql.com/cluster
> > To unsubscribe:    http://lists.mysql.com/cluster
> >
> >


Thread
[OFF-TOPIC] MySQL C API Insertion DoubtAntonio Modesto20 Jul
  • Re: [OFF-TOPIC] MySQL C API Insertion DoubtDan Smythe20 Jul
    • Re: [OFF-TOPIC] MySQL C API Insertion DoubtAntonio Modesto20 Jul