Donate Share

PHP Text DB API

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

errors when integer fields defaults to zero

You are viewing a single message from this topic. View all messages.

  1. 2004-08-23 11:57:38 UTC
    I'm using php5 and CVS 0.3 beta version, patched to support
    definable field separators (with my provided patch)

    Consider the following SQL query:

    CREATE TABLE asignaturas (
    codigo INT DEFAULT 11,
    abreviatura TEXT DEFAULT 'NONE',
    nombre TEXT DEFAULT 'Asignatura vacia',
    semestre INT DEFAULT 1,
    creditos INT DEFAULT 10
    );

    when executed i get the file:
    [jantonio@jonsy labo-2004]$ cat asignaturas.txt
    codigo:abreviatura:nombre:semestre:creditos
    int:text:text:int:int
    10:NONE:Asignatura vacia:1:10

    that is correct.
    Now change "creditos" default to 0. I'll get this file:
    [jantonio@jonsy labo-2004]$ cat asignaturas.txt
    codigo:abreviatura:nombre:semestre:creditos
    int:text:text:int:int
    10:NONE:Asignatura vacia:1:

    !hey! ¿what happened with default value for "creditos"?

    Things go worst when defaults to zero other fields:
    - defaulting "semestre" to 0 gives:
    [jantonio@jonsy labo-2004]$ cat asignaturas.txt
    codigo:abreviatura:nombre:semestre
    int:text:text:int
    10:NONE:Asignatura vacia:
    ( last field dissapeared )

    - and worst: defaulting "codigo" (first field) to zero gives me:
    [jantonio@jonsy labo-2004]$ cat asignaturas.txt
    codigo
    int

    totally broken.

    So extrange things occurs when defaulting to zero. seems
    that parser stop working...

    ¿any ideas?
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.