pylhb 0.2.5__tar.gz → 0.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pylhb
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: Mr.Lee's Helpers
5
5
  License: Non-Commercial Use License
6
6
 
@@ -44,6 +44,8 @@ Description-Content-Type: text/markdown
44
44
  使用示例:
45
45
 
46
46
  ```
47
+ from pylhb.myodbc import MSSQL
48
+
47
49
  if __name__ == "__main__":
48
50
  server="127.0.0.1"
49
51
  user="sa"
@@ -115,6 +117,8 @@ if __name__ == "__main__":
115
117
  使用示例:
116
118
 
117
119
  ```
120
+ from pylhb.myconfig import MyConfig
121
+
118
122
  if __name__ == "__main__":
119
123
  config = MyConfig("config.ini")
120
124
  config.set("main", "host", "127.0.0.1")
@@ -195,6 +199,8 @@ if __name__ == "__main__":
195
199
  使用示例:
196
200
 
197
201
  ```
202
+ from pylhb.mylog import MyLog
203
+
198
204
  if __name__ == "__main__":
199
205
  myLog= MyLog()
200
206
  myLog.add("This is a test log entry.")
@@ -207,7 +213,78 @@ json配置操作
207
213
  使用示例:
208
214
 
209
215
  ```
216
+ from pylhb.myjson import MyJSON
217
+
210
218
  if __name__ == "__main__":
211
219
  appJson = MyJSON("config.json")
212
220
  print(appJson.get("host"))
213
221
  ```
222
+
223
+ ## 🌺mysqlite
224
+
225
+ SQLite配置操作
226
+
227
+ 使用示例:
228
+
229
+ ```
230
+ from pylhb.mysqlite import SQLite
231
+
232
+ if __name__ == "__main__":
233
+ # 创建数据库实例
234
+ db = SQLite("test.db")
235
+
236
+ # 连接数据库
237
+ db.connect()
238
+
239
+ # 创建表
240
+ columns = {
241
+ "id": "INTEGER PRIMARY KEY AUTOINCREMENT",
242
+ "name": "TEXT NOT NULL",
243
+ "age": "INTEGER",
244
+ "email": "TEXT"
245
+ }
246
+ db.createTable("users", columns)
247
+
248
+ # 插入数据
249
+ user1 = {"name": "张三", "age": 25, "email": "zhangsan@example.com"}
250
+ user2 = {"name": "李四", "age": 30, "email": "lisi@example.com"}
251
+ user3 = {"name": "王五", "age": 28, "email": "wangwu@example.com"}
252
+
253
+ db.insert("users", user1)
254
+ db.insert("users", user2)
255
+ db.insert("users", user3)
256
+
257
+ # 查询所有数据
258
+ print("所有用户:")
259
+ users = db.select("users")
260
+ for user in users:
261
+ print(user)
262
+
263
+ # 条件查询
264
+ print("\n年龄大于28的用户:")
265
+ users = db.select("users", where="age > ?", params=(28,))
266
+ for user in users:
267
+ print(user)
268
+
269
+ # 更新数据
270
+ update_data = {"age": 31}
271
+ db.update("users", update_data, "name = ?", ("李四",))
272
+
273
+ # 查询特定列
274
+ print("\n用户姓名和邮箱:")
275
+ users = db.select("users", columns=["name", "email"])
276
+ for user in users:
277
+ print(user)
278
+
279
+ # 删除数据
280
+ db.delete("users", "name = ?", ("王五",))
281
+
282
+ # 再次查询所有数据
283
+ print("\n删除后的所有用户:")
284
+ users = db.select("users")
285
+ for user in users:
286
+ print(user)
287
+
288
+ # 关闭连接
289
+ db.close()
290
+ ```
@@ -11,6 +11,8 @@
11
11
  使用示例:
12
12
 
13
13
  ```
14
+ from pylhb.myodbc import MSSQL
15
+
14
16
  if __name__ == "__main__":
15
17
  server="127.0.0.1"
16
18
  user="sa"
@@ -82,6 +84,8 @@ if __name__ == "__main__":
82
84
  使用示例:
83
85
 
84
86
  ```
87
+ from pylhb.myconfig import MyConfig
88
+
85
89
  if __name__ == "__main__":
86
90
  config = MyConfig("config.ini")
87
91
  config.set("main", "host", "127.0.0.1")
@@ -162,6 +166,8 @@ if __name__ == "__main__":
162
166
  使用示例:
163
167
 
164
168
  ```
169
+ from pylhb.mylog import MyLog
170
+
165
171
  if __name__ == "__main__":
166
172
  myLog= MyLog()
167
173
  myLog.add("This is a test log entry.")
@@ -174,7 +180,78 @@ json配置操作
174
180
  使用示例:
175
181
 
176
182
  ```
183
+ from pylhb.myjson import MyJSON
184
+
177
185
  if __name__ == "__main__":
178
186
  appJson = MyJSON("config.json")
179
187
  print(appJson.get("host"))
180
188
  ```
189
+
190
+ ## 🌺mysqlite
191
+
192
+ SQLite配置操作
193
+
194
+ 使用示例:
195
+
196
+ ```
197
+ from pylhb.mysqlite import SQLite
198
+
199
+ if __name__ == "__main__":
200
+ # 创建数据库实例
201
+ db = SQLite("test.db")
202
+
203
+ # 连接数据库
204
+ db.connect()
205
+
206
+ # 创建表
207
+ columns = {
208
+ "id": "INTEGER PRIMARY KEY AUTOINCREMENT",
209
+ "name": "TEXT NOT NULL",
210
+ "age": "INTEGER",
211
+ "email": "TEXT"
212
+ }
213
+ db.createTable("users", columns)
214
+
215
+ # 插入数据
216
+ user1 = {"name": "张三", "age": 25, "email": "zhangsan@example.com"}
217
+ user2 = {"name": "李四", "age": 30, "email": "lisi@example.com"}
218
+ user3 = {"name": "王五", "age": 28, "email": "wangwu@example.com"}
219
+
220
+ db.insert("users", user1)
221
+ db.insert("users", user2)
222
+ db.insert("users", user3)
223
+
224
+ # 查询所有数据
225
+ print("所有用户:")
226
+ users = db.select("users")
227
+ for user in users:
228
+ print(user)
229
+
230
+ # 条件查询
231
+ print("\n年龄大于28的用户:")
232
+ users = db.select("users", where="age > ?", params=(28,))
233
+ for user in users:
234
+ print(user)
235
+
236
+ # 更新数据
237
+ update_data = {"age": 31}
238
+ db.update("users", update_data, "name = ?", ("李四",))
239
+
240
+ # 查询特定列
241
+ print("\n用户姓名和邮箱:")
242
+ users = db.select("users", columns=["name", "email"])
243
+ for user in users:
244
+ print(user)
245
+
246
+ # 删除数据
247
+ db.delete("users", "name = ?", ("王五",))
248
+
249
+ # 再次查询所有数据
250
+ print("\n删除后的所有用户:")
251
+ users = db.select("users")
252
+ for user in users:
253
+ print(user)
254
+
255
+ # 关闭连接
256
+ db.close()
257
+ ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pylhb"
3
- version = "0.2.5"
3
+ version = "0.2.6"
4
4
  description = "Mr.Lee's Helpers"
5
5
  readme = "README.md"
6
6
  license = {file = "LICENSE"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes