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)')

суббота, 28 апреля 2018 г., 19:21:29 UTC+3 пользователь 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 = GEN_ID(GENID_XML_FILES, 1);
>   ELSE
>   BEGIN
>     tmp = GEN_ID(GENID_XML_FILES, 0);
>     if (tmp < new.ID) then
>       tmp = GEN_ID(GENID_XML_FILES, new.ID-tmp);
>   END
> END!!
> SET TERM ; !!
>
>
> 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'), 
>>     Field('O'),
>>     Field('IS_IMPORTED'),
>>     Field('XML_FILE'),
>>     format='%(id)s %(F)s %(I)s %(O)s %(IS_IMPORTED)s %(XML_FILE)s',
>>     migrate=False)
>> default.py
>>
>> db_xml.xml_files.insert(F='Castle', I='Rick' O='Middlename' IS_IMPORTED='0' 
>> XML_FILE='<mytag>something</mytag>')
>>
>> DatabaseError: ('Error while preparing SQL statement:\n- SQLCODE: -104\n- 
>> invalid request BLR at offset 51\n- generator GENID_XML_FILES is not 
>> defined', -104, 335544343)
>>
>> <class 'fdb.fbcore.DatabaseError'>(('Error while preparing SQL statement:\n- 
>> SQLCODE: -104\n- invalid request BLR at offset 51\n- generator 
>> GENID_XML_FILES is not defined', -104, 335544343))
>>
>>
>> <https://lh3.googleusercontent.com/-RrHcXMOa-rw/WuL6wcaGruI/AAAAAAAAAIQ/sN64uARvcY4yw6EqTsLmxedtz0InheHtwCLcBGAs/s1600/Er.png>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to