INSERT into PostGreSQL triggers "RevdbError" but no error

Sivakatirswami katir at hindu.org
Thu Sep 30 20:11:24 EDT 2010


  Aloha, Pierre:

Thank you!  there is nothing wrong with my SQL

If I use:
-------
put "INSERT INTO some-table (first_name, last_name, anonymous) VALUES 
('Batman', 'MosquitoEater', TRUE);" into tSQL
revExecuteSQL gConnectionID,tSQL
put the result into tResponse
-------

I get  '1'  which is success

ergo:  if my assumptions are correct, if you use revDataFromQuery for an 
insertion and
query the result you will get an error.

which makes sense... the latter is getting data out, the former is 
putting data in.
Problem solved, or rather, no problem at all except,
I was using the wrong rev dbase command for inserting data.

I guess I should probably study every single one of the revdb cmds in 
the library.



Om shanti
Sivakatirswami



On 9/30/10 12:17 PM, Pierre Sahores wrote:
> Have an eye on this about irev<=>  postgreSQL production state design skills :
>
>> >  			put "SELECT module_name,activation FROM"&&  CustModules&&  "WHERE module_name = '"&  tparam1&  "'" into sqlStatement
>> >  			put revQueryDatabase(myDatabaseID,sqlStatement) into dbCursorID
>> >  			if dbCursorID is not a number
>> >  			then return the result
>> >  			else
>> >  						
>> >  				put revDatabaseColumnNamed(dbCursorID,"activation") into nModuleState
>> >  				if nModuleState is in "NY" then
>> >  					
>> >  					if nModuleState is "Y"
>> >  					then put "N" into nModuleState
>> >  					else if nModuleState is "N"
>> >  					then put "Y" into nModuleState
>> >  					put "UPDATE"&&  CustModules&&  "SET activation = '"&  nModuleState&  "' WHERE module_name = '"&  tparam1&  "'" into sqlStatement2
>> >  					revExecuteSQL myDatabaseID,sqlStatement2
>> >  					if the result is not a number
>> >  					then return the result
>> >  					else
>> >  						return "MODULE_"&  nModuleState&  "_OK"
>> >  					end if
>> >  					
>> >  				else
>> >  					
>> >  					put "INSERT INTO"&&  CustModules&&  "(module_name,activation) VALUES ('"&  tparam1&  "','Y')" into sqlStatement2
>> >  					revExecuteSQL myDatabaseID,sqlStatement2
>> >  					if the result is not a number
>> >  					then return the result # "error while submitting the INSERT statement ..."
>> >  					else return "MODULE_UPDATE_OK"
>> >  					
>> >  				end if
>> >  				
>> >  			end if
> each "then return the result" will expose the original postgreSQL error message
>
> HTH,
>
> P.
>




More information about the use-livecode mailing list