PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Using
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Using

Réponse
 
LinkBack Outils de la discussion
Vieux 08/11/2007, 00h14   #1
asnowfall@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Using

I have time in time_t, a C++ structure.
Is there a way that I can use this 'time_t' in a SQL query to update
row?

The functionality that I am looking is for some SQL function that
takes time_t and converts the time to sql's date format before
updating the row.

  Réponse avec citation
Vieux 08/11/2007, 00h17   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Using

asnowfall@gmail.com wrote:
> I have time in time_t, a C++ structure.
> Is there a way that I can use this 'time_t' in a SQL query to update
> row?
>
> The functionality that I am looking is for some SQL function that
> takes time_t and converts the time to sql's date format before
> updating the row.
>
>


No. SQL knows nothing about C++ structures.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 10/11/2007, 03h58   #3
Ted
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Using

On Nov 7, 6:14 pm, "asnowf...@gmail.com" <asnowf...@gmail.com> wrote:
> I have time in time_t, a C++ structure.
> Is there a way that I can use this 'time_t' in a SQL query to update
> row?
>
> The functionality that I am looking is for some SQL function that
> takes time_t and converts the time to sql's date format before
> updating the row.


Jerry is right to say SQL knows nothing about C++ structures. That
said, I would add two comments.

1) If you have a need to use data stored, within your C++ program in
time_t, and you need to use it in your process of updating or
manipulating data in your database back end, then write your own
function to handle the conversion. It isn't that hard. Yes, you have
to write code, but you can either work using the standard C/C++
libraries, or you can work from the definition of time_t from the
standard headers. All you have to do is decide where best to do it:
on the client side within your own code or on the server side, within
a stored procedure. There is nothing magical about time_t. It is
just a long integer, and it is the library functions that give it
meaning. You can reproduce on the server side what the standard C
functions give you on the client side, or you can send data in types
the database understands and process them on the client side.

2) I spend most of my time on database programs developing the client
side either in plain Java, using JDBC, or with PHP or Perl. But most
of my other code is developed using C++. Therefore, as one C++
developer to another, if you are often developing the client of a
database application in C++, then you will be wise to either source or
develop a library of utilities to support basic communication between
your application and whatever database you are using. You are not on
your own in this. Go to http://www.mysql.com/products/connector/ and
you'll find about half a dozen different options for database
development on Windows using MySQL. Your options may be constrained
if you're working on linux, but there too there's no dearth of options
I am sure. Pick the option that best meets your need and then write
code to use it in the most efficient manner possible.

WRT writing what you need in to interact with MySQL, take a look at
chapter 23 of the manual (in pdf form) for MySQL 5. In it I see you
can write your code in C, PHP, Perl, C++, Python, Tcl, and Eiffel.
They have gone the extra mile for you to work with MySQL in any of the
most commonly used languages. So study what they say about the C API
to MySQL, and your own documentation for whatever C++ development
tools you're using, and all ought to be clear.

In short, if you don't find what you're looking for, write it
yourself.

Good luck and happy coding

Ted

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h30.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11070 seconds with 11 queries