[web2py] Re: Insert data in firebird database

2018-05-15 Thread Константин Комков
Nico de Groot and Raul Monares, thank you! I tested loading files less 64kb and thats files was loaded. On my work we will use folder "uploads" for store files. But I don't understan why operation INSERT is working not in all cases. There are two tables 'test' and 'bin_files'. Both tables have ge

Re: [web2py] Re: Insert data in firebird database

2018-05-14 Thread Raul Monares
The problem with the Firebird adapter is that it inserts blobs as base64 strings directly in an INSERT statement instead of using the stream mechanism that Firebird provides. There's a reported bug about this: https://github.com/web2py/web2py/issues/666. At this time, there's no workaround. O

Re: [web2py] Re: Insert data in firebird database

2018-05-14 Thread Nico de Groot
I added blob to the fieldname because in my code DAL checks for reserved SQL names. DATA is not allowed in some databases Op zo 13 mei 2018 om 11:39 schreef Константин Комков > Nico de Groot, thank you for example and attention! I already have crud > form and that form work. It load files in fol

[web2py] Re: Insert data in firebird database

2018-05-13 Thread Константин Комков
Nico de Groot, thank you for example and attention! I already have crud form and that form work. It load files in folder 'uploads'. I want to save that files in database now. I sure that stream=open(filepath + '\\' + i.file, 'rb') and stream.read() made a long base64 string because I saw it on s

[web2py] Re: Insert data in firebird database

2018-05-12 Thread Raul Monares
Take into account that the Firebird DAL adapter has a 64kb limit for inserting blobs. On Friday, April 27, 2018 at 4:27:48 AM UTC-6, Константин Комков wrote: > > Hello! I'm trying add data in my table. > tables.py > db_xml.define_table('xml_files', > Field('F'), > Field('I'), > Fiel

[web2py] Re: Insert data in firebird database

2018-05-12 Thread Nico de Groot
Minimal example using web2py DAL as a script. I'm not using firebird but your example with the string shows that the storage in a blob is working in firebird (Note that a python string is saved as binary data in a blob). In a webapp, move code to model file and to a controller, or use a form to

[web2py] Re: Insert data in firebird database

2018-05-11 Thread Константин Комков
That 'example' isn't work too(((. Can anyone advice how can I insert data in blob field. There are one interesting thing. This code is working. db_xml.define_table('bin_files', Field('id','integer'), Field('PARENT'), Field('SRC_FILENAME')

[web2py] Re: Insert data in firebird database

2018-05-07 Thread Константин Комков
I found only one working example. tables.py db_xml.define_table('bin_files', Field('id','integer'), Field('PARENT'), Field('SRC_FILENAME'), Field('DATA', 'blob'), primarykey=['id','PARENT'],

[web2py] Re: Insert data in firebird database

2018-05-03 Thread Константин Комков
I found example: tables.py db_xml.define_table('test', Field('NAME', 'string'), Field('FILE', 'string') ) default.py db_xml.test.insert(NAME='something', FILE='somthing') But it's not working, becouse generator not defined. In database I created generator and trigge

[web2py] Re: Insert data in firebird database

2018-05-03 Thread Константин Комков
Can you make example please. How I shoud use another type fore some fields at the same time? What type is correct: list:string, reference , list:reference ? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code

[web2py] Re: Insert data in firebird database

2018-05-01 Thread Nico de Groot
You don’t need to use sqlexecute(), insert can handle multiple fields. But you do need to separate them with comma. In the field definitions you need to add the field type otherwise the default type is assumed (string). See the DAL documentation for details. Nico -- Resources: - http://web2py

[web2py] Re: Insert data in firebird database

2018-05-01 Thread Константин Комков
Thank you, as I understand web2py function INSERT have only one argument and if I want to pass 2 or more variables I should use something else? I have read about executesql and use it for inserting some variables like that: db.executesql('INSERT INTO table (var1, var2, var3) VALUES (1, 2, 3)') с

[web2py] Re: Insert data in firebird database

2018-04-28 Thread Raul Monares
If web2py didn't create the generator and trigger, you can do it manually with this DDL CREATE GENERATOR GENID_XML_FILES; SET TERM !! ; CREATE TRIGGER XML_FILES_BI FOR XML_FILES ACTIVE BEFORE INSERT POSITION 0 AS DECLARE VARIABLE tmp DECIMAL(18,0); BEGIN IF (NEW.ID IS NULL) THEN NEW.ID = G