version 1.66, 2012/08/22 10:47:18
|
version 1.72, 2013/02/27 17:11:44
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.10 |
RPL/2 (R) version 4.1.13 |
Copyright (C) 1989-2012 Dr. BERTRAND Joël |
Copyright (C) 1989-2013 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 385 instruction_write(struct_processus *s_et
|
Line 385 instruction_write(struct_processus *s_et
|
|
|
int adresse[16]; |
int adresse[16]; |
int port; |
int port; |
|
int sqlite_status; |
|
|
integer8 clef; |
integer8 clef; |
integer8 compteur; |
integer8 compteur; |
Line 424 instruction_write(struct_processus *s_et
|
Line 425 instruction_write(struct_processus *s_et
|
|
|
struct flock lock; |
struct flock lock; |
|
|
|
struct timespec attente; |
|
|
uint32_t calcul_adresse; |
uint32_t calcul_adresse; |
|
|
unsigned char *chaine; |
unsigned char *chaine; |
Line 760 instruction_write(struct_processus *s_et
|
Line 763 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
if (sqlite3_step(ppStmt) != SQLITE_ROW) |
attente.tv_sec = 0; |
|
attente.tv_nsec = GRANULARITE_us * 1000; |
|
|
|
do |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
sqlite_status = sqlite3_step(ppStmt); |
return; |
|
} |
if (sqlite_status == SQLITE_ROW) |
|
{ |
|
break; |
|
} |
|
else if ((sqlite_status == SQLITE_BUSY) || |
|
(sqlite_status == SQLITE_LOCKED)) |
|
{ |
|
nanosleep(&attente, NULL); |
|
INCR_GRANULARITE(attente.tv_nsec); |
|
} |
|
else |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
|
} while(sqlite_status != SQLITE_ROW); |
|
|
if (sqlite3_column_type(ppStmt, 0) != SQLITE_INTEGER) |
if (sqlite3_column_type(ppStmt, 0) != SQLITE_INTEGER) |
{ |
{ |
Line 917 instruction_write(struct_processus *s_et
|
Line 939 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
switch(sqlite3_step(ppStmt)) |
attente.tv_sec = 0; |
{ |
attente.tv_nsec = GRANULARITE_us * 1000; |
case SQLITE_ROW: |
|
{ |
|
// Une clef existe. |
|
|
|
mise_a_jour = d_vrai; |
|
break; |
|
} |
|
|
|
case SQLITE_DONE: |
do |
|
{ |
|
switch(sqlite_status = sqlite3_step(ppStmt)) |
{ |
{ |
// Aucune clef n'existe. |
case SQLITE_ROW: |
|
|
mise_a_jour = d_faux; |
|
|
|
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
|
|
|
free(commande); |
|
|
|
if (alsprintf(&commande, "insert into key " |
|
"(key) values ('%s')", clef_utf8) < 0) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = |
// Une clef existe. |
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (sqlite3_prepare_v2((*descripteur) |
mise_a_jour = d_vrai; |
.descripteur_sqlite, |
break; |
commande, strlen(commande), &ppStmt, &queue) |
|
!= SQLITE_OK) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
} |
|
|
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
case SQLITE_DONE: |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
// Aucune clef n'existe. |
d_es_erreur_fichier; |
|
return; |
|
} |
|
|
|
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
mise_a_jour = d_faux; |
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
|
|
|
free(commande); |
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
|
|
|
free(commande); |
|
|
|
if (alsprintf(&commande, "insert into key " |
|
"(key) values ('%s')", clef_utf8) < 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (sqlite3_prepare_v2((*descripteur) |
|
.descripteur_sqlite, |
|
commande, strlen(commande), &ppStmt, &queue) |
|
!= SQLITE_OK) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
|
|
|
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
|
|
|
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
|
|
|
free(commande); |
|
|
|
if (alsprintf(&commande, "select id from key " |
|
"where key = '%s'", clef_utf8) < 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (sqlite3_prepare_v2((*descripteur) |
|
.descripteur_sqlite, |
|
commande, strlen(commande), &ppStmt, &queue) |
|
!= SQLITE_OK) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
|
|
if (alsprintf(&commande, "select id from key " |
break; |
"where key = '%s'", clef_utf8) < 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
} |
|
|
if (sqlite3_prepare_v2((*descripteur) |
case SQLITE_BUSY: |
.descripteur_sqlite, |
case SQLITE_LOCKED: |
commande, strlen(commande), &ppStmt, &queue) |
|
!= SQLITE_OK) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = |
nanosleep(&attente, NULL); |
d_es_erreur_fichier; |
INCR_GRANULARITE(attente.tv_nsec); |
return; |
break; |
} |
} |
|
|
if (sqlite3_step(ppStmt) != SQLITE_ROW) |
default: |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
} |
} |
|
|
break; |
|
} |
} |
|
} while(sqlite_status != SQLITE_ROW); |
default: |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
|
} |
|
|
|
if (sqlite3_column_type(ppStmt, 0) != SQLITE_INTEGER) |
if (sqlite3_column_type(ppStmt, 0) != SQLITE_INTEGER) |
{ |
{ |