Skip to content

Commit

Permalink
v18.46.0 Se integran double en tipo dato db
Browse files Browse the repository at this point in the history
  • Loading branch information
gamboamartin committed Apr 3, 2024
1 parent d47cc3f commit bad5f94
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 23 deletions.
41 changes: 21 additions & 20 deletions base/orm/sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct(){
}

/**
* POR DOCUMENTAR EN WIKI
* POR DOCUMENTAR EN WIKI FINAL REV
* Crea una sentencia SQL para agregar una nueva columna a una tabla.
*
* @param string $campo El nombre de la nueva columna a agregar.
Expand Down Expand Up @@ -261,7 +261,7 @@ private function data_index_unique(array $columnas, string $table, string $index
}

/**
* POR DOCUMENTAR EN WIKI
* POR DOCUMENTAR EN WIKI FINAL REV
* Genera una declaración SQL para establecer un valor predeterminado en una columna.
*
* @param string $value El valor predeterminado a establecer.
Expand Down Expand Up @@ -301,7 +301,7 @@ final public function describe_table(string $tabla): string|array


/**
* POR DOCUMENTAR EN WIKI
* POR DOCUMENTAR EN WIKI FINAL REV
* Elimina una columna de una tabla específica en la base de datos.
*
* @param string $campo La columna que se va a eliminar.
Expand All @@ -316,11 +316,11 @@ final public function drop_column(string $campo, string $table): string|array
{
$campo = trim($campo);
if($campo === ''){
return $this->error->error(mensaje: 'Error campo esta vacio', data: $campo);
return $this->error->error(mensaje: 'Error campo esta vacio', data: $campo, es_final: true);
}
$table = trim($table);
if($table === ''){
return $this->error->error(mensaje: 'Error table esta vacia', data: $table);
return $this->error->error(mensaje: 'Error table esta vacia', data: $table, es_final: true);
}
return trim("ALTER TABLE $table DROP COLUMN $campo;");

Expand Down Expand Up @@ -825,22 +825,22 @@ final public function rename_column(string $campo, string $new_name, string $tab
$table = trim($table);

if($campo === ''){
return $this->error->error(mensaje: 'Error campo esta vacio', data: $campo);
return $this->error->error(mensaje: 'Error campo esta vacio', data: $campo, es_final: true);
}
if($new_name === ''){
return $this->error->error(mensaje: 'Error new_name esta vacio', data: $new_name);
return $this->error->error(mensaje: 'Error new_name esta vacio', data: $new_name, es_final: true);
}
if($table === ''){
return $this->error->error(mensaje: 'Error table esta vacio', data: $table);
return $this->error->error(mensaje: 'Error table esta vacio', data: $table, es_final: true);
}
if(is_numeric($campo)){
return $this->error->error(mensaje: 'Error campo es numerico', data: $campo);
return $this->error->error(mensaje: 'Error campo es numerico', data: $campo, es_final: true);
}
if(is_numeric($new_name)){
return $this->error->error(mensaje: 'Error new_name es numerico', data: $new_name);
return $this->error->error(mensaje: 'Error new_name es numerico', data: $new_name, es_final: true);
}
if(is_numeric($table)){
return $this->error->error(mensaje: 'Error table es numerico', data: $table);
return $this->error->error(mensaje: 'Error table es numerico', data: $table, es_final: true);
}

return "ALTER TABLE $table RENAME COLUMN $campo to $new_name;";
Expand Down Expand Up @@ -992,7 +992,7 @@ public function update(string $campos_sql, int $id, string $tabla): string|array
}

/**
* POR DOCUMENTAR EN WIKI
* POR DOCUMENTAR EN WIKI FINAL REV
* Valida los valores de los argumentos campo, tabla y tipo de dato. Si alguno de ellos es una cadena vacía, devuelve un error.
*
* @param string $campo El nombre de la columna a validar.
Expand All @@ -1010,10 +1010,10 @@ final function valida_column(string $campo, string $table, string $tipo_dato, st

$tipo_dato = trim($tipo_dato);
if($tipo_dato === ''){
return $this->error->error(mensaje: 'Error tipo_dato esta vacio',data: $tipo_dato);
return $this->error->error(mensaje: 'Error tipo_dato esta vacio',data: $tipo_dato, es_final: true);
}
if(is_numeric($tipo_dato)){
return $this->error->error(mensaje: 'Error tipo_dato debe ser un texto',data: $tipo_dato);
return $this->error->error(mensaje: 'Error tipo_dato debe ser un texto',data: $tipo_dato, es_final: true);
}

$longitud = trim($longitud);
Expand All @@ -1022,7 +1022,8 @@ final function valida_column(string $campo, string $table, string $tipo_dato, st
if($tipo_dato === 'VARCHAR'){
if($longitud === ''){
return $this->error->error(
mensaje: 'Error tipo_dato esta VARCHAR entonces longitud debe ser u numero entero',data: $tipo_dato);
mensaje: 'Error tipo_dato esta VARCHAR entonces longitud debe ser u numero entero',
data: $tipo_dato, es_final: true);
}

}
Expand All @@ -1032,7 +1033,7 @@ final function valida_column(string $campo, string $table, string $tipo_dato, st
}

/**
* POR DOCUMENTAR EN WIKI
* POR DOCUMENTAR EN WIKI FINAL REV
* Esta función valida si el nombre del campo y la tabla proporcionados son válidos.
*
* @param string $campo El nombre del campo que se desea validar.
Expand All @@ -1048,18 +1049,18 @@ final public function valida_column_base(string $campo, string $table): true|arr
{
$campo = trim($campo);
if($campo === ''){
return $this->error->error(mensaje: 'Error campo esta vacio',data: $campo);
return $this->error->error(mensaje: 'Error campo esta vacio',data: $campo, es_final: true);
}
if(is_numeric($campo)){
return $this->error->error(mensaje: 'Error campo debe ser un texto',data: $campo);
return $this->error->error(mensaje: 'Error campo debe ser un texto',data: $campo, es_final: true);
}

$table = trim($table);
if($table === ''){
return $this->error->error(mensaje: 'Error table esta vacia',data: $table);
return $this->error->error(mensaje: 'Error table esta vacia',data: $table, es_final: true);
}
if(is_numeric($table)){
return $this->error->error(mensaje: 'Error table debe ser un texto',data: $table);
return $this->error->error(mensaje: 'Error table debe ser un texto',data: $table, es_final: true);
}
return true;

Expand Down
15 changes: 15 additions & 0 deletions instalacion/instalacion.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,21 @@ private function adm_tipo_dato(PDO $link): array|stdClass
$adm_tipo_dato['descripcion'] = 'TIMESTAMP';
$adm_tipo_dato['codigo'] = 'TIMESTAMP';


$adm_tipos_datos[] = $adm_tipo_dato;

$adm_tipo_dato['id'] = 6;
$adm_tipo_dato['descripcion'] = 'DOUBLE';
$adm_tipo_dato['codigo'] = 'DOUBLE';


$adm_tipos_datos[] = $adm_tipo_dato;

$adm_tipo_dato['id'] = 7;
$adm_tipo_dato['descripcion'] = 'FLOAT';
$adm_tipo_dato['codigo'] = 'FLOAT';


$adm_tipos_datos[] = $adm_tipo_dato;


Expand Down
6 changes: 3 additions & 3 deletions orm/_instalacion.php
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ final public function create_table(stdClass $campos, string $table): array|stdCl
}

/**
* POR DOCUMENTAR EN WIKI
* POR DOCUMENTAR EN WIKI FINAL REV
* Crea una nueva tabla si no existe y luego inicializa su AUTO_INCREMENT
*
* Esta función primero verifica si la tabla dada ya existe.
Expand Down Expand Up @@ -1243,10 +1243,10 @@ final public function foraneas(array $foraneas, string $table): array
{
$table = trim($table);
if($table === ''){
return $this->error->error(mensaje: 'Error table esta vacia',data: $table);
return $this->error->error(mensaje: 'Error table esta vacia',data: $table, es_final: true);
}
if(is_numeric($table)){
return $this->error->error(mensaje: 'Error table debe ser un texto',data: $table);
return $this->error->error(mensaje: 'Error table debe ser un texto',data: $table, es_final: true);
}
$results = array();
foreach ($foraneas as $campo=>$atributos){
Expand Down

0 comments on commit bad5f94

Please sign in to comment.