本帖最后由 heavenm 于 2018-9-5 18:05 编辑 _SQLiteEx_Write($pjtDB, '表.字段', 值(可以为数组))
Func _SQLiteEx_Write($_hdb, $_table, $_vaule)
$__table = StringRegExp($_table, '[^\.]+', 3) ;拆分表与表名,以点(.)分隔!
If IsArray($_vaule) Then
For $i = 0 To UBound($_vaule) - 1
_SQLiteEx_Write($_hdb, $_table, _ArrayToString($_vaule, ',', $i, $i))
Next
Else
$__vaule = StringTrimRight(StringRegExpReplace($_vaule, '(?m)[' & "'" & '"]*([^,=\v' & "'" & '"]*)[' & "'" & '"]*(?:,|$)', '"\1",'), 4)
$_sCommand = 'INSERT OR IGNORE INTO ' & $__table[0] & ' (' & $__table[1] & ') VALUES (' & $__vaule & ')'
ConsoleWrite($_sCommand & @CRLF)
_SQLite_Exec($_hdb, $_sCommand)
EndIf
EndFunc ;==>_SQLiteEx_Write
OK,又搞定个SQLITE,现在经常用SQLITE去操作,这样子方便多了!第一次写这种代码 函数里面套用自身~ |