begin process at 2012 02 08 22:49:36
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Base de données

 > [ODBC] BIPFILE - FONCTIONS D'ACCÈS AUX BASES DE DONNÉES

[ODBC] BIPFILE - FONCTIONS D'ACCÈS AUX BASES DE DONNÉES


 Information sur la source

Note :
Aucune note
Catégorie :Base de données Classé sous :odbc, access, sql, frontal, bip Niveau :Initié Date de création :13/12/2005 Date de mise à jour :13/12/2005 19:52:33 Vu / téléchargé :10 775 / 1 216

Auteur : bipcpp

Ecrire un message privé
Site perso
Commentaire sur cette source (3)
Ajouter un commentaire et/ou une note

 Description

Cliquez pour voir la capture en taille normale
Les fonctions BipFILE ont pour but de faciliter l'accès aux bases de données.

Les bases gérées actuellement sont Microsoft Jet (=Access), Microsoft SqlServeur et MySQL.
Les accès se font via ODBC. Les fonctions supportent nom d'utilisateur, mot de passe, port, trusted connection, nom du serveur, ...
La description des tables ou requètes est chargée automatiquement dans des structures en mémoire.
Documentation complète ici : http://bipcpp.free.fr/

Un exemple des fonctions :
- pour ouvrir une table : BF_TableOpen
- pour lancer une requète SELECT : BF_SQLQueryOpen
- pour lancer une commande INSERT, ALTER, DELETE ... : BF_SQLCommand
- pour lire un enregistrement : BF_RecordReadNext
- pour récupérer les valeurs : BF_FieldValueGetString, BF_FieldValueGetInteger, BF_FieldValueGetDate, ...
- pour fermer la table : BF_TableClose

Source

  • Un extrait du .h :
  • --------------------
  • // table functions
  • int BF_TableOpen (const string sBFName, const string sBFTableName, const string sBFDbName,
  • const string sBFSrvName, const string sBFDbType, const string sBFParam = "");
  • // sBFParam = ""
  • int BF_TableClose (const string sBFName);
  • BF_STRUCT_TABLE BF_TableGet (const string sBFTable);
  • BF_STRUCT_TABLE BF_TableNullGet (void);
  • int BF_SQLRecordDescriptionLoad (const string sBFName);
  • int BF_SQLQueryDescriptionLoad (const string sBFName);
  • int BF_BDBRecordDescriptionLoad (const string sBFName);
  • int BF_BDBRecordDescriptionSave (const string sBFName, const string sBFRecord);
  • // field functions
  • int BF_FieldAdd (const string sBFName, const string sBFFieldName,
  • const string sBFInterType, const int iBFFieldLength,
  • const string sBFDbType, const bool bBFDbNull,
  • const string sBFDbRemark = "", const string sBFDbDefValue = "",
  • const int iBFDbDecimal = 0);
  • // sBFDbRemark = "", sBFDbDefValue = "", iBFDbDecimal = 0
  • BF_STRUCT_FIELD BF_FieldGet (const string sBFTable, const string sBFField);
  • string BF_FieldNameGet (const string sBFTable, const int iBFOrder);
  • string BF_FieldValueGetString (const string sBFName, const string sBFField);
  • string BF_FieldValueGetString (const string sBFName, const int iBFOrder);
  • long BF_FieldValueGetInteger (const string sBFName, const string sBFField);
  • long BF_FieldValueGetInteger (const string sBFName, const int iBFOrder);
  • LONGLONG BF_FieldValueGetLongLong (const string sBFName, const string sBFField);
  • LONGLONG BF_FieldValueGetLongLong (const string sBFName, const int iBFOrder);
  • double BF_FieldValueGetFloat (const string sBFName, const string sBFField);
  • double BF_FieldValueGetFloat (const string sBFName, const int iBFOrder);
  • BP_Date BF_FieldValueGetDate (const string sBFName, const string sBFField);
  • BP_Date BF_FieldValueGetDate (const string sBFName, const int iBFOrder);
  • BP_Currency BF_FieldValueGetCurrency (const string sBFName, const string sBFField);
  • BP_Currency BF_FieldValueGetCurrency (const string sBFName, const int iBFOrder);
  • BF_STRUCT_FIELD BF_FieldNullGet (void);
  • int BF_FieldSetString (const string sBFName, const string sBFField,
  • const string sBFValue, const bool bBFNull = false);
  • // const bool bBFNull = false
  • int BF_FieldSetInteger (const string sBFName, const string sBFField,
  • const long lBFValue, const bool bBFNull = false);
  • // const bool bBFNull = false
  • int BF_FieldSetLongLong (const string sBFName, const string sBFField,
  • const LONGLONG llBFValue, const bool bBFNull = false);
  • // const bool bBFNull = false
  • int BF_FieldSetFloat (const string sBFName, const string sBFField,
  • const double dBFValue, const bool bBFNull = false);
  • // const bool bBFNull = false
  • int BF_FieldSetDate (const string sBFName, const string sBFField,
  • BP_Date dtBFValue, const bool bBFNull = false);
  • // const bool bBFNull = false
  • int BF_FieldSetCurrency (const string sBFName, const string sBFField,
  • BP_Currency curBFValue, const bool bBFNull = false);
  • // const bool bBFNull = false
  • BF_STRUCT_FIELD BF_SQLQueryFieldGet (const string sBFTable, const int iBFOrder);
  • // record functions
  • int BF_RecordReadNext (const string sBFName);
  • int BF_RecordSave (const string sBFName);
  • int BF_RecordPrepare (string sBFName);
  • // SQL functions
  • string BF_SQLQueryOpen (const string sBFQueryName, const string sBFSQLQuery,
  • const string sBFDbName, const string sBFSrvName,
  • const string sBFDbType, const string sBFParam = "");
  • // sBFParam = ""
  • string BF_SQLCommand (const string sBFSQLCommand, const string sBFDbName,
  • const string sBFSrvName, const string sBFDbType, const string sBFParam);
  • string BF_SQLConnectStringGet (const string sBFDbName, const string sBFSrvName,
  • const string sBFDbType, const string sBFParam);
  • // other functions
  • void BF_ResetBipFILEIntl (void);
  • void BF_ErrorSet (const string sBFName, const string sBFFunction, const string sBFParam);
  • string BF_ErrorDisplay (const int iBFError);
  • void BF_ErrorDisplaySet (const bool bBFError = true, const bool bBFWrite = false);
  • // bBFError = true, bBFWrite = false
  • string BF_IntToString (const long iLong);
  • int BF_StringToInt (const string sString, const int iBase = 10);
  • // iBase = 10
  • string BF_LongLongToString (const LONGLONG iLong);
  • LONGLONG BF_StringToLongLong (const string sString);
  • string BF_DoubleToString (const double dDouble);
  • string BF_StringToUpper (const string sString);
  • string BF_StringParamGetIntl (const string sBFParam, const string sBFString);
  • bool BF_StringIsTrue (const string sBFInput);
  • bool BF_StringIsFalse (const string sBFInput);
