Skip to content

Instantly share code, notes, and snippets.

@reuniware
Created October 20, 2020 08:43
Show Gist options
  • Save reuniware/6272ef101618718dbec0d3eb011c8b1b to your computer and use it in GitHub Desktop.
Save reuniware/6272ef101618718dbec0d3eb011c8b1b to your computer and use it in GitHub Desktop.
Windev Mobile SQLite/Fonctions WLangague Tentative (KO)...
SI fFichierExiste(fRepExe() + "\databases\BDD.db") ALORS
//Info("fichier existe")
FIN
BDD est une Connexion
BDD..Provider = hAccèsNatifSQLite
BDD..Source = "BDD.db"
BDD..Accès = hOLectureEcriture
SI HOuvreConnexion(BDD) = Faux ALORS
Erreur(HErreurInfo())
SINON
SI HExécuteRequêteSQL(BDD, "BDD", hRequêteDéfaut, "CREATE TABLE IF NOT EXISTS matable(champ1 TEXT, champ2 REAL);") = Vrai ALORS
//Info("Create table if not exist ok")
POUR i = 1 À 20
SI HExécuteRequêteSQL(BDD, "BDD", hRequêteDéfaut, "INSERT INTO matable(champ1, champ2) VALUES ('aaa" + i + "', 1.5);") = Faux ALORS
Info("ERREUR insert");
FIN
FIN
SINON
Info(HErreurInfo())
FIN
FIN
////NE FONCTIONNE PAS
//sdMatable est une source de données
//HExécuteRequêteSQL(sdMatable, BDD, hRequêteDéfaut, "SELECT champ1, champ2 FROM matable")
//// ---
HFermeConnexion(BDD)
SI HDécritConnexion("MaConnexion", "", "", "BDD.db", "", hAccèsNatifSQLite, hOLectureEcriture, "") = Vrai ALORS
cnxMaConnexion est une Connexion
cnxMaConnexion..BaseDeDonnées = "BDD.db"
cnxMaConnexion..Provider = hAccèsNatifSQLite
cnxMaConnexion..Accès = hOLectureEcriture
//SI HOuvreConnexion(cnxMaConnexion) = Vrai ALORS
//Info("HOuvreConnexion ok")
sdMaSource est une Source de Données
SI HExécuteRequêteSQL(sdMaSource, cnxMaConnexion, hRequêteDéfaut, "SELECT * FROM matable") = Vrai ALORS
Info("Req ok")
FIN
//FIN
FIN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment