igorrino
2nd January 2008, 18:27
The custion is that I would like to update a field of a table,i have a file with the table, the field , and the new value to be assigned to the field,I have done the select, but i need to do the update of the camp, which is located in the variable camp, someone knows how to do it?, function below already written works and secorre tables, what is lacking is the only update of the field with the value that I want.
| Errors should now return false - so unallocated tables will be skipped.
error.bypass = 1
found = false
sql = "select " & camp & " from " & tablat
db.retry.point()
sql_id = sql.parse("select " & camp & " from " & tablat & " for update" )
sql.exec(sql_id)
while not sql.fetch(sql_id)|Here is the loop you use instead of the selectdo/endselectendwhile
count=count+1
endwhile
error.bypass = 0
sql.break(sql_id)
sql.close(sql_id)
bdittmar
2nd January 2008, 19:06
The custion is that I would like to update a field of a table,i have a file with the table, the field , and the new value to be assigned to the field,I have done the select, but i need to do the update of the camp, which is located in the variable camp, someone knows how to do it?, function below already written works and secorre tables, what is lacking is the only update of the field with the value that I want.
| Errors should now return false - so unallocated tables will be skipped.
error.bypass = 1
found = false
sql = "select " & camp & " from " & tablat
db.retry.point()
sql_id = sql.parse("select " & camp & " from " & tablat & " for update" )
sql.exec(sql_id)
while not sql.fetch(sql_id)|Here is the loop you use instead of the selectdo/endselectendwhile
count=count+1
endwhile
error.bypass = 0
sql.break(sql_id)
sql.close(sql_id)
Hallo,
Deutsches Forum !!
Versteht das jemand ?
Regards
csecgn
2nd January 2008, 21:24
Versteht das jemand ?
Die Spache würde ich sagen ist Englisch. Beim Rest bin ich mir auch nicht ganz sicher :)
@Moderators: Can you move this thread to the tools forum? Thanks.
@igorrino
If I understand you correctly, you are trying to write a "universal update function". The table and the tablefields are only defined by a flat-file.
This could work:
Errors should now return false - so unallocated tables will be skipped.
long table.id
error.bypass = 1
found = false
sql = "select " & camp & " from " & tablat
sql_id = sql.parse("select " & camp & " from " & tablat)
sql.exec(sql_id)
while TRUE
on case ( sql.fetch(sql_id) )
case eendfile:
break
case 0:
table.id = 0
table.id = db.bind(tablat)
db.retry.point()
db.lock.table(table.id)
put.var(pid, camp, <new_value>)
db.update(table.id, db.retry)
commit.transaction()
break
default: | error
message("Error %d occurred", db.error)
endcase
break
endwhile
error.bypass = 0
sql.break(sql_id)
sql.close(sql_id)
hth
Regards
Christof