Un extrait du .h :
--------------------

	// table functions
	int BF_TableOpen (const string sBFName, const string sBFTableName, const string sBFDbName,
				  const string sBFSrvName, const string sBFDbType, const string sBFParam = "");
				  // sBFParam = ""
	int BF_TableClose (const string sBFName);
	BF_STRUCT_TABLE BF_TableGet (const string sBFTable);
	BF_STRUCT_TABLE BF_TableNullGet (void);
	int BF_SQLRecordDescriptionLoad (const string sBFName);
	int BF_SQLQueryDescriptionLoad (const string sBFName);
	int BF_BDBRecordDescriptionLoad (const string sBFName);
	int BF_BDBRecordDescriptionSave (const string sBFName, const string sBFRecord);


	// field functions
	int BF_FieldAdd (const string sBFName, const string sBFFieldName,
					const string sBFInterType, const int iBFFieldLength,
					const string sBFDbType, const bool bBFDbNull,
					const string sBFDbRemark = "", const string sBFDbDefValue = "",
					const int iBFDbDecimal = 0);
					// sBFDbRemark = "", sBFDbDefValue = "", iBFDbDecimal = 0
	BF_STRUCT_FIELD BF_FieldGet (const string sBFTable, const string sBFField);
	string BF_FieldNameGet (const string sBFTable, const int iBFOrder);
	string BF_FieldValueGetString (const string sBFName, const string sBFField);
	string BF_FieldValueGetString (const string sBFName, const int iBFOrder);
	long BF_FieldValueGetInteger (const string sBFName, const string sBFField);
	long BF_FieldValueGetInteger (const string sBFName, const int iBFOrder);
	LONGLONG BF_FieldValueGetLongLong (const string sBFName, const string sBFField);
	LONGLONG BF_FieldValueGetLongLong (const string sBFName, const int iBFOrder);
	double BF_FieldValueGetFloat (const string sBFName, const string sBFField);
	double BF_FieldValueGetFloat (const string sBFName, const int iBFOrder);
	BP_Date BF_FieldValueGetDate (const string sBFName, const string sBFField);
	BP_Date BF_FieldValueGetDate (const string sBFName, const int iBFOrder);
	BP_Currency BF_FieldValueGetCurrency (const string sBFName, const string sBFField);
	BP_Currency BF_FieldValueGetCurrency (const string sBFName, const int iBFOrder);
	BF_STRUCT_FIELD BF_FieldNullGet (void);
	int BF_FieldSetString (const string sBFName, const string sBFField,
						const string sBFValue, const bool bBFNull = false);
						// const bool bBFNull = false
	int BF_FieldSetInteger (const string sBFName, const string sBFField,
						const long lBFValue, const bool bBFNull = false);
						// const bool bBFNull = false
	int BF_FieldSetLongLong (const string sBFName, const string sBFField,
						const LONGLONG llBFValue, const bool bBFNull = false);
						// const bool bBFNull = false
	int BF_FieldSetFloat (const string sBFName, const string sBFField,
						const double dBFValue, const bool bBFNull = false);
						// const bool bBFNull = false
	int BF_FieldSetDate (const string sBFName, const string sBFField,
						BP_Date dtBFValue, const bool bBFNull = false);
						// const bool bBFNull = false
	int BF_FieldSetCurrency (const string sBFName, const string sBFField,
						BP_Currency curBFValue, const bool bBFNull = false);
						// const bool bBFNull = false
	BF_STRUCT_FIELD BF_SQLQueryFieldGet (const string sBFTable, const int iBFOrder);


	// record functions
	int BF_RecordReadNext (const string sBFName);
	int BF_RecordSave (const string sBFName);
	int BF_RecordPrepare (string sBFName);


	// SQL functions
	string BF_SQLQueryOpen (const string sBFQueryName, const string sBFSQLQuery,
					 const string sBFDbName, const string sBFSrvName,
					 const string sBFDbType, const string sBFParam = "");
				  // sBFParam = ""
	string BF_SQLCommand (const string sBFSQLCommand, const string sBFDbName,
					  const string sBFSrvName, const string sBFDbType, const string sBFParam);
	string BF_SQLConnectStringGet (const string sBFDbName, const string sBFSrvName,
							   const string sBFDbType, const string sBFParam);

	// other functions
	void BF_ResetBipFILEIntl (void);
	void BF_ErrorSet (const string sBFName, const string sBFFunction, const string sBFParam);
	string BF_ErrorDisplay (const int iBFError);
	void BF_ErrorDisplaySet (const bool bBFError = true, const bool bBFWrite = false);
				// bBFError = true, bBFWrite = false


	string BF_IntToString (const long iLong);
	int BF_StringToInt (const string sString, const int iBase = 10);
				// iBase = 10
	string BF_LongLongToString (const LONGLONG iLong);
	LONGLONG BF_StringToLongLong (const string sString);
	string BF_DoubleToString (const double dDouble);
	string BF_StringToUpper (const string sString);
	string BF_StringParamGetIntl (const string sBFParam, const string sBFString);
	bool BF_StringIsTrue (const string sBFInput);
	bool BF_StringIsFalse (const string sBFInput);

 Conclusion

