TetaTricks/chap/bdd.tex

75 lines
1.7 KiB
TeX
Raw Normal View History

2022-12-16 20:41:32 +01:00
\chapter{Bases de données}
2023-10-08 21:56:41 +02:00
\label{chap:bdd} \index{SQL}
2022-12-16 20:41:32 +01:00
% ----------------------------------------------------------------
2023-10-08 21:56:41 +02:00
2022-12-16 20:41:32 +01:00
% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\section{sqlite} \index{sqlite}
% ----------------------------------------------------------------
\subsection{CLI} \index{cli}
% ----------------------------------------------------------------
\subsection{Libreoffice} \index{Libreoffice}
2023-10-08 21:56:41 +02:00
2022-12-16 20:41:32 +01:00
% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2023-10-08 21:56:41 +02:00
2022-12-16 20:41:32 +01:00
\section{GDBM} \index{GDBM}
2023-10-08 21:56:41 +02:00
Alors là, carrément du vieux truc...
\begin{quote}
GDBM - The GNU database manager. Includes dbm and ndbm compatibility.
\end{quote}
Gnu DBM permet de stocker des paires clef/valeur dans un fichier
de données. Chacune de ces clefs doit être unique, et doit être
liée avec une seule valeur\footnote{Peut-on alors parler
de bijection relationnelle ?}.
2022-12-16 20:41:32 +01:00
% ----------------------------------------------------------------
2023-10-08 21:56:41 +02:00
\subsection{Exemple en Perl} \index{Perl}
\begin{verbatim}
#!/usr/bin/perl -w
2022-12-16 20:41:32 +01:00
2023-10-08 21:56:41 +02:00
use strict;
use GDBM_File;
my $nomdb = "exemple.gdbm";
my (%DB, @champs);
my ($user, $gecos);
open(SOURCE, "< /etc/passwd") or die "source $!";
tie(%DB, "GDBM_File", $nomdb, GDBM_WRCREAT, 0666) or die "gdbm $!";
while (<SOURCE>) {
@champs = split ":", $_;
$user = $champs[0]."\0";
$gecos = $champs[4]."\0";
$DB{$user} = $gecos;
}
untie %DB;
close SOURCE;
0;
\end{verbatim}
2022-12-16 20:41:32 +01:00
% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\section{Postgresql}
2023-10-08 21:56:41 +02:00
Le poids lourd du domaine.
% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\section{Et le "NoSQL" ?} \index{nosql} \index{troll}
2022-12-16 20:41:32 +01:00
% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++