113 |
# get current time |
# get current time |
114 |
local time="$(date +%F\ %T)" |
local time="$(date +%F\ %T)" |
115 |
|
|
116 |
|
#get last primary key !!! |
117 |
|
|
118 |
# found, then update |
# found, then update |
119 |
if [[ ! -z ${id} ]] |
if [[ ! -z ${id} ]] |
120 |
then |
then |
137 |
else |
else |
138 |
# else import to database as new |
# else import to database as new |
139 |
mysqldo "INSERT INTO ${SQL_TABLE_PACKAGES} ( |
mysqldo "INSERT INTO ${SQL_TABLE_PACKAGES} ( |
140 |
|
id, |
141 |
pname, |
pname, |
142 |
pver, |
pver, |
143 |
pbuild, |
pbuild, |
153 |
flag |
flag |
154 |
) |
) |
155 |
VALUES ( |
VALUES ( |
156 |
|
'${id}', |
157 |
'${PNAME}', |
'${PNAME}', |
158 |
'${PVER}', |
'${PVER}', |
159 |
'${PBUILD}', |
'${PBUILD}', |
167 |
'${PROVIDE}', |
'${PROVIDE}', |
168 |
'${time}', |
'${time}', |
169 |
'1' |
'1' |
170 |
)" |
) ON DUPLICATE KEY UPDATE ${SQL_TABLE_PACKAGES} SET |
171 |
|
pname='${PNAME}', |
172 |
|
pver='${PVER}', |
173 |
|
pbuild='${PBUILD}', |
174 |
|
pcat='${pcatid}', |
175 |
|
state='${STATE}', |
176 |
|
description='${DESCRIPTION}', |
177 |
|
homepage='${HOMEPAGE}', |
178 |
|
pkgtype='${PKGTYPE}', |
179 |
|
depend='${DEPEND}', |
180 |
|
sdepend='${SDEPEND}', |
181 |
|
provide='${PROVIDE}', |
182 |
|
time='${time}', |
183 |
|
flag='1' |
184 |
|
WHERE id='${id}'" |
185 |
fi |
fi |
186 |
} |
} |
187 |
|
|