En exemple, vous trouverez un frontal SQL (voir copie d'écran) qui permet de lancer toutes les requètes SQL (SELECT, UNION, HAVING, GROUP BY, ...) et commandes SQL (ALTER, DROP, INSERT, UPDATE, DELETE, ...) reconnues par la base SQL.

La source et l'executable sont ici : http://bipcpp.free.fr/fr/bipfile/demosql-v110.zip

C'est un exe de 330 ko qui est autonomme, pas d'installation, pas de modification de la base de registre, ...
le seul prérequis est l'installation du driver ODBC de votre base de données.

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Historique

13 décembre 2005 19:52:33 :
Modification des commentaires.

 Sources du même auteur

Source avec Zip Source avec une capture AUTOCLIC - AUTOMATISATION DE WINDOWS
Source avec Zip PLANSCAN : SCANNEUR DE FICHIER ET CONFIGURATION PC
Source avec Zip Source avec une capture BIPCPP - FENÊTRE,DIALOG,MENU INTER-ACTIFS
Source avec Zip BIPNUM : CLASSE POUR NOMBRE MONÉTAIRE
Source avec Zip CLASSE DATE C++ AVEC FORMAT ET VALEUR NULLE

 Sources de la même categorie

GESTION DE FICHIER ET DOSSIER + AUTRES par shinji63
Source avec une capture CONVERTISSEUR par smartties
Source avec Zip CREATION D'UN FICHIER DBF (EN C) par Stanel
Source avec Zip STRUCTURE DES FICHIERS DBF par Stanel
Source avec Zip Source avec une capture GESTION DES ENTREES/ SORTIES AVEC CODEBARRE par YvaddavY

 Sources en rapport avec celle ci

Source avec Zip BOT IRC C++ FACONNABLE ET EXTENSIBLE AVEC ARCHITECTURE EVENE... par lovejava
Source avec Zip BASES DE DONNÉES ET LES PHOTOS par sofinf2006
Source avec Zip MANIPULER UNE BASE DE DONNÉE ACCESS EN C (DEV-C++) par Any_Problem_Have_Solution
Source avec Zip Source avec une capture INTERPRÉTEUR PSEUDO SQL par karamimed
Source avec Zip CLASSE CBDD par bobbyantho

Commentaires et avis

Commentaire de podorn le 30/05/2006 15:40:59

Bonjour,
Je constate qu'il manque un fichier dans tes source : "BipDATE.h" qui est inclus dans le fichier "BipFILE.cpp" et ton lien vers les sources est brisé me semble t-il. (http://bipcpp.free.fr/fr/bipfile/demosql-v110.zip)
Merci et A+

Commentaire de pleuduchfeu le 20/06/2006 21:15:13

Bonjour,
même constatation que PODORN, pas de fichier "BipDATE.h".
Dommage, ca avait l'air pas mal... Pourrais-tu nous le mettre en ligne qu'on voit ce que ca donne?
Merci

Commentaire de bipcpp le 21/06/2006 21:13:47

Je viens de vérifier le lien et il fonctionne.

Je vous encourage toutefois à regarder la nouvelle version :
http://bipcpp.free.fr/fr/bipsql/BipSQLv100.zip
qui affiche les données dans une listview.
Une nouvelle version qui affiche les tables et les champs des tables, qui affiche les dates jusqu'au 31/12/9999, les valeurs nulles, ... est en cours.

Si le site Web ne réponds pas contactez-moi par mail.

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

interface access sur oracle avec odbc [ par plantachou ] bonjourj'arrive a recuperer sur access ma base oracle avec ODBC mais je sais pas comment faire pour modifier ou ajouter des données a ma table oracle Les grandes tables Access et ODBC [ par Michel Caramez ] Bonjour,Je travail sur un système de récupération de données en C++ via un ODBC sur une table MS Access. j'ai développé une mini application. Mais voi ecrire dans une base de données access grâce à ODBC [ par volcomboy1 ] BonjourPourriez vous m'expliquer comment on fait pour créer des nouveau champs et des nouveau enregistrements dans une base de données acces grâce a o créer une table nomé image en Access par SQL [ par monimon18 ] bonjour je veut créér une table nomé image en code SQL en ACCESS mais je ne sais pas pourquoi ça marche pas; create table image(champ1 int,champ2 int) C++.NET Odbc Connection à une base access [ par baptistemazet ] Bonjour, jessaye d'établir une connection à une base de données access, pour alors l'attaquer par des requetes SQL, le problème es variable dans requete SQL sous ODBC [ par 0Cypher0 ] Salut tout le monde, Voila, j'ai un petit PB que je n'arrive pas a resoudre. Je voudrais passer une requete SQL via ODBC, ce qui fonctionne pour une MFC connexion a une bas Access (ODBC) [ par gadafla ] Lorsque je cree un projet MFC avec les fonctionnalites d'une connexion ODBC a une base Access (avec Visual Studio, bien entendu), j'arrive a lire des Problème de deconnection de l'odbc(c++) [ par seleccao ] Bonjours à tous!! Je suis entrain de faire un programme qui utilise la base de donnée excel, j'essaye de me deconnecté de mon odbc en ihm mais je n'y Requete stockee access via odbc [ par GLOBUL03 ] Bonsoir,Je me connecte à une base  de données ACCESS via ODBC avec la classe MFC CDataBase.Pour executer une requete stockee, j'utilise ODBC en C [ par oxifis974 ] Bonjour tout le mondeJe cherche a me connecter à une base de données en C. SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); // la version d


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,406 